/* ==========================================================================
   Онлайн-запись «Витязь» — страница записи и страница записи клиента
   Использует переменные и кнопки из site.css
   ========================================================================== */

.bk {
  padding: 2.5rem 0 4rem;
}

.bk-head {
  max-width: 720px;
  margin-bottom: 1.75rem;
}

.bk-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  margin: 0.5rem 0 0.6rem;
}

.bk-lead {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.bk-alert {
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

.bk-alert-info {
  border-color: rgba(245, 158, 11, 0.45);
  background: var(--accent-light);
  color: #78350f;
}

.bk-alert-success {
  border-color: rgba(16, 185, 129, 0.4);
  background: #ecfdf5;
  color: #065f46;
}

.bk-alert-error {
  border-color: rgba(225, 29, 72, 0.35);
  background: #fff1f2;
  color: #9f1239;
}

/* ---------- layout ---------- */

.bk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1.5rem;
  align-items: start;
}

.bk-steps {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.bk-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.bk-card-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text-primary);
  padding: 0;
  margin-bottom: 1rem;
}

.bk-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--accent-fill);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.bk-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: -0.4rem 0 1rem;
}

.bk-sub a,
.bk-note a,
.bk-consent a,
.bk-empty a {
  color: var(--accent-dark);
  text-decoration: underline;
}

.bk-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-dark);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.bk-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ---------- selectable options ---------- */

.bk-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.bk-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.bk-option-body {
  display: block;
  height: 100%;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.bk-option:hover .bk-option-body {
  border-color: var(--border-hover);
}

.bk-option input:focus-visible + .bk-option-body {
  outline: 3px solid rgba(245, 158, 11, 0.35);
  outline-offset: 2px;
}

.bk-option input:checked + .bk-option-body {
  border-color: var(--ink);
  background: var(--accent-light);
  outline: 1px solid var(--ink);
}

.bk-option-title {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-primary);
}

.bk-option-hint {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
  margin-top: 0.15rem;
}

/* car types */
.bk-cartypes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.bk-cartype .bk-option-body {
  padding: 0.9rem 0.75rem;
  text-align: center;
}

.bk-cartype-icon {
  display: block;
  width: 64px;
  height: 32px;
  margin: 0 auto 0.4rem;
  color: var(--text-muted);
}

.bk-cartype input:checked + .bk-option-body .bk-cartype-icon {
  color: var(--accent-dark);
}

.bk-cartype-icon svg {
  width: 100%;
  height: 100%;
}

/* radius chips */
.bk-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.bk-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.bk-help {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.6rem;
}

.bk-radius {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.5rem;
}

.bk-chip-unknown {
  grid-column: span 2;
}

.bk-chip .bk-option-body {
  padding: 0.6rem 0;
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.92rem;
}

/* services */
.bk-services {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bk-service .bk-option-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem 1rem;
}

.bk-check {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-hover);
  border-radius: 6px;
  background: #fff;
  position: relative;
  transition: all var(--transition-fast);
}

.bk-service input:checked + .bk-option-body .bk-check {
  background: var(--ink);
  border-color: var(--ink);
}

.bk-service input:checked + .bk-option-body .bk-check::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.bk-service-meta {
  text-align: right;
  white-space: nowrap;
}

.bk-service-price {
  display: block;
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--text-primary);
}

.bk-service-time {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- days & times ---------- */

.bk-placeholder,
.bk-loading,
.bk-empty {
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  font-size: 0.92rem;
}

.bk-loading {
  margin-bottom: 1rem;
}

.bk-days {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 2px 2px 0.75rem;
  margin: 0 -2px 0.75rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.bk-day {
  flex: 0 0 auto;
  width: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  padding: 0.6rem 0.25rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  scroll-snap-align: start;
  font-family: var(--font-body);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.bk-day:hover:not(:disabled) {
  border-color: var(--border-hover);
}

.bk-day.is-active {
  border-color: var(--ink);
  background: var(--accent-light);
  outline: 1px solid var(--ink);
}

.bk-day:disabled {
  cursor: default;
  opacity: 0.45;
  background: var(--bg-alt);
}

.bk-day-week {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.bk-day-num {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.15;
}

.bk-day-month {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bk-day-free {
  margin-top: 0.2rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--badge-green);
}

.bk-day:disabled .bk-day-free {
  color: var(--text-muted);
}

.bk-time-group + .bk-time-group {
  margin-top: 0.9rem;
}

.bk-time-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.bk-time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 0.5rem;
}

.bk-time {
  padding: 0.65rem 0;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bk-time:hover {
  border-color: var(--ink);
}

.bk-time.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.bk-hours {
  margin: 1rem 0 0;
}

/* ---------- contacts ---------- */

.bk-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
}

.bk-span-2 {
  grid-column: 1 / -1;
}

.bk-consent {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.bk-consent input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent-secondary);
}

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

/* ---------- summary ---------- */

.bk-summary {
  position: sticky;
  top: 96px;
}

.bk-summary-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: 0.9rem;
}

.bk-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.bk-summary-list div {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  gap: 0.5rem;
  font-size: 0.9rem;
}

.bk-summary-list dt {
  color: var(--text-muted);
}

.bk-summary-list dd {
  color: var(--text-primary);
  font-weight: 600;
}

.bk-summary-price {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px dashed var(--border-hover);
  padding-top: 0.9rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.bk-summary-price strong {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.bk-submit {
  width: 100%;
}

.bk-submit:disabled,
.bk-bar-btn:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none !important;
}

.bk-error {
  background: #fff1f2;
  border: 1px solid rgba(225, 29, 72, 0.3);
  color: #9f1239;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  margin-bottom: 0.9rem;
}

.bk-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  line-height: 1.45;
}

.bk-attention {
  animation: bkAttention 1.2s ease;
}

@keyframes bkAttention {
  0%, 100% { outline: 0 solid transparent; }
  30% { outline: 3px solid var(--accent-fill); }
}

/* ---------- my bookings ---------- */

.bk-mine {
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: #ecfdf5;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
}

.bk-mine-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #065f46;
  margin-bottom: 0.4rem;
}

.bk-mine-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
}

.bk-mine-item {
  color: #047857;
  font-weight: 600;
  text-decoration: underline;
}

/* ---------- extra blocks ---------- */

.bk-extra {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.bk-extra-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.bk-extra .bk-sub {
  margin: 0 0 1rem;
}

.bk-callback-call {
  width: 100%;
  margin-bottom: 1rem;
}

.bk-callback-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.bk-callback-form .btn,
.bk-callback-form .bk-note {
  grid-column: 1 / -1;
}

.bk-callback-form .bk-note {
  margin-top: 0;
}

.bk-memo ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.bk-memo b {
  color: var(--text-primary);
}

.bk-closed {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.bk-closed h2 {
  margin-bottom: 0.5rem;
}

.bk-closed p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* ---------- mobile sticky bar ---------- */

.bk-bar {
  display: none;
}

@media (max-width: 1024px) {
  .bk-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .bk-summary {
    position: static;
  }

  .page-booking .mobile-bottom-bar {
    display: none !important;
  }

  /* На телефоне главная кнопка — в нижней панели; чат не перекрывает выбор времени */
  .page-booking .ai-chat-widget {
    display: none;
  }

  .bk-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 96;
    padding: 0.65rem 1rem max(0.65rem, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  }

  .bk-bar-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
  }

  .bk-bar-info strong {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.05rem;
  }

  .bk-bar-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bk-bar-btn {
    flex-shrink: 0;
    padding: 0.8rem 1.4rem;
  }
}

@media (max-width: 720px) {
  .bk {
    padding-top: 1.5rem;
  }

  .bk-card {
    padding: 1.15rem;
    border-radius: var(--radius-md);
  }

  .bk-cartypes {
    gap: 0.5rem;
  }

  .bk-cartype .bk-option-body {
    padding: 0.75rem 0.35rem;
  }

  .bk-cartype .bk-option-hint {
    display: none;
  }

  .bk-cartype .bk-option-title {
    font-size: 0.84rem;
    overflow-wrap: normal;
    word-break: keep-all;
  }

  .bk-cartype-icon {
    width: 52px;
    height: 26px;
  }

  .bk-radius {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .bk-chip-unknown {
    grid-column: 1 / -1;
  }

  .bk-service .bk-option-body {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.4rem 0.75rem;
  }

  .bk-service-meta {
    grid-column: 2;
    text-align: left;
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
  }

  .bk-grid-2,
  .bk-extra,
  .bk-callback-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .bk-time-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Страница записи клиента
   ========================================================================== */

.bkm {
  max-width: 760px;
  margin: 0 auto;
}

.bkm-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.88rem;
}

.bkm-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.bkm-status-pending { background: #fffbeb; color: #b45309; }
.bkm-status-confirmed { background: #ecfdf5; color: #047857; }
.bkm-status-completed { background: var(--bg-alt); color: var(--text-secondary); }
.bkm-status-cancelled { background: #fff1f2; color: #be123c; }

.bkm-when {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  margin: 0.9rem 0 0.25rem;
}

.bkm-number {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.bkm-details {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1.25rem 0;
  padding: 1.1rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.bkm-details div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 0.75rem;
  font-size: 0.95rem;
}

.bkm-details dt {
  color: var(--text-muted);
}

.bkm-details dd {
  font-weight: 600;
}

.bkm-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.bkm-actions .btn {
  width: 100%;
}

.bkm-cancel {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-hover);
}

.bkm-cancel summary {
  cursor: pointer;
  color: #be123c;
  font-weight: 600;
  font-size: 0.92rem;
}

.bkm-cancel form {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-danger {
  background: #fff;
  color: #be123c;
  border: 1.5px solid rgba(225, 29, 72, 0.5);
}

.btn-danger:hover {
  background: #fff1f2;
}

.bkm-pending-note {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 0.5rem;
}

@media (max-width: 720px) {
  .bkm-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .bkm-details div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1rem;
  }
}
