/* Đặt lịch - Nha Khoa Aurora. Prefix .bk- */

.bk { --bk-radius: 0px; color: var(--ink); }
.bk-form[hidden] { display: none; }

.bk-form {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: clamp(18px, 3vw, 36px);
  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, 36px);
  align-items: start;
}

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

.bk-title {
  font-family: var(--grotesk);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  letter-spacing: -.03em;
  line-height: 1;
  margin: 0 0 2px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink);
}

.bk-field { display: grid; gap: 8px; min-width: 0; border: 0; padding: 0; margin: 0; }
.bk-field > label,
.bk-field > legend {
  font-family: var(--grotesk);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--stone);
  padding: 0;
}
.bk-field legend { margin-bottom: 2px; }

.bk-count {
  margin-left: 6px;
  font-size: 11px;
  letter-spacing: .02em;
  text-transform: none;
  color: var(--cobalt);
  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: 0;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  transition: border-color .18s var(--ease), background .18s;
}
.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='%23111111' 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(--cobalt);
  outline-offset: 1px;
  border-color: var(--cobalt);
  background: var(--paper);
}
.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: 12.5px; line-height: 1.5; color: var(--stone); }
.bk-optional { text-transform: none; letter-spacing: 0; color: var(--stone); font-weight: 400; }

/* ---------- lưới giờ ---------- */
.bk-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 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: 54px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bone);
  text-align: center;
  transition: border-color .16s var(--ease), background .16s, color .16s;
}
.bk-slot-in b { font-family: var(--grotesk); font-size: 14.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.bk-slot-in small { font-size: 10.5px; color: var(--stone); line-height: 1.1; }

.bk-slot:hover .bk-slot-in { border-color: var(--ink); }
.bk-slot input:checked + .bk-slot-in { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.bk-slot input:checked + .bk-slot-in small { color: rgba(255, 255, 255, .8); }

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

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

/* ---------- tóm tắt ---------- */
.bk-summary {
  position: sticky;
  top: 120px;
  background: var(--black);
  color: var(--paper);
  border: 1px solid var(--black);
  padding: 24px;
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}
.bk-summary-eyebrow {
  font-family: var(--grotesk);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #8f8a83;
}
.bk-sum-name { font-family: var(--grotesk); font-size: 20px; line-height: 1.2; font-weight: 500; letter-spacing: -.02em; margin-top: 4px; }
.bk-sum-meta { font-size: 13px; color: var(--cobalt); font-weight: 500; font-family: var(--grotesk); }

.bk-sum-list { margin: 14px 0 0; display: grid; gap: 10px; }
.bk-sum-list > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid #2a2a2a;
  padding-top: 10px;
}
.bk-sum-list dt { font-size: 12px; color: #8f8a83; flex: none; }
.bk-sum-list dd { margin: 0; font-size: 13.5px; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.bk-sum-note { margin: 14px 0 0; font-size: 12px; line-height: 1.55; color: #8f8a83; }

/* ---------- lỗi ---------- */
.bk-err { margin: 0; font-size: 12.5px; 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(165, 42, 28, .35); background: rgba(165, 42, 28, .06); }
.bk-field.has-error input,
.bk-field.has-error select,
.bk-field.has-error textarea { border-color: var(--coral); background: rgba(165, 42, 28, .04); }

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

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

/* ---------- thẻ xác nhận ---------- */
.bk-done {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: clamp(24px, 4vw, 44px);
  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: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: var(--cobalt);
  color: #fff;
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 8px;
}
.bk-done-title { font-family: var(--grotesk); font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 500; margin: 0; letter-spacing: -.03em; }
.bk-done-code { margin: 0; font-size: 12.5px; color: var(--stone); background: var(--bone); 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 .bk-sum-list > div { border-top-color: var(--line); }
.bk-done .bk-sum-list dt { color: var(--stone); }
.bk-done-note { margin: 14px 0 0; font-size: 13.5px; 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: 20px; margin-top: 4px; }
}

@media (max-width: 430px) {
  .bk-form { padding: 16px; }
  .bk-slots { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 7px; }
  .bk-slot-in { min-height: 50px; }
  .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; }
}
