/* Публичный виджет онлайн-записи «плитка».
   Единый вид для встраиваемой страницы /embed/booking и страницы сайта /booking.
   Стили не зависят от CRM: только этот файл и разметка booking_tiles_widget(). */

:root {
  --wgt-accent: #2f6bff;
  --wgt-accent-ink: #1d4ed8;
  --wgt-ink: #1f2430;
  --wgt-soft: #8b90a0;
  --wgt-line: #e9eaf2;
  --wgt-bg: #f7f6fb;
  --wgt-card: #ffffff;
  --wgt-radius: 20px;
  color-scheme: light;
}

.embed-page {
  margin: 0;
  min-height: 100vh;
  background: var(--wgt-bg);
  color: var(--wgt-ink);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.embed-main {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 20px 16px 28px;
}

/* ── карточка ─────────────────────────────────────────────── */
.eaisto-booking-widget {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  color: var(--wgt-ink);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.eaisto-booking-widget *,
.eaisto-booking-widget *::before,
.eaisto-booking-widget *::after { box-sizing: border-box; }

.eaisto-booking-widget [hidden] { display: none !important; }

.eaisto-booking-widget button { font: inherit; }

.wgt-card,
.wgt-contacts,
.wgt-success {
  position: relative;
  background: var(--wgt-card);
  border: 1px solid #ececf6;
  border-radius: var(--wgt-radius);
  box-shadow: 0 24px 48px -36px rgba(31, 36, 56, .45), 0 1px 2px rgba(31, 36, 56, .04);
}

.wgt-card { padding: 22px 22px 18px; }
.wgt-contacts,
.wgt-success { padding: 22px; }

.wgt-alert {
  margin: 0;
  padding: 18px 20px;
  border-radius: 16px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #8a4b06;
  font-size: 14px;
}

/* ── шапка: месяц и календарь ─────────────────────────────── */
.wgt-head {
  position: relative;
  text-align: center;
  padding: 2px 0 4px;
}

.wgt-month {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--wgt-ink);
}

.wgt-date-link {
  margin-top: 6px;
  padding: 2px 2px 3px;
  border: 0;
  border-bottom: 1px dashed #c9cbd8;
  background: transparent;
  color: var(--wgt-soft);
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
}

.wgt-date-link:hover,
.wgt-date-link:focus-visible { color: var(--wgt-accent-ink); border-bottom-color: var(--wgt-accent); }

.wgt-picker {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 268px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--wgt-line);
  border-radius: 16px;
  box-shadow: 0 22px 44px -20px rgba(17, 24, 39, .38);
}

.wgt-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.wgt-picker-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--wgt-ink);
}

.wgt-picker-arrow {
  width: 28px;
  height: 28px;
  border: 1px solid var(--wgt-line);
  border-radius: 999px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
}

.wgt-picker-arrow:hover:not(:disabled) { border-color: #c7d2fe; color: var(--wgt-accent-ink); }
.wgt-picker-arrow:disabled { opacity: .35; cursor: default; }

.wgt-picker-weekdays,
.wgt-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.wgt-picker-weekdays span {
  padding: 2px 0 4px;
  font-size: 10px;
  text-align: center;
  color: #b3b7c4;
}

.wgt-picker-day {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #4b5563;
  font-size: 12.5px;
  cursor: pointer;
}

.wgt-picker-day:hover:not(:disabled) { background: #f2f5ff; color: var(--wgt-accent-ink); }
.wgt-picker-day.is-selected { background: var(--wgt-accent); border-color: var(--wgt-accent); color: #fff; font-weight: 650; }
.wgt-picker-day:disabled { color: #c9ccd6; cursor: default; }
.wgt-picker-day.is-today:not(.is-selected) { border-color: #c7d2fe; color: var(--wgt-accent-ink); }
.wgt-picker-day.is-empty { visibility: hidden; }

/* ── полоса пяти дней ─────────────────────────────────────── */
.wgt-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 2px;
}

.wgt-arrow {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid #d3d8e6;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  box-shadow: 0 1px 2px rgba(31, 36, 56, .06);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}

.wgt-arrow:hover:not(:disabled) { border-color: #c7d2fe; color: var(--wgt-accent-ink); }
.wgt-arrow:disabled { opacity: .35; cursor: default; }

.wgt-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.wgt-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px 9px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.wgt-day:hover:not(:disabled) { background: #f6f7fd; }
.wgt-day:disabled { cursor: default; opacity: .5; }

.wgt-day[aria-pressed="true"] {
  border-color: var(--wgt-accent);
  background: #fff;
  box-shadow: 0 10px 20px -14px rgba(47, 107, 255, .65);
}

.wgt-day-wd {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #a2a7b6;
}

.wgt-day[aria-pressed="true"] .wgt-day-wd { color: var(--wgt-accent-ink); }

.wgt-day-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--wgt-ink);
}

.wgt-day[aria-pressed="true"] .wgt-day-num { color: var(--wgt-accent-ink); }

.wgt-day-dot {
  width: 4px;
  height: 4px;
  margin-top: 2px;
  border-radius: 999px;
  background: var(--wgt-accent);
}

.wgt-rule {
  height: 1px;
  margin: 14px 0 12px;
  background: #eef0f6;
}

/* ── строка поста и переключатель ─────────────────────────── */
.wgt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.wgt-post { min-width: 0; color: var(--wgt-soft); font-size: 13px; }

.wgt-post-label { display: inline-block; padding: 2px 0; }

.wgt-post-select { display: inline-flex; align-items: center; gap: 6px; }
.wgt-post-select > span { color: var(--wgt-soft); font-size: 12px; }

.wgt-post-select select,
.wgt-tool select,
.wgt-post select {
  max-width: 180px;
  padding: 5px 26px 5px 10px;
  border: 1px solid var(--wgt-line);
  border-radius: 9px;
  background: #fff;
  color: var(--wgt-ink);
  font-size: 13px;
}

.wgt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #6b7280;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.wgt-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--wgt-accent);
  cursor: pointer;
}

/* ── сетка плиток ─────────────────────────────────────────── */
.wgt-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.wgt-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 44px;
  padding: 0 4px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .01em;
  user-select: none;
}

/* P1.6 аудита: внимание — на свободное время. Свободная плитка с акцентной рамкой,
   занятая и закрытая — бледные и зачёркнутые (раньше занятые были залиты акцентом). */
.wgt-tile-free {
  border: 1.5px solid var(--wgt-accent);
  background: #fff;
  color: var(--wgt-accent-ink);
  cursor: pointer;
  transition: border-color .14s ease, box-shadow .14s ease;
}

.wgt-tile-free:hover {
  border-color: var(--wgt-accent);
  box-shadow: 0 6px 14px -10px rgba(47, 107, 255, .7);
}

.wgt-tile-free:focus-visible {
  outline: 2px solid var(--wgt-accent);
  outline-offset: 2px;
}

.wgt-tile-free.is-selected {
  border-color: var(--wgt-accent);
  background: #edf3ff;
  color: var(--wgt-accent-ink);
}

.wgt-tile-busy,
.wgt-tile-closed {
  border: 1px dashed #d7dbe5;
  background: #f4f5f8;
  color: #a2a8b5;
  text-decoration: line-through;
}

.wgt-tile-past {
  border: 1px solid #eef0f4;
  background: #f4f5f8;
  color: #9aa1af;
}

.wgt-tile-hidden { visibility: hidden; }

.wgt-status {
  min-height: 17px;
  margin: 10px 0 0;
  color: var(--wgt-soft);
  font-size: 12.5px;
}

/* ── легенда и счётчики ───────────────────────────────────── */
.wgt-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 12px;
  color: #7b8093;
  font-size: 11.5px;
}

.wgt-legend-item { display: inline-flex; align-items: center; gap: 6px; }

.wgt-legend-mark {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.wgt-legend-busy { background: #f4f5f8; border: 1px dashed #c9ceda; }
.wgt-legend-free { background: #fff; border: 1.5px solid var(--wgt-accent); }
.wgt-legend-closed { background: #f4f5f8; border: 1px dashed #c9ceda; }
.wgt-legend-past { background: #eceef3; border-color: #e6e8ef; }

.wgt-summary {
  margin: 10px 0 0;
  color: #a0a4b3;
  font-size: 11.5px;
}

/* ── шаг контактов ────────────────────────────────────────── */
.wgt-contacts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.wgt-contacts h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.wgt-back {
  border: 0;
  background: transparent;
  color: var(--wgt-accent-ink);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

.wgt-back:hover { text-decoration: underline; }

.wgt-selected {
  margin: 0 0 10px;
  color: var(--wgt-soft);
  font-size: 13px;
}

.wgt-form-status {
  margin: 0 0 10px;
  font-size: 13px;
  color: #6b7280;
}

.wgt-form-status.is-error { color: #b91c1c; }

.wgt-field {
  display: block;
  margin-bottom: 10px;
  min-width: 0;
}

.wgt-field > span {
  display: block;
  margin-bottom: 5px;
  color: #6b7280;
  font-size: 12.5px;
}

.wgt-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #dfe2ec;
  border-radius: 10px;
  background: #fff;
  color: var(--wgt-ink);
  font-size: 15px;
  transition: border-color .14s ease, box-shadow .14s ease;
}

.wgt-field input:focus {
  outline: none;
  border-color: var(--wgt-accent);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .16);
}

.wgt-field input[aria-invalid="true"] { border-color: #dc2626; }

.wgt-error {
  display: block;
  min-height: 0;
  margin-top: 4px;
  color: #b91c1c;
  font-size: 12px;
  font-style: normal;
}

.wgt-error:empty { display: none; }

.wgt-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 8px;
  color: #5b6272;
  font-size: 12.5px;
  line-height: 1.45;
  cursor: pointer;
}

.wgt-consent input {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--wgt-accent);
}

.wgt-consent a { color: var(--wgt-accent-ink); }

.wgt-hint {
  margin: 2px 0 10px;
  color: #9aa0b0;
  font-size: 12px;
}

.wgt-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--wgt-accent);
  border-radius: 12px;
  background: var(--wgt-accent);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}

.wgt-submit:hover { background: var(--wgt-accent-ink); border-color: var(--wgt-accent-ink); }
.wgt-submit:disabled { opacity: .55; cursor: default; }

.wgt-foot {
  margin: 12px 0 0;
  font-size: 12.5px;
}

.wgt-foot a { color: #7b8093; }

/* ── подтверждение ───────────────────────────────────────── */
.wgt-success { text-align: center; }
.wgt-success-title { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.wgt-success-text { margin: 0 0 16px; color: #5b6272; font-size: 14px; }
.wgt-success-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.wgt-success-link { color: var(--wgt-accent-ink); font-size: 13px; }

/* ── панель пункта/категории, если их несколько ──────────── */
.wgt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.wgt-tool { color: #8b90a0; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ── адаптив ─────────────────────────────────────────────── */
@media (max-width: 560px) {
  .embed-main { padding: 12px 10px 20px; }
  .wgt-card { padding: 16px 14px 14px; }
  .wgt-contacts, .wgt-success { padding: 16px 14px; }
  .wgt-month { font-size: 24px; }
  .wgt-days { gap: 5px; }
  .wgt-day { padding: 8px 2px 7px; }
  .wgt-day-num { font-size: 18px; }
  .wgt-grid { gap: 7px; }
  .wgt-tile { height: 40px; font-size: 12.5px; border-radius: 9px; }
  .wgt-arrow { width: 26px; height: 26px; font-size: 16px; }
  .wgt-legend { gap: 6px 12px; }
  .wgt-toggle { font-size: 11.5px; }
  .wgt-picker { width: 244px; }
}

@media (max-width: 380px) {
  .wgt-tile { font-size: 11.5px; height: 38px; }
  .wgt-days { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .eaisto-booking-widget * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Страница сайта: виджет сам является карточкой, внешняя обвязка статьи не нужна. */
.booking-page .booking-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.booking-page .booking-card > h1 { display: none; }

.booking-page .eaisto-booking-widget { margin-top: 8px; }


