/* Карточка онлайн-записи (booking.js). Всё внутри .booking-card; положение карточки на странице — в site.css.
   Цвета и шрифты — токены из base.css. */

.booking-card {
  --bk-line: var(--gray-line);
  --bk-soft: var(--pink-soft);
  --bk-muted: #A49CA1;
  --bk-error-bg: #FDECEF;
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 28px;
  border: 4px solid var(--black); /* жирная чёрная рамка */
  border-radius: 24px;
  background: var(--white);
  box-shadow: 0 24px 60px rgba(29, 29, 29, 0.12), 0 2px 6px rgba(29, 29, 29, 0.04);
  color: var(--black);
  font-size: 15px;
}

.booking-card button { cursor: pointer; }
.booking-card button:disabled { cursor: not-allowed; }

/* ---------- Заголовок и шаги ---------- */
.booking-head { text-align: center; }
.booking-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.booking-sub {
  margin: 0 auto 18px;
  max-width: 30ch;
  color: var(--gray);
  font-size: 14px;
  line-height: 1.45;
}

.booking-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}
.booking-steps__item { min-width: 0; }
.booking-steps__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 2px 6px;
  border: 0;
  border-bottom: 2px solid var(--bk-line);
  background: none;
  color: var(--bk-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}
button.booking-steps__btn { color: var(--black); }
button.booking-steps__btn:hover .booking-steps__label { text-decoration: underline; text-underline-offset: 3px; }
.booking-steps__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bk-soft);
  font-size: 12px;
  font-weight: 700;
}
.booking-steps__label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.is-done .booking-steps__btn { border-bottom-color: var(--pink-deep); }
.is-done .booking-steps__num { background: var(--pink); color: var(--black); }
.is-current .booking-steps__btn { border-bottom-color: var(--black); color: var(--black); }
.is-current .booking-steps__num { background: var(--black); color: var(--white); }

/* ---------- Шаг ---------- */
.booking-step__title {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}
.booking-step__title:focus { outline: none; }
.booking-step__title:focus-visible { outline: 3px solid var(--black); outline-offset: 2px; }
.booking-step__sub {
  margin: 0 0 14px;
  color: var(--gray);
  font-size: 14px;
}
.booking-loading {
  margin: 12px 0 0;
  color: var(--gray);
  font-size: 14px;
}
.booking-loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid var(--pink);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: booking-spin 0.8s linear infinite;
}
@keyframes booking-spin { to { transform: rotate(360deg); } }
.booking-hint { margin: 10px 0 0; font-size: 14px; }

/* ---------- Сообщения ---------- */
.booking-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.45;
}
.booking-notice:focus { outline: none; }
.booking-notice p { flex: 1 1 200px; margin: 0; }
.booking-notice--error { background: var(--bk-error-bg); color: var(--error); }
.booking-notice--info { background: var(--bk-soft); color: var(--black); }
.booking-notice__retry {
  min-height: 40px;
  padding: 8px 18px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  background: var(--white);
  color: var(--black);
  font-weight: 700;
  font-size: 14px;
}
.booking-notice__retry:hover { background: var(--black); border-color: var(--black); color: var(--white); }

/* ---------- Пустые состояния ---------- */
.booking-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 22px 16px;
  border-radius: var(--radius-sm);
  background: var(--bk-soft);
  text-align: center;
}
.booking-empty__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}
.booking-empty__text { margin: 0; font-size: 14px; }
.booking-empty .booking-social { justify-content: center; margin-top: 4px; }
.booking-empty__btn { margin-top: 4px; }

/* ---------- Услуги ---------- */
.booking-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 12px;
  padding: 4px;
  border-radius: 999px;
  background: var(--bk-soft);
}
.booking-tabs__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 40px;
  padding: 6px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--black);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
}
.booking-tabs__tab:hover { background: rgba(220, 198, 179, 0.55); }
.booking-tabs__tab[aria-selected="true"] {
  background: var(--pink);
  box-shadow: 0 1px 3px rgba(29, 29, 29, 0.1);
}
.booking-tabs__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.booking-services {
  display: grid;
  gap: 8px;
  margin: 0 -4px;
  padding: 2px 4px;
}
.booking-services__empty { margin: 8px 0; font-size: 14px; text-align: center; }

.booking-svc {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1.5px solid var(--bk-line);
  border-radius: 14px;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.booking-svc:hover { border-color: var(--pink-deep); }
.booking-svc.is-checked { border-color: var(--black); background: var(--bk-soft); }
.booking-svc__main { display: grid; min-width: 0; }
.booking-svc__name { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.booking-svc__desc { color: var(--gray); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.booking-svc__meta { display: grid; justify-items: end; text-align: right; white-space: nowrap; }
.booking-svc__price { font-weight: 700; }
.booking-svc__price .placeholder { font-weight: 600; }
.booking-svc__time { color: var(--gray); font-size: 13px; }

/* Галочка: настоящий checkbox, нарисованный заново */
.booking-check {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: inline-grid;
  place-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--black);
  border-radius: 7px;
  background: var(--white);
  cursor: pointer;
}
.booking-check::after {
  content: '';
  width: 11px;
  height: 6px;
  margin-top: -3px;
  border-left: 2.5px solid var(--white);
  border-bottom: 2.5px solid var(--white);
  transform: rotate(-45deg) scale(0);
  transition: transform 0.12s;
}
.booking-check:checked { background: var(--black); }
.booking-check:checked::after { transform: rotate(-45deg) scale(1); }
.booking-check[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 3px var(--bk-error-bg); }

/* ---------- Календарь ---------- */
.booking-cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.booking-cal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}
.booking-cal__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border: 1.5px solid var(--bk-line);
  border-radius: 50%;
  background: var(--white);
  color: var(--black);
  font-size: 22px;
  line-height: 1;
}
.booking-cal__nav:hover:not(:disabled) { border-color: var(--black); }
.booking-cal__nav:disabled { opacity: 0.35; }

.booking-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  row-gap: 2px;
  transition: opacity 0.15s;
}
.booking-cal__grid.is-loading { opacity: 0.55; }
.booking-cal__wd {
  padding: 6px 0;
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}
.booking-cal__wd.is-weekend { color: var(--bk-muted); }
.booking-cal__day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: #C7BFC4;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  isolation: isolate;
}
.booking-cal__day::before {
  content: '';
  position: absolute;
  inset: 2px;
  margin: auto;
  width: 40px;
  max-width: 100%;
  height: 40px;
  border-radius: 50%;
  z-index: -1;
}
.booking-cal__day.is-available { color: var(--black); }
.booking-cal__day.is-available::before { background: var(--pink); }
.booking-cal__day.is-available:hover::before { box-shadow: inset 0 0 0 2px var(--black); }
.booking-cal__day.is-selected { color: var(--white); }
.booking-cal__day.is-selected::before { background: var(--black); }
.booking-cal__day:focus-visible { outline: none; }
.booking-cal__day:focus-visible::before { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--black); }

/* ---------- Время ---------- */
.booking-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}
.booking-slot {
  min-height: var(--tap);
  padding: 8px 4px;
  border: 1.5px solid var(--bk-line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, background 0.15s;
}
.booking-slot:hover { border-color: var(--black); background: var(--bk-soft); }
.booking-slot.is-selected { border-color: var(--black); background: var(--black); color: var(--white); }

/* ---------- Контакты ---------- */
.booking-recap {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bk-soft);
  font-size: 14px;
  line-height: 1.45;
}
.booking-recap p { margin: 0; }
.booking-recap__what { overflow-wrap: anywhere; }
.booking-recap__total { color: var(--gray); }

.booking-form { display: grid; gap: 14px; }
.booking-field { display: grid; gap: 6px; min-width: 0; }
.booking-field__label { font-size: 14px; font-weight: 600; }
.booking-field__hint { color: var(--gray); font-weight: 400; }
.booking-input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1.5px solid var(--bk-line);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 16px; /* 16px — iOS не увеличивает страницу при фокусе */
  line-height: 1.4;
  transition: border-color 0.15s;
}
.booking-input::placeholder { color: var(--bk-muted); }
.booking-input:hover { border-color: #CFC6CB; }
.booking-input:focus { border-color: var(--black); outline: none; box-shadow: 0 0 0 3px var(--bk-soft); }
.booking-input--area { min-height: 64px; resize: vertical; }
.booking-field.has-error .booking-input { border-color: var(--error); }
.booking-field__error {
  margin: 0;
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.booking-consent { display: grid; gap: 6px; }
.booking-consent__label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-height: var(--tap);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}
.booking-consent__label .booking-check { margin-top: 0; }
.booking-consent__label a { font-weight: 600; }

/* Ловушка для ботов: людям не видна и не доступна с клавиатуры */
.booking-trap {
  position: absolute !important;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Низ карточки ---------- */
.booking-foot {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--bk-line);
}
.booking-total {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}
.booking-total.is-empty { color: var(--gray); font-weight: 500; }
.booking-total-wrap { display: grid; gap: 4px; }
/* комплекс: выгода или подсказка, какой услуги не хватает */
.booking-combo {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  color: #7A5A45; /* тёплый коричневый в тон нюдовой палитре, читается на белом */
  font-weight: 600;
}
.booking-combo.is-applied { color: var(--black); }
.booking-recap__combo { margin: 2px 0 0; font-size: 13px; font-weight: 600; }
.booking-done__combo { display: block; font-size: 13px; font-weight: 500; color: var(--gray); }
.booking-actions { display: flex; gap: 10px; }
.booking-actions:empty { display: none; }
.booking-actions .btn { min-height: 52px; }
.booking-next { flex: 1 1 auto; }
.booking-back { flex: 0 0 auto; padding-inline: 20px; }

/* ---------- «Вы записаны!» ---------- */
.booking-done { display: grid; justify-items: center; text-align: center; }
.booking-done__mark {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 4px 0 14px;
  border-radius: 50%;
  background: var(--pink);
}
.booking-done__mark::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 46%;
  width: 24px;
  height: 12px;
  border-left: 3.5px solid var(--black);
  border-bottom: 3.5px solid var(--black);
  transform: translate(-50%, -50%) rotate(-45deg);
}
.booking-done__title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.booking-done__lead { margin: 0 0 16px; color: var(--gray); font-size: 14px; }
.booking-done__list {
  display: grid;
  gap: 0;
  width: 100%;
  margin: 0 0 20px;
  padding: 4px 16px;
  border-radius: var(--radius-sm);
  background: var(--bk-soft);
  text-align: left;
}
.booking-done__list > div {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(29, 29, 29, 0.08);
}
.booking-done__list > div:last-child { border-bottom: 0; }
.booking-done__list dt { color: var(--gray); font-size: 13px; padding-top: 1px; }
.booking-done__list dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.booking-done__svc { display: block; }
.booking-again { width: 100%; min-height: 52px; }

/* ---------- Размеры ---------- */
@media (min-width: 768px) {
  /* На первом экране карточка не должна расти бесконечно — длинный прайс прокручивается внутри */
  .booking-services {
    max-height: 292px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
}

@media (max-width: 480px) {
  .booking-card { padding: 22px 18px; border-radius: 20px; }
  .booking-title { font-size: 20px; }
  .booking-sub { margin-bottom: 14px; }
  /* Календарь чуть шире внутренних полей — ячейки дней не уже 44 px на 360 px */
  .booking-cal { margin-inline: -8px; }
  .booking-svc { padding: 10px 12px; gap: 10px; }
  .booking-slots { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
}

@media (max-width: 374px) {
  .booking-card { padding: 20px 14px; }
  .booking-tabs__tab { font-size: 13px; padding: 6px 4px; }
  .booking-steps__btn { font-size: 11px; }
}
