/* ==========================================================================
   Форма онлайн-запису
   ========================================================================== */

.appointment-form {
  --af-accent: #f87373;
  --af-error: #ff6b6b;
  --af-success: #2fbf71;
  --af-radius: 8px;
  max-width: 100%;
  margin: 0;
}

.appointment-form__field {
  position: relative;
  margin-bottom: 14px;
}

.appointment-form__row {
  display: flex;
  gap: 12px;
}

.appointment-form__row .appointment-form__field {
  flex: 1 1 0;
  min-width: 0;
}

.appointment-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 500;
  color: #fff;
}

.appointment-form__hint {
  font-weight: 400;
  opacity: 0.6;
  font-size: 12px;
}

.appointment-form input[type="text"],
.appointment-form input[type="tel"],
.appointment-form select,
.appointment-form textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 10px 16px;
  margin: 0;
  font-family: inherit;
  font-size: 16px;
  line-height: 19px;
  color: #0d1112;
  background: #fff;
  border: 1px solid transparent;
  border-radius: var(--af-radius);
  box-shadow: 0 4px 30px rgba(1, 47, 86, 0.1);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.appointment-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='6'%20viewBox='0%200%2010%206'%3E%3Cpath%20d='M1%201l4%204%204-4'%20stroke='%230d1112'%20stroke-width='1.5'%20fill='none'%20stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.appointment-form select:disabled {
  color: #8a9096;
  background-color: #f2f3f4;
  cursor: not-allowed;
}

.appointment-form input[data-datepicker],
.appointment-form input.af-date-input {
  cursor: pointer;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3E%3Crect%20x='1'%20y='3'%20width='14'%20height='12'%20rx='2'%20stroke='%230d1112'%20stroke-width='1.3'%20fill='none'/%3E%3Cpath%20d='M1%206.5h14M5%201v3M11%201v3'%20stroke='%230d1112'%20stroke-width='1.3'%20stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.appointment-form textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.4;
}

.appointment-form input:focus,
.appointment-form select:focus,
.appointment-form textarea:focus {
  border-color: var(--af-accent);
  box-shadow: 0 0 0 3px rgba(248, 115, 115, 0.25);
}

/* --- стани валідації --- */

.appointment-form .is-invalid {
  border-color: var(--af-error) !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2) !important;
}

.appointment-form .is-valid {
  border-color: rgba(47, 191, 113, 0.7) !important;
}

.appointment-form__error {
  display: block;
  max-height: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
  color: var(--af-error);
  opacity: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease, margin-top 0.2s ease;
}

.appointment-form__error.is-visible {
  max-height: 60px;
  margin-top: 5px;
  opacity: 1;
}

.appointment-form__counter {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  text-align: right;
  color: rgba(255, 255, 255, 0.5);
}

/* --- кнопка --- */

.appointment-form__submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 166px;
  min-height: 43px;
  margin-top: 8px;
  padding: 12px 25px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  background: var(--af-accent);
  border: none;
  border-radius: 40px;
  cursor: pointer;
  transition: background 0.25s ease, opacity 0.25s ease;
}

.appointment-form__submit:hover {
  background: #e15f5f;
}

.appointment-form__submit[disabled] {
  opacity: 0.7;
  cursor: default;
}

.appointment-form__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: af-spin 0.7s linear infinite;
}

.appointment-form.is-loading .appointment-form__spinner {
  display: block;
}

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

.appointment-form__status {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.35;
  border-radius: var(--af-radius);
}

.appointment-form__status.is-error {
  display: block;
  color: #fff;
  background: rgba(255, 107, 107, 0.18);
  border: 1px solid var(--af-error);
}

.appointment-form__policy {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
}

/* ==========================================================================
   Модальне вікно подяки
   ========================================================================== */

.appointment-success {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(13, 17, 18, 0.65);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.appointment-success.is-open {
  opacity: 1;
  visibility: visible;
}

.appointment-success__body {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 45px 35px 35px;
  text-align: center;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(1, 47, 86, 0.25);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

.appointment-success.is-open .appointment-success__body {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.appointment-success__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  font-size: 22px;
  line-height: 1;
  color: #8a9096;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.appointment-success__close:hover {
  color: #0d1112;
  background: #f2f3f4;
}

.appointment-success__icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(47, 191, 113, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.appointment-success__icon svg {
  width: 34px;
  height: 34px;
}

.appointment-success__icon svg path {
  stroke-dasharray: 32;
  stroke-dashoffset: 32;
}

.appointment-success.is-open .appointment-success__icon svg path {
  animation: af-check 0.45s 0.2s ease forwards;
}

@keyframes af-check {
  to {
    stroke-dashoffset: 0;
  }
}

.appointment-success__title {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  color: #0d1112;
}

.appointment-success__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: #5a6166;
}

.appointment-success__details {
  margin: 18px 0 0;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #0d1112;
  background: #f6f7f8;
  border-radius: 8px;
}

.appointment-success__details:empty {
  display: none;
}

/* ==========================================================================
   Flatpickr — узгодження з дизайном сайту
   ========================================================================== */

.flatpickr-calendar.appointment-calendar {
  z-index: 999999999;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(1, 47, 86, 0.18);
  font-family: inherit;
}

.appointment-calendar .flatpickr-day.selected,
.appointment-calendar .flatpickr-day.selected:hover {
  background: #f87373;
  border-color: #f87373;
}

.appointment-calendar .flatpickr-day.today {
  border-color: #f87373;
}

.appointment-calendar .flatpickr-day:hover {
  background: rgba(248, 115, 115, 0.15);
  border-color: transparent;
}

.appointment-calendar .flatpickr-day.flatpickr-disabled,
.appointment-calendar .flatpickr-day.flatpickr-disabled:hover {
  color: rgba(13, 17, 18, 0.2);
  text-decoration: line-through;
}

/* ==========================================================================
   Адаптив
   ========================================================================== */

@media screen and (max-width: 480px) {
  .appointment-form__row {
    display: block;
  }
  .appointment-success__body {
    padding: 40px 22px 28px;
  }
  .appointment-success__title {
    font-size: 20px;
  }
}
