/* ==========================================================================
   DENTAL ARC - BOOKING DIALOG
   Two-panel layout on desktop, full-screen sheet on phones.
   ========================================================================== */

.bk-overlay {
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 24px;
  background: rgba(20, 26, 26, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
.bk-overlay.active { opacity: 1; visibility: visible; }

.bk-dialog {
  width: 100%; max-width: 980px; height: min(680px, calc(100vh - 48px));
  display: grid; grid-template-columns: 300px 1fr; overflow: hidden;
  background: #fff; border-radius: 28px; box-shadow: 0 40px 100px rgba(0, 0, 0, .3);
  transform: translateY(24px) scale(.98); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.bk-overlay.active .bk-dialog { transform: none; }

/* ---------- Rail ---------- */
.bk-rail {
  position: relative; display: flex; flex-direction: column; padding: 32px 28px; color: #fff;
  background: radial-gradient(120% 80% at 0% 0%, #1D9C96 0%, #127570 45%, #0D4F4C 100%);
  overflow: hidden;
}
.bk-rail::after {
  content: ''; position: absolute; width: 420px; height: 420px; right: -230px; bottom: -200px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 0 0 40px rgba(255, 255, 255, .03), 0 0 0 80px rgba(255, 255, 255, .02);
}
.bk-rail-logo { height: 30px; width: auto; align-self: flex-start; margin-bottom: 36px; }
.bk-rail-title { font-family: var(--font-serif); font-weight: 500; font-size: 1.9rem; line-height: 1.1; margin-bottom: 8px; color: #fff; }
.bk-rail-sub { font-size: .86rem; color: rgba(255, 255, 255, .75); margin-bottom: 32px; }
.bk-steps { list-style: none; display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; padding: 0; margin: 0; }
.bk-steps button {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px;
  background: none; border: 0; color: inherit; text-align: left; cursor: pointer; font: inherit; transition: background .2s;
}
.bk-steps button:hover:not(:disabled) { background: rgba(255, 255, 255, .08); }
.bk-steps button:disabled { cursor: default; }
.bk-step-num {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: .85rem; font-weight: 700; border: 1.5px solid rgba(255, 255, 255, .35); transition: .25s;
}
.bk-step-text { min-width: 0; display: flex; flex-direction: column; }
.bk-step-text small { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255, 255, 255, .6); font-weight: 600; }
.bk-step-text b { font-size: .92rem; font-weight: 600; color: rgba(255, 255, 255, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-steps li.is-current .bk-step-num { background: #fff; color: #127570; border-color: #fff; }
.bk-steps li.is-current b { color: #fff; }
.bk-steps li.is-done .bk-step-num { background: rgba(255, 255, 255, .18); border-color: transparent; font-size: 0; }
.bk-steps li.is-done .bk-step-num::before { content: '✓'; font-size: .9rem; }
.bk-steps li.is-done b { color: #fff; }
.bk-rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; font-size: .8rem; color: rgba(255, 255, 255, .7); position: relative; z-index: 1; }
.bk-rail-foot a { color: #fff; font-weight: 700; }

/* ---------- Main ---------- */
.bk-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.bk-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 24px 28px 20px; }
.bk-head-text { flex: 1; min-width: 0; }
.bk-head-step { font-size: .75rem; font-weight: 700; color: var(--color-teal); text-transform: uppercase; letter-spacing: .1em; }
.bk-head h3 { font-family: var(--font-serif); font-weight: 500; font-size: 1.6rem; line-height: 1.2; color: var(--color-text-main); }
.bk-progress { position: absolute; left: 28px; right: 28px; bottom: 0; height: 3px; border-radius: 3px; background: #EEF2F2; overflow: hidden; }
.bk-progress i { display: block; height: 100%; width: 33%; background: var(--color-teal); border-radius: 3px; transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.bk-icon-btn {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--color-border); background: #fff;
  display: grid; place-items: center; color: var(--color-text-main); cursor: pointer; transition: .2s;
}
.bk-icon-btn:hover { border-color: var(--color-teal); color: var(--color-teal-dark); background: var(--color-teal-light); }
.bk-icon-btn.sm { width: 36px; height: 36px; }
.bk-icon-btn:disabled { opacity: .3; pointer-events: none; }
.bk-body { flex: 1; overflow-y: auto; padding: 24px 28px 32px; overscroll-behavior: contain; }
.bk-panel { display: none; animation: bkIn .35s cubic-bezier(.2, .8, .2, 1); }
.bk-panel.is-active { display: block; }
@keyframes bkIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.bk-panel.from-left { animation-name: bkInLeft; }
@keyframes bkInLeft { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }

/* Step 1: services */
.bk-services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bk-service {
  position: relative; display: flex; flex-direction: column; padding: 0; text-align: left; cursor: pointer; overflow: hidden;
  border-radius: 14px; border: 1px solid var(--color-border); background: #fff; font: inherit; color: inherit;
  transition: border-color .25s, box-shadow .35s, transform .35s cubic-bezier(.2, .7, .2, 1);
}
.bk-service:hover { border-color: rgba(33, 183, 176, .55); box-shadow: 0 16px 30px -18px rgba(15, 94, 90, .45); transform: translateY(-2px); }
.bk-service:focus-visible { outline: 2px solid var(--color-teal); outline-offset: 2px; }
.bk-service-media { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--color-teal-light); }
.bk-service-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.bk-service:hover .bk-service-media img { transform: scale(1.06); }
.bk-service-media::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(8, 24, 23, .25)); }
.bk-service-tick {
  position: absolute; right: 10px; top: 10px; z-index: 1; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255, 255, 255, .85); border: 1.5px solid rgba(255, 255, 255, .9); transform: scale(.6); opacity: 0;
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.4), opacity .2s, background .2s;
}
.bk-service-tick::after { content: ''; position: absolute; left: 8px; top: 5px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.bk-service.is-on { border-color: var(--color-teal); box-shadow: 0 0 0 2px var(--color-teal), 0 16px 30px -18px rgba(15, 94, 90, .5); }
.bk-service.is-on .bk-service-tick { opacity: 1; transform: scale(1); background: var(--color-teal); border-color: var(--color-teal); }
.bk-service-text { display: block; padding: 12px 14px 14px; }
.bk-service strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .9rem; line-height: 1.3; color: var(--color-text-main); margin-bottom: 4px; }
.bk-service-text > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .76rem; color: var(--color-text-muted); line-height: 1.4; }

/* Step 2: dates & times */
.bk-week-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bk-week-head strong { font-size: 1rem; color: var(--color-text-main); }
.bk-week-nav { display: flex; gap: 8px; }
.bk-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.bk-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 0 10px; border-radius: 16px; cursor: pointer;
  border: 1.5px solid var(--color-border); background: #fff; font: inherit; color: var(--color-text-main); transition: .2s;
}
.bk-day small { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--color-text-muted); font-weight: 600; }
.bk-day b { font-size: 1.3rem; font-weight: 700; }
.bk-day i { width: 5px; height: 5px; border-radius: 50%; background: var(--color-teal); margin-top: 2px; }
.bk-day:hover:not(:disabled) { border-color: var(--color-teal); }
.bk-day.is-on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.bk-day.is-on small { color: rgba(255, 255, 255, .7); }
.bk-day.is-on i { background: #fff; }
.bk-day:disabled { opacity: .35; cursor: not-allowed; background: #F8FAFA; }
.bk-day:disabled i { visibility: hidden; }
.bk-first {
  margin-top: 14px; width: 100%; padding: 12px 16px; border-radius: 14px; border: 1px dashed var(--color-teal);
  background: var(--color-teal-light); color: var(--color-teal-dark); font: 600 .88rem 'Plus Jakarta Sans', sans-serif; cursor: pointer; text-align: left;
}
.bk-first:hover { background: #DDF3F1; }
.bk-times { margin-top: 22px; min-height: 160px; }
.bk-time-group { margin-bottom: 18px; }
.bk-time-label { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--color-text-muted); margin-bottom: 10px; }
.bk-time-label::after { content: ''; flex: 1; height: 1px; background: var(--color-border); }
.bk-time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.bk-time {
  height: 46px; border-radius: 12px; border: 1.5px solid var(--color-border); background: #fff; cursor: pointer;
  font: 600 .9rem 'Plus Jakarta Sans', sans-serif; color: var(--color-text-main); transition: .15s;
}
.bk-time:hover:not(:disabled) { border-color: var(--color-teal); background: var(--color-teal-light); color: var(--color-teal-dark); }
.bk-time.is-on { background: var(--color-teal); border-color: var(--color-teal); color: #fff; }
.bk-time:disabled { color: #C7CED3; background: #F8FAFA; text-decoration: line-through; cursor: not-allowed; }
.bk-skel { height: 46px; border-radius: 12px; background: linear-gradient(90deg, #F3F5F5, #E9EEEE, #F3F5F5); background-size: 200% 100%; animation: bkShimmer 1.2s infinite; }
@keyframes bkShimmer { to { background-position: -200% 0; } }
.bk-note { padding: 28px 16px; text-align: center; color: var(--color-text-muted); font-size: .92rem; border-radius: 16px; background: #F8FAFA; }
.bk-note a { color: var(--color-teal-dark); font-weight: 700; }

/* Step 3: form */
.bk-recap {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; margin-bottom: 22px;
  border-radius: 16px; background: var(--color-teal-light); color: var(--color-teal-dark); font-size: .88rem;
}
.bk-recap strong { display: block; color: var(--color-text-main); font-size: .95rem; }
.bk-recap button { background: none; border: 0; color: var(--color-teal-dark); font: 700 .82rem 'Plus Jakarta Sans', system-ui, sans-serif; cursor: pointer; text-decoration: underline; flex-shrink: 0; }
.bk-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.bk-field > span { font-size: .84rem; font-weight: 700; color: var(--color-text-main); }
.bk-field em { font-style: normal; font-weight: 500; color: var(--color-text-muted); margin-left: 4px; }
.bk-field input, .bk-field textarea {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--color-border); background: #fff;
  font: 500 1rem 'Plus Jakarta Sans', sans-serif; color: var(--color-text-main); transition: .2s; resize: vertical;
}
.bk-field input:focus, .bk-field textarea:focus { outline: none; border-color: var(--color-teal); box-shadow: 0 0 0 4px rgba(33, 183, 176, .12); }
.bk-field input.is-bad { border-color: #DC2626; }
.bk-segment { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 14px; background: #F3F5F5; }
.bk-segment button { padding: 11px; border-radius: 10px; border: 0; background: none; font: 600 .88rem 'Plus Jakarta Sans', sans-serif; color: var(--color-text-body); cursor: pointer; transition: .2s; }
.bk-segment button.is-on { background: #fff; color: var(--color-text-main); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.bk-error { color: #DC2626; font-size: .88rem; font-weight: 600; min-height: 1.2em; margin-bottom: 10px; }
.bk-submit {
  width: 100%; height: 56px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--color-primary); color: #fff; font: 700 1rem 'Plus Jakarta Sans', sans-serif;
  box-shadow: 0 12px 28px rgba(31, 31, 31, .2); transition: .2s;
}
.bk-submit:hover { background: #000; transform: translateY(-1px); }
.bk-submit:disabled { opacity: .6; cursor: progress; transform: none; }
.bk-fine { text-align: center; font-size: .8rem; color: var(--color-text-muted); margin-top: 12px; }

/* Done */
.bk-done { text-align: center; padding: 24px 0; }
.bk-done-badge {
  width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: var(--color-teal); box-shadow: 0 0 0 12px var(--color-teal-light), 0 20px 40px rgba(33, 183, 176, .35);
  animation: pop .5s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.bk-done h3 { font-family: var(--font-serif); font-weight: 500; font-size: 2rem; margin-bottom: 8px; color: var(--color-text-main); }
.bk-done p { color: var(--color-text-body); max-width: 420px; margin: 0 auto 24px; }
.bk-ticket { display: grid; grid-template-columns: 1fr 1fr; max-width: 420px; margin: 0 auto 24px; border-radius: 18px; border: 1.5px dashed var(--color-border); text-align: left; }
.bk-ticket > div { padding: 14px 18px; }
.bk-ticket > div + div { border-left: 1.5px dashed var(--color-border); }
.bk-ticket small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--color-text-muted); font-weight: 700; }
.bk-ticket strong { font-size: .95rem; color: var(--color-text-main); }
.bk-done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.bk-btn-light, .bk-btn-wa {
  display: inline-flex; align-items: center; justify-content: center; height: 48px; padding: 0 22px; border-radius: 999px;
  font: 700 .9rem 'Plus Jakarta Sans', sans-serif; cursor: pointer; transition: .2s;
}
.bk-btn-light { background: #fff; border: 1.5px solid var(--color-border); color: var(--color-text-main); }
.bk-btn-light:hover { border-color: var(--color-teal); }
.bk-btn-wa { background: #25D366; color: #fff; border: 0; }
.bk-btn-wa:hover { background: #1EBE5A; color: #fff; }

/* ---------- Phones: full-screen sheet ---------- */
@media (max-width: 760px) {
  .bk-overlay { padding: 0; place-items: end stretch; }
  .bk-dialog { grid-template-columns: 1fr; height: 100%; max-height: none; border-radius: 0; transform: translateY(100%); }
  .bk-rail { display: none; }
  .bk-head { padding: 16px 16px 14px; }
  .bk-head h3 { font-size: 1.3rem; }
  .bk-progress { left: 16px; right: 16px; }
  .bk-body { padding: 20px 16px calc(28px + env(safe-area-inset-bottom)); }
  .bk-services { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .bk-week { gap: 4px; }
  .bk-day { padding: 10px 0 8px; border-radius: 12px; }
  .bk-day b { font-size: 1.1rem; }
  .bk-time-grid { grid-template-columns: repeat(3, 1fr); }
  .bk-ticket { grid-template-columns: 1fr; }
  .bk-ticket > div + div { border-left: 0; border-top: 1.5px dashed var(--color-border); }
}
@media (prefers-reduced-motion: reduce) {
  .bk-dialog, .bk-panel, .bk-done-badge { animation: none !important; transition: none !important; }
}

.bk-icon-btn[hidden], .bk-first[hidden] { display: none; }

/* Time ranges with places left */
.bk-slot-list { display: grid; gap: 10px; }
.bk-time.bk-slot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; text-align: left; text-decoration: none; }
.bk-slot-time { font-weight: 600; font-size: 1rem; }
.bk-slot-tag { font-size: .8rem; color: var(--color-teal-dark); white-space: nowrap; }
.bk-slot.is-low .bk-slot-tag { color: #B45309; }
.bk-slot.is-on .bk-slot-tag { color: rgba(255, 255, 255, .85); }
.bk-slot:disabled { text-decoration: none; }
.bk-slot:disabled .bk-slot-time { text-decoration: line-through; }
.bk-slot:disabled .bk-slot-tag { color: #9AA5AB; }

/* Step 1: "Not sure?" helper */
.bk-unsure {
  grid-column: 1 / -1; padding: 18px 18px 16px; border-radius: 14px;
  background: linear-gradient(150deg, rgba(33, 183, 176, .1), rgba(15, 94, 90, .08)); border: 1px solid rgba(33, 183, 176, .25);
}
.bk-unsure-head strong { display: block; font-size: .98rem; color: var(--color-text-main); margin-bottom: 3px; }
.bk-unsure-head span { display: block; font-size: .8rem; line-height: 1.5; color: var(--color-text-muted); }
.bk-unsure-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 12px; }
.bk-unsure-chip {
  padding: 8px 13px; border-radius: 999px; border: 1px solid rgba(15, 94, 90, .2); background: #fff; cursor: pointer;
  font: 500 .8rem/1.2 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--color-teal-dark); transition: background .2s, color .2s, border-color .2s;
}
.bk-unsure-chip:hover, .bk-unsure-chip.is-on { background: var(--color-teal-dark); color: #fff; border-color: var(--color-teal-dark); }
.bk-unsure-check { padding: 0; border: 0; background: none; cursor: pointer; font: 600 .84rem/1.2 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--color-text-main); text-decoration: underline; text-underline-offset: 3px; }
.bk-unsure-check:hover { color: var(--color-teal-dark); }
.bk-services-label { grid-column: 1 / -1; margin: 6px 0 -2px; font-size: .7rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--color-text-muted); }
