/* ============================================================
   Online booking widget — shared across all pages
   Two blocks: (1) .book-online scheduling widget (#sched),
               (2) .book-cta purple "Запишитесь на приём" block.
   Requires styles.css tokens + the .booking-wrap base in styles.css.
   ============================================================ */

/* ---------- ЗАПИСЬ НА ПРИЁМ ОНЛАЙН — scheduling widget ---------- */
.book-online { padding: var(--section-pad-tight) 0 0; }
.book-online .section-title {
  text-align: center;
  margin-bottom: var(--title-gap);
}

.sched {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.renovatio-widget-fallback {
  padding: 28px;
  background: var(--bg-soft);
}
.renovatio-widget-fallback__inner {
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: #fff;
  padding: 28px;
  text-align: center;
}
.renovatio-widget-fallback__inner p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}
.renovatio-widget-fallback__actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Stepper ---------- */
.sched-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.sched-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 0;
  min-width: 0;
  color: var(--text-light);
  font-weight: 600;
  font-size: 14px;
}
.sched-step:not(:last-child)::after {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s ease;
}
.sched-step-dot {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #fff;
  border: 1.5px solid var(--border);
  font-size: 14px; font-weight: 700;
  color: var(--text-light);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.sched-step-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-step.is-active { color: var(--violet-deep); }
.sched-step.is-active .sched-step-dot {
  background: var(--violet); border-color: var(--violet); color: #fff;
  box-shadow: 0 6px 16px rgba(96, 84, 177, 0.28);
}
.sched-step.is-done { color: var(--text-muted); }
.sched-step.is-done .sched-step-dot { background: var(--green); border-color: var(--green); color: #fff; font-size: 0; position: relative; }
.sched-step.is-done .sched-step-dot::before {
  content: ""; position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 5px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: translate(-50%, -65%) rotate(-45deg);
}
.sched-step.is-done::after { background: var(--green); }

/* ---------- Stage ---------- */
.sched-stage { min-height: 340px; }

/* ---------- Step 1 — three-column picker (спец · врач · услуга) ---------- */
.sched-pick { padding: 18px 28px 20px; }
.sched-pick-title {
  font-size: 18px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--text); text-align: center; text-wrap: balance;
  max-width: 620px; margin: 0 auto 14px;
}
.sched-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.sched-col {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sched-col-search { padding: 8px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.sched-col-input {
  width: 100%; height: 38px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: #fff; font: inherit; font-size: 14px; color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.sched-col-input::placeholder { color: var(--text-light); }
.sched-col-input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.sched-col-list {
  height: 264px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
}
.sched-col-list::-webkit-scrollbar { width: 8px; }
.sched-col-list::-webkit-scrollbar-thumb { background: #D9D9E2; border-radius: 8px; border: 2px solid #fff; }
.sched-col-empty { padding: 26px 12px; text-align: center; color: var(--text-light); font-size: 13.5px; }

.sched-opt {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  border: 1.5px solid transparent; border-radius: var(--r-sm);
  background: transparent; padding: 8px 12px; cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.sched-opt:hover { background: var(--violet-soft); }
.sched-opt.is-active { background: var(--violet-soft); border-color: var(--violet); }
.sched-opt-main { display: block; font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; overflow-wrap: anywhere; }
.sched-opt-sub { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }
.sched-opt-meta { min-width: 0; flex: 1 1 auto; }
.sched-opt--doc { min-height: 58px; }
.sched-opt-ph {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  overflow: hidden; background: var(--bg-soft);
  display: grid; place-items: center;
}
.sched-opt-ph img { width: 100%; height: 100%; object-fit: cover; }
.sched-opt--srv { flex-direction: column; align-items: flex-start; gap: 4px; }
.sched-opt-price {
  flex: 0 0 auto; align-self: flex-start;
  font-size: 13.5px; font-weight: 700; color: var(--violet-deep);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sched-opt.is-active .sched-opt-price { color: var(--violet); }

.sched-pick-reset {
  display: block; margin: 12px auto 0;
  border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; padding: 4px 10px;
}
.sched-pick-reset:hover { color: var(--violet); text-decoration: underline; }

.sched-recap-row--total { border-top: 1px solid rgba(96, 84, 177, 0.28); margin-top: 4px; padding-top: 12px; }
.sched-recap-row--total strong { color: var(--violet-deep); font-size: 16px; }

/* Body: calendar + slots */
.sched-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
}

/* Calendar */
.sched-cal {
  padding: 26px 28px;
  border-right: 1px solid var(--border);
}
.sched-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.sched-cal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
  letter-spacing: -0.01em;
}
.sched-cal-nav {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--violet);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.sched-cal-nav:hover { background: var(--violet-soft); transform: scale(1.06); }
.sched-cal-nav:disabled { opacity: 0.35; cursor: default; transform: none; background: #fff; }

.sched-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.sched-wd {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  padding-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sched-day {
  aspect-ratio: 1;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.sched-day:hover:not(.is-empty):not(:disabled) { background: var(--violet-soft); color: var(--violet); }
.sched-day.is-empty { cursor: default; }
.sched-day:disabled {
  color: var(--text-light);
  cursor: default;
  opacity: 0.5;
}
.sched-day.has-slots::after {
  content: "";
  position: absolute;
  bottom: 6px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--green);
}
.sched-day.is-selected {
  background: var(--violet);
  color: #fff;
  box-shadow: 0 6px 16px rgba(96, 84, 177, 0.30);
}
.sched-day.is-selected.has-slots::after { background: #fff; }
.sched-day.is-today:not(.is-selected) { box-shadow: inset 0 0 0 1.5px var(--violet-soft); }

/* Slots panel */
.sched-slots {
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}
.sched-doctor-picker { position: relative; margin-bottom: 16px; z-index: 3; }
.sched-doctor-label {
  display: block; margin: 0 0 7px; font-size: 13px;
  font-weight: 600; color: var(--text-muted);
}
.sched-doctor-current {
  width: fit-content; max-width: 100%; display: inline-flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: #fff; color: var(--text); overflow: hidden;
  box-shadow: 0 5px 16px rgba(35, 31, 57, 0.07);
}
.sched-doctor-info {
  min-width: 0; display: flex; align-items: center; gap: 11px;
  padding: 7px 14px 7px 7px; background: var(--violet-soft);
}
.sched-doctor-info strong { font-size: 14px; line-height: 1.35; white-space: nowrap; }
.sched-doctor-toggle {
  display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto;
  padding: 0 13px; border: 0; border-left: 1px solid rgba(96, 84, 177, 0.16);
  background: #fff; color: var(--violet-deep);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.sched-doctor-toggle:hover,
.sched-doctor-toggle[aria-expanded="true"] { background: var(--bg-soft); color: var(--violet); }
.sched-slots-ph {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%;
  overflow: hidden; background: var(--bg-soft);
  display: grid; place-items: center;
}
.sched-slots-ph img { width: 100%; height: 100%; object-fit: cover; }
.sched-slots-docmeta { display: flex; flex-direction: column; min-width: 0; }
.sched-slots-docmeta strong { font-size: 14px; line-height: 1.35; }
.sched-slots-head {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.sched-slots-head strong { color: var(--text); font-weight: 600; }
.sched-doctor-chevron { width: 20px; height: 20px; flex: 0 0 auto; color: currentColor; transition: transform 0.18s ease; }
.sched-doctor-toggle[aria-expanded="true"] .sched-doctor-chevron { transform: rotate(180deg); }
.sched-doctor-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  width: min(100%, 430px); max-height: 260px; overflow-y: auto;
  padding: 7px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: #fff; box-shadow: var(--shadow-soft);
}
.sched-doctor-option {
  width: 100%; display: grid; grid-template-columns: 38px 1fr 18px;
  align-items: center; gap: 10px; padding: 8px;
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  text-align: left; cursor: pointer;
}
.sched-doctor-option:hover { background: var(--bg-soft); }
.sched-doctor-option.is-active { background: var(--violet-soft); color: var(--violet-deep); }
.sched-doctor-option-photo { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: var(--bg-soft); }
.sched-doctor-option-photo img { width: 100%; height: 100%; object-fit: cover; }
.sched-doctor-option svg { width: 16px; height: 16px; color: var(--violet); }
.sched-slots-date {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  text-transform: capitalize;
}
.sched-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  align-content: start;
}
.sched-slot {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--r-md);
  padding: 12px 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.sched-slot:hover {
  border-color: var(--violet);
  color: var(--violet);
  transform: translateY(-2px);
}
.sched-slot.is-taken {
  background: var(--bg-soft);
  color: var(--text-light);
  text-decoration: line-through;
  cursor: default;
  border-color: transparent;
  transform: none;
}
.sched-slot.is-selected {
  background: var(--violet);
  border-color: var(--violet);
  color: #fff;
  box-shadow: 0 8px 20px rgba(96, 84, 177, 0.28);
}
.sched-slots-empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  flex: 1;
  padding: 30px 10px;
  line-height: 1.5;
}

/* Footer bar */
.sched-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  flex-wrap: wrap;
}
.sched-summary { font-size: 15px; color: var(--text-muted); flex: 1 1 auto; text-align: center; }
.sched-summary strong { color: var(--violet-deep); font-weight: 700; }
.sched-foot .btn { height: 50px; }
.sched-foot .btn:disabled { opacity: 0.5; cursor: default; }
.sched-next { flex: 0 0 auto; }
.sched-back {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 4px;
  height: 50px; padding: 0 18px 0 12px;
  border: 1.5px solid var(--border); background: #fff;
  border-radius: var(--r-md);
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.sched-back:hover { border-color: var(--violet); color: var(--violet); }

/* ---------- Calendar legend ---------- */
.sched-legend {
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px; font-size: 12.5px; color: var(--text-light);
}
.sched-legend-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

/* ---------- Step 3 — patient form ---------- */
.sched-form {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  align-items: stretch;
}
.sched-form-fields { padding: 24px 26px; }
.sched-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 16px;
  margin-bottom: 18px;
}
.sched-field { min-width: 0; display: block; }
.sched-field--full { grid-column: 1 / -1; }
.sched-textarea { height: auto; min-height: 0; padding: 14px 16px; resize: vertical; line-height: 1.4; font-family: inherit; }
.sched-textarea::placeholder { line-height: 1.4; }
.sched-field-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-muted); margin: 0 0 7px; letter-spacing: 0.01em;
}
.sched-field-label em { font-style: normal; color: var(--text-light); font-weight: 500; }
.sched-req { font-style: normal; color: var(--coral); margin-left: 2px; font-weight: 700; }
.sched-form-note { margin: 14px 0 0; font-size: 12.5px; color: var(--text-light); }
.sched-form-note .sched-req { margin: 0 2px 0 0; }
.sched-input {
  width: 100%; height: 52px; padding: 0 16px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  background: var(--bg-soft); font: inherit; font-size: 15px; color: var(--text);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.sched-input::placeholder { color: var(--text-light); }
.sched-input:focus { outline: none; background: #fff; border-color: var(--violet); box-shadow: 0 0 0 4px var(--violet-soft); }
.sched-input.is-invalid { border-color: var(--coral); box-shadow: 0 0 0 4px var(--coral-soft); }

.sched-consent {
  display: flex; align-items: flex-start; gap: 11px;
  margin-top: 4px; cursor: pointer; user-select: none;
  font-size: 13.5px; color: var(--text-muted); line-height: 1.45;
}
.sched-consent input { position: absolute; opacity: 0; width: 0; height: 0; }
.sched-consent-box {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px;
  border: 1.5px solid var(--text-light); background: #fff;
  display: grid; place-items: center; margin-top: 1px;
  color: #fff; transition: background 0.16s ease, border-color 0.16s ease;
}
.sched-consent-box svg { width: 12px; height: 12px; opacity: 0; transform: scale(0.6); transition: opacity 0.16s ease, transform 0.16s ease; }
.sched-consent input:checked + .sched-consent-box { background: var(--violet); border-color: var(--violet); }
.sched-consent input:checked + .sched-consent-box svg { opacity: 1; transform: none; }
.sched-consent input:focus-visible + .sched-consent-box { box-shadow: 0 0 0 4px var(--violet-soft); }
.sched-consent-text { min-width: 0; }
.sched-consent a { color: var(--violet); font-weight: 600; }
.sched-consent a:hover { text-decoration: underline; }

/* Recap sidebar */
.sched-recap {
  background: var(--violet-soft);
  border-left: 1px solid var(--border);
  padding: 26px 26px;
}
.sched-recap-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--violet-deep); margin-bottom: 16px; }
.sched-recap-row {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 0; border-top: 1px solid rgba(96, 84, 177, 0.14);
}
.sched-recap-row:first-of-type { border-top: 0; padding-top: 0; }
.sched-recap-row span { font-size: 12.5px; color: var(--text-muted); }
.sched-recap-row strong { font-size: 14.5px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }

/* ---------- Done state ---------- */
.sched-done {
  padding: 48px 28px 40px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.sched-done-ring {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--green-pill); color: var(--green);
  display: grid; place-items: center; margin-bottom: 20px;
  animation: schedPop 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.sched-done-ring svg { width: 40px; height: 40px; }
@keyframes schedPop { 0% { transform: scale(0.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.sched-done-title { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; margin: 0 0 8px; }
.sched-done-sub { font-size: 15px; color: var(--text-muted); max-width: 460px; line-height: 1.55; margin: 0 0 24px; }
.sched-done-card {
  width: 100%; max-width: 420px; text-align: left;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 8px 20px 12px; margin-bottom: 24px;
}
.sched-again {
  border: 0; background: none; font: inherit; font-size: 15px; font-weight: 700;
  color: var(--violet); cursor: pointer; padding: 6px;
}
.sched-again:hover { color: var(--violet-hover); text-decoration: underline; }

/* ---------- CTA purple block (single-column booking-wrap) ---------- */
.book-cta { padding: var(--block-gap) 0 0; }
.book-cta--end { padding-bottom: var(--section-pad); }
.booking-wrap--solo { grid-template-columns: 1fr; }
.booking-wrap--solo .booking-left p { max-width: 720px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .sched-body { grid-template-columns: 1fr; }
  .sched-cal { border-right: 0; border-bottom: 1px solid var(--border); }
  .booking-wrap--solo .booking-left { padding: 40px; }
  .sched-form { grid-template-columns: 1fr; }
  .sched-recap { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 720px) {
  .booking-wrap--solo .booking-left { padding: 28px 24px; }
  .sched-cal, .sched-slots { padding: 16px 14px; }
  .sched-foot { gap: 12px; }
  .sched-summary { flex: 1 1 auto; }
  .sched-next { flex: 0 0 auto; }
  .sched-form-fields { padding: 18px 16px; }
  .sched-grid { grid-template-columns: 1fr; gap: 16px; }
  .sched-recap { padding: 20px 18px; }
  .sched-steps { padding: 16px 14px; gap: 4px; }
  .sched-step-label { display: none; }
  .sched-step { flex: 0 0 auto; }
  .sched-step:not(:last-child)::after { min-width: 24px; }
  .sched-pick { padding: 18px 14px; }
  .sched-pick-title { font-size: 18px; }
  .sched-cols { grid-template-columns: 1fr; }
  .sched-col-list { height: 200px; }
  /* Аудит-фикс: удобные тач-зоны в календаре записи (ТЗ — минимум 44px) */
  .sched-cal-nav { width: 44px; height: 44px; }
  .sched-cal-grid { gap: 3px; }
  .sched-day { font-size: 15px; }
  .sched-slots-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
  .sched-slot { padding: 14px 6px; min-height: 46px; }
}
@media (max-width: 540px) {
  .sched-doctor-current { width: 100%; flex-direction: column; }
  .sched-doctor-info { width: 100%; }
  .sched-doctor-info strong { white-space: normal; }
  .sched-doctor-toggle {
    width: 100%; justify-content: center; min-height: 44px;
    border-left: 0; border-top: 1px solid rgba(96, 84, 177, 0.16);
  }
  .sched-foot {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px 12px;
  }
  .sched-back { order: 1; }
  .sched-next { order: 2; }
  .sched-summary { order: 3; flex: 1 1 100%; text-align: center; }
}
