/* ═══════════════════════════════════════════
/ Booking modal
/ ═══════════════════════════════════════════ */
.booking-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.booking-modal[hidden] {
  display: none;
}

/* ─── Backdrop ─── */
.booking-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38, 30, 22, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: bm-fade 0.2s ease both;
}

/* ─── Panel ─── */
.booking-modal__panel {
  position: relative;
  width: min(460px, 100%);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-lg);
  box-shadow:
    0 18px 60px rgba(60, 45, 30, 0.22),
    0 2px 8px rgba(60, 45, 30, 0.06);
  overflow: hidden;
  animation: bm-pop 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* Тёплая подсветка шапки — фирменный акцент Flamy */
.booking-modal__panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 132px;
  background: linear-gradient(180deg, var(--peach-soft) 0%, rgba(255, 253, 247, 0) 100%);
  pointer-events: none;
}

.booking-modal__form-section[hidden],
.booking-modal__success[hidden],
.booking-modal__times[hidden],
.booking-modal__picker[hidden] {
  display: none !important;
}

/* ─── Close ─── */
.booking-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-pill);
  color: var(--text-2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.booking-modal__close:hover {
  background: var(--card);
  border-color: var(--peach);
  color: var(--text);
}

/* ─── Scroll area ─── */
.booking-modal__body {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 26px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-warm) transparent;
}
.booking-modal__body::-webkit-scrollbar {
  width: 6px;
}
.booking-modal__body::-webkit-scrollbar-thumb {
  background: var(--border-warm);
  border-radius: var(--r-pill);
}

/* ─── Title ─── */
.booking-modal__title {
  margin: 0 0 20px;
  padding-right: 40px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.booking-modal__title::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-top: 10px;
  background: var(--peach);
  border-radius: var(--r-pill);
}

/* Информационная плашка о выбранном слоте (если рендерится из JS) */
.booking-modal__slot {
  margin-bottom: 16px;
  padding: 11px 14px;
  background: var(--yellow-soft);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text-2);
}

/* ─── Поля ─── */
.booking-modal__form,
.booking-modal__fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.booking-modal__label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.booking-modal__select,
.booking-modal__textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.4;
  background: var(--card);
  color: var(--text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.booking-modal__select {
  height: 44px;
  padding-right: 40px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235c554c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
  cursor: pointer;
}
.booking-modal__textarea {
  resize: vertical;
  min-height: 64px;
}
.booking-modal__select:hover,
.booking-modal__textarea:hover {
  border-color: var(--border-warm);
}
.booking-modal__select:focus,
.booking-modal__textarea:focus {
  outline: none;
  border-color: var(--peach);
  box-shadow: 0 0 0 3px var(--peach-soft);
}
.booking-modal__textarea::placeholder {
  color: var(--text-3);
}

.booking-modal__client {
  padding: 12px 14px;
  background: var(--yellow-soft);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}
.booking-modal__client:empty {
  display: none;
}

/* ─── Submit ─── */
.booking-modal__submit {
  width: 100%;
  height: 48px;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(249, 141, 160, 0.3);
}
.booking-modal__submit:hover:not(:disabled) {
  box-shadow: 0 6px 18px rgba(249, 141, 160, 0.4);
}
.booking-modal__submit:disabled {
  background: var(--border-light);
  color: var(--text-3);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}
.booking-modal__submit.is-loading {
  pointer-events: none;
  opacity: 0.75;
}

/* ═══ Выбор даты и времени ═══ */
.booking-modal__picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.booking-modal__picker-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.booking-modal__picker-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-2);
}
.booking-modal__month-label {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}

.booking-modal__dates {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  margin: -6px -24px 0;
  padding: 6px 24px 16px;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 24px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scrollbar-color: var(--border-warm) transparent;
}

.booking-modal__dates::-webkit-scrollbar-thumb {
  display: none;
}

.booking-modal__date-card {
  flex: 0 0 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 11px 6px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--text);
  scroll-snap-align: start;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s,
    transform 0.12s;
}
.booking-modal__date-card:hover:not(.is-disabled):not(.is-selected) {
  border-color: var(--peach);
  background: var(--peach-soft);
  transform: translateY(-1px);
}
.booking-modal__date-card.is-selected {
  background: var(--peach);
  border-color: var(--peach-deep);
  box-shadow: 0 4px 14px rgba(249, 141, 160, 0.35);
}
.booking-modal__date-card.is-selected .booking-modal__date-weekday {
  color: var(--text);
  opacity: 0.7;
}
.booking-modal__date-card.is-disabled {
  background: transparent;
  border-style: dashed;
  border-color: var(--border-hair);
  color: var(--text-3);
  opacity: 0.55;
  cursor: not-allowed;
}
.booking-modal__date-num {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
}
.booking-modal__date-weekday {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.booking-modal__times {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
  animation: bm-fade 0.2s ease both;
}
.booking-modal__time-btn {
  min-width: 74px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s,
    transform 0.12s;
}
.booking-modal__time-btn:hover:not(:disabled):not(.is-selected) {
  border-color: var(--peach);
  background: var(--peach-soft);
  transform: translateY(-1px);
}
.booking-modal__time-btn.is-selected {
  background: var(--peach);
  border-color: var(--peach-deep);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(249, 141, 160, 0.35);
}
.booking-modal__time-btn:disabled {
  background: transparent;
  border-color: var(--border-hair);
  color: var(--text-3);
  opacity: 0.5;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ─── Загрузка / пустое состояние ─── */
.booking-modal__loading {
  flex: 1 1 auto;
  padding: 22px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  animation: bm-pulse 1.4s ease-in-out infinite;
}
.booking-modal__empty {
  padding: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
  background: var(--yellow-soft);
  border: 1px dashed var(--border-light);
  border-radius: var(--r-sm);
}

/* ═══ Успешная запись ═══ */
.booking-modal__success {
  padding: 12px 0 8px;
  text-align: center;
  animation: bm-fade 0.25s ease both;
}
.booking-modal__success p {
  margin: 8px 0;
  font-size: 15px;
  color: var(--text-2);
}
.booking-modal__check {
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  background: var(--green-bg);
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  color: var(--green);
  animation: bm-check 0.4s cubic-bezier(0.22, 1.4, 0.4, 1) both;
}
.booking-modal__success-slot {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--text) !important;
}
.booking-modal__success-note {
  font-size: 13px;
  color: var(--text-3) !important;
}
.booking-modal__success .btn {
  margin-top: 18px;
  min-width: 180px;
}

/* ═══ Мобильный bottom-sheet ═══ */
@media (max-width: 620px) {
  .booking-modal {
    padding: 0;
    align-items: flex-end;
  }
  .booking-modal__panel {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: none;
    animation: bm-sheet 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  /* «Ручка» листа */
  .booking-modal__panel::after {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border-warm);
    border-radius: var(--r-pill);
    z-index: 3;
  }
  .booking-modal__close {
    top: 18px;
  }
  .booking-modal__body {
    padding: 30px 18px calc(20px + env(safe-area-inset-bottom));
  }
  .booking-modal__dates {
    margin: -6px -18px 0;
    padding: 6px 18px 16px;
    scroll-padding-left: 18px;
  }
  .booking-modal__title {
    font-size: 22px;
  }
}

/* ═══ Анимации ═══ */
@keyframes bm-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes bm-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes bm-sheet {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}
@keyframes bm-check {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes bm-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .booking-modal__backdrop,
  .booking-modal__panel,
  .booking-modal__times,
  .booking-modal__success,
  .booking-modal__check,
  .booking-modal__loading {
    animation: none;
  }
  .booking-modal__date-card,
  .booking-modal__time-btn,
  .booking-modal__submit {
    transition: none;
  }
}
