/*
 * Forms rendered by the yebisu-core plugin:
 *   [yebisu_form name="contact|consultation"]   .yb-form
 *   [yebisu_register_form] / [yebisu_register_form_en]    .yb-reg + .yb-form--register
 * The plugin ships no CSS; this is all of it. Same look in a page, in the
 * consultation popup (.yb-dialog) and in the footer.
 * Field sizes measured from the live contact form at 1440 / 390 px.
 */

.yb-form {
  --yb-form-gap: 20px;
  width: 100%;
  color: var(--yb-color-text, rgb(0 0 0 / 80%));
}

.yb-form [hidden],
.yb-reg [hidden] {
  display: none !important;
}

.yb-form__fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--yb-form-gap);
}

.yb-form__field {
  display: flex;
  flex: 1 1 100%;
  flex-direction: column;
  min-width: 0;
}

.yb-form__field--half {
  flex-basis: calc(50% - var(--yb-form-gap) / 2);
}

.yb-form__label {
  padding-bottom: 5px;
  color: var(--yb-color-black, #000);
  font-size: 14px;
  line-height: 1.4;
}

.yb-form__required {
  margin-left: 2px;
  color: var(--yb-color-primary, #006aa6);
}

.yb-form__input {
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 14px 20px;
  border: 1px solid var(--yb-color-border, rgb(0 0 0 / 10%));
  border-radius: 9px;
  background: var(--yb-color-white, #fff);
  color: var(--yb-color-text, rgb(0 0 0 / 80%));
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.yb-form__input::placeholder {
  color: var(--yb-color-muted, #7e7e7e);
  opacity: 1;
}

.yb-form__input:focus {
  border-color: var(--yb-color-primary, #006aa6);
  outline: none;
  box-shadow: 0 0 0 3px rgb(0 106 166 / 15%);
}

.yb-form__input--textarea {
  min-height: 89px;
  resize: vertical;
}

.yb-form__input--select {
  appearance: auto;
}

.yb-form__field--invalid .yb-form__input {
  border-color: #c62828;
}

.yb-form__field--invalid .yb-form__input:focus {
  box-shadow: 0 0 0 3px rgb(198 40 40 / 15%);
}

.yb-form__error {
  margin: 6px 0 0;
  color: #c62828;
  font-size: 13px;
  line-height: 1.4;
}

.yb-form__hint {
  margin: 6px 0 0;
  color: var(--yb-color-muted, #7e7e7e);
  font-size: 13px;
  line-height: 1.4;
}

.yb-form__actions {
  margin-top: var(--yb-form-gap);
}

/* Inside the field row the row gap already spaces the button. */
.yb-form__fields > .yb-form__actions {
  flex-basis: 100%;
  margin-top: 0;
}

.yb-form__submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border: 0;
  border-radius: var(--yb-radius-pill, 100px);
  background: var(--yb-color-primary, #006aa6);
  color: var(--yb-color-white, #fff);
  font: inherit;
  font-size: var(--yb-size-button, 15px);
  font-weight: var(--yb-weight-medium, 500);
  line-height: 1;
  letter-spacing: var(--yb-tracking-button, -0.2px);
  cursor: pointer;
  transition: background-color 0.2s;
}

.yb-form__submit:hover {
  background: var(--yb-color-primary-hover, #005d94);
}

.yb-form__submit:focus-visible {
  outline: 2px solid var(--yb-color-primary, #006aa6);
  outline-offset: 3px;
}

.yb-form--busy .yb-form__submit {
  cursor: progress;
  opacity: 0.7;
}

.yb-form__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgb(255 255 255 / 30%);
  border-top-color: var(--yb-color-white, #fff);
  border-radius: 50%;
  animation: yb-form-spin 0.6s linear infinite;
}

.yb-form--busy .yb-form__spinner {
  display: inline-block;
}

@keyframes yb-form-spin {
  to {
    transform: rotate(360deg);
  }
}

.yb-form__message {
  margin-top: var(--yb-form-gap);
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: var(--yb-radius-field, 8px);
  font-size: 14px;
  line-height: 1.4;
}

.yb-form__message:focus {
  outline: none;
}

.yb-form__message--success {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}

.yb-form__message--error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.yb-form__message--confirm {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #075985;
}

@media (max-width: 767px) {
  .yb-form__field--half {
    flex-basis: 100%;
  }

  /* 16 px keeps iOS from zooming into the field. */
  .yb-form__input {
    font-size: 16px;
  }
}

/* ---------- In the consultation popup ---------- */

.yb-dialog .yb-form {
  --yb-form-gap: 15px;
}

.yb-dialog .yb-form__input--textarea {
  min-height: 70px;
}

/* ---------- Registration (/registreerimine/, /registration/) ---------- */

.yb-reg {
  max-width: 640px;
  margin: 40px auto 60px;
  padding: 0 20px;
}

.yb-reg__intro {
  margin: 0 0 32px;
  color: #6b7280;
  font-size: 15px;
}

.yb-form--register {
  --yb-form-gap: 18px;
}

.yb-form--register .yb-form__fields {
  column-gap: 16px;
}

.yb-form--register .yb-form__field--half {
  flex-basis: calc(50% - 8px);
}

.yb-form--register .yb-form__input--textarea {
  min-height: 80px;
}

.yb-reg__errors {
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
}

.yb-reg__errors p {
  margin: 4px 0;
  color: #dc2626;
  font-size: 14px;
}

.yb-reg__success {
  padding: 48px 0;
  text-align: center;
}

.yb-reg__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 24px;
  border-radius: 50%;
  background: #ecfdf5;
  color: #059669;
}

.yb-reg__check svg {
  width: 36px;
  height: 36px;
}

.yb-reg__title {
  margin: 0 0 8px;
  color: #1a1a2e;
  font-size: 24px;
  font-weight: 600;
}

.yb-reg__success p {
  margin: 0 0 6px;
  color: #6b7280;
  font-size: 15px;
}

.yb-reg__success .yb-reg__email-note {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 20px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 14px;
}

.yb-reg__home {
  color: var(--yb-color-primary, #006aa6);
}

@media (max-width: 600px) {
  .yb-form--register .yb-form__field--half {
    flex-basis: 100%;
  }
}
