/* Đặt lịch - Nha Khoa Tâm An. Prefix .bk- */

.bk {
  --bk-radius: var(--r-lg);
  color: var(--ink);
}

.bk-form[hidden] { display: none; }

.bk-form {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--bk-radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 34px);
  display: grid;
  gap: clamp(16px, 2.4vw, 24px);
}

.bk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  gap: clamp(18px, 3vw, 32px);
  align-items: start;
}

.bk-fields { display: grid; gap: 18px; min-width: 0; }

.bk-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  letter-spacing: -.01em;
  margin: 0;
}

.bk-field { display: grid; gap: 8px; min-width: 0; border: 0; padding: 0; margin: 0; }
.bk-field > label,
.bk-field > legend {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--teal);
  padding: 0;
}
.bk-field legend { margin-bottom: 2px; }

.bk-count {
  margin-left: 6px;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  font-weight: 500;
}

.bk-field input[type="text"],
.bk-field input[type="tel"],
.bk-field input[type="date"],
.bk-field select,
.bk-field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s;
}
.bk-field textarea { resize: vertical; min-height: 88px; }
.bk-field select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230e4a4e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.bk-field input:focus-visible,
.bk-field select:focus-visible,
.bk-field textarea:focus-visible,
.bk-slot input:focus-visible + .bk-slot-in {
  outline: 2px solid var(--teal-400);
  outline-offset: 2px;
  border-color: var(--teal-400);
  background: var(--white);
}
.bk-field input:disabled,
.bk-field select:disabled { opacity: .55; cursor: not-allowed; }

.bk-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 14px;
}
@media (max-width: 520px) { .bk-row { grid-template-columns: minmax(0, 1fr); } }

.bk-hint,
.bk-small {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.bk-optional { text-transform: none; letter-spacing: 0; color: var(--muted-2); font-weight: 400; }

/* ---------- lưới giờ ---------- */
.bk-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 2px;
}

.bk-slot { position: relative; display: block; cursor: pointer; min-width: 0; }
.bk-slot input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.bk-slot-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--cream);
  text-align: center;
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s;
}
.bk-slot-in b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bk-slot-in small { font-size: 11px; color: var(--muted); line-height: 1.1; }

.bk-slot:hover .bk-slot-in { border-color: var(--teal-400); background: var(--mint-2); }
.bk-slot input:checked + .bk-slot-in {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.bk-slot input:checked + .bk-slot-in small { color: rgba(255, 255, 255, .78); }

.bk-slot.is-full { cursor: not-allowed; }
.bk-slot.is-full .bk-slot-in {
  background: repeating-linear-gradient(135deg, var(--cream-2), var(--cream-2) 6px, var(--cream) 6px, var(--cream) 12px);
  border-style: dashed;
  color: var(--muted-2);
  opacity: .7;
}
.bk-slot.is-full:hover .bk-slot-in { border-color: var(--line); background: var(--cream-2); }

.bk-slots-status { margin: 0; font-size: 13px; color: var(--muted); }
.bk-slots.is-loading { opacity: .5; pointer-events: none; }

/* ---------- tóm tắt ---------- */
.bk-summary {
  position: sticky;
  top: 96px;
  background: linear-gradient(165deg, var(--mint-2), var(--cream) 72%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}
.bk-summary-eyebrow {
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.bk-sum-name { font-family: var(--serif); font-size: 20px; line-height: 1.3; font-weight: 600; }
.bk-sum-meta { font-size: 14px; color: var(--teal); font-weight: 600; }

.bk-sum-list { margin: 12px 0 0; display: grid; gap: 10px; }
.bk-sum-list > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px dashed rgba(10, 42, 43, .14);
  padding-top: 10px;
}
.bk-sum-list dt { font-size: 13px; color: var(--muted); flex: none; }
.bk-sum-list dd { margin: 0; font-size: 14px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.bk-sum-note { margin: 14px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }

/* ---------- lỗi ---------- */
.bk-err {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--coral);
  font-weight: 500;
}
.bk-err:empty { display: none; }
.bk-err-form {
  padding: 12px 14px;
  border: 1px solid rgba(201, 80, 59, .3);
  border-radius: var(--r-sm);
  background: rgba(201, 80, 59, .07);
}
.bk-field.has-error input,
.bk-field.has-error select,
.bk-field.has-error textarea { border-color: var(--coral); background: rgba(201, 80, 59, .04); }

/* ---------- đồng ý + nút ---------- */
.bk-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.5;
}
.bk-consent input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--teal);
}

.bk-submit { display: grid; gap: 10px; }
.bk-submit .btn { min-height: 54px; font-size: 16px; }
.bk-submit .btn[disabled] { opacity: .6; cursor: wait; }
.bk-small { text-align: center; }

/* ---------- thẻ xác nhận ---------- */
.bk-done {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--bk-radius);
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 42px);
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  max-width: 620px;
  margin-inline: auto;
}
.bk-done[hidden] { display: none; }
.bk-done-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--mint);
  color: var(--teal);
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 6px;
}
.bk-done-title { font-family: var(--serif); font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin: 0; }
.bk-done-code {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  background: var(--cream-2);
  border-radius: 999px;
  padding: 7px 16px;
}
.bk-done-code b { color: var(--ink); letter-spacing: .04em; }
.bk-done .bk-sum-list { width: 100%; margin-top: 14px; text-align: left; }
.bk-done-note { margin: 14px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.bk-done-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}
.bk-done-actions .btn { min-height: 50px; }

@media (max-width: 880px) {
  .bk-grid { grid-template-columns: minmax(0, 1fr); }
  .bk-summary { position: static; order: 2; padding: 18px; margin-top: 4px; }
}

@media (max-width: 430px) {
  .bk-form { padding: 16px; border-radius: var(--r); }
  .bk-slots { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 7px; }
  .bk-slot-in { min-height: 48px; }
  .bk-done-actions { flex-direction: column; width: 100%; }
  .bk-done-actions .btn { width: 100%; white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .bk-slot-in, .bk-field input, .bk-field select, .bk-field textarea { transition: none; }
}
