/* MediBook AI — design tokens
   Palette: clinical daylight. Petrol ink, sky primary, mint surface,
   enamel grey for teeth, amber reserved for findings/urgency. */
:root {
  --mb-bg: #F6FBFB;
  --mb-surface: #FFFFFF;
  --mb-ink: #0B3142;
  --mb-ink-soft: #44606E;
  --mb-primary: #0EA5E9;
  --mb-primary-ink: #075985;
  --mb-mint: #DDF3EE;
  --mb-enamel: #E9F0F2;
  --mb-amber: #F5A524;
  --mb-line: #DCE8EB;
  --mb-radius: 14px;
  --mb-shadow: 0 10px 30px rgba(11, 49, 66, .08);
  --mb-font-display: 'Sora', 'IBM Plex Sans Arabic', sans-serif;
  --mb-font-body: 'Inter', 'IBM Plex Sans Arabic', sans-serif;
}
[data-theme="dark"] {
  --mb-bg: #0B1B21;
  --mb-surface: #11252D;
  --mb-ink: #E8F2F5;
  --mb-ink-soft: #9DB6BF;
  --mb-mint: #11332E;
  --mb-enamel: #1A323A;
  --mb-line: #1F3941;
  --mb-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
[dir="rtl"] body { --mb-font-display: 'IBM Plex Sans Arabic', sans-serif;
                   --mb-font-body: 'IBM Plex Sans Arabic', sans-serif; }

body {
  background: var(--mb-bg);
  color: var(--mb-ink);
  font-family: var(--mb-font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display-font { font-family: var(--mb-font-display); letter-spacing: -.02em; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; }
a { color: var(--mb-primary-ink); }

.mb-btn-primary {
  background: var(--mb-primary); border: none; color: #fff;
  border-radius: 999px; padding: .8rem 1.6rem; font-weight: 600;
  transition: transform .15s ease, box-shadow .15s ease;
}
.mb-btn-primary:hover { color:#fff; transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(14,165,233,.35); }
.mb-btn-ghost {
  background: transparent; border: 1.5px solid var(--mb-line);
  color: var(--mb-ink); border-radius: 999px; padding: .8rem 1.6rem; font-weight: 600;
}
.mb-card {
  background: var(--mb-surface); border: 1px solid var(--mb-line);
  border-radius: var(--mb-radius); box-shadow: var(--mb-shadow);
}
.mb-navbar { background: color-mix(in srgb, var(--mb-bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--mb-line); }
.mb-eyebrow { color: var(--mb-primary-ink); background: var(--mb-mint);
  border-radius: 999px; padding: .35rem .9rem; font-weight: 600; font-size: .85rem;
  display: inline-block; }
.mb-section { padding: 5rem 0; }
.mb-muted { color: var(--mb-ink-soft); }

/* Signature element: hero dental arch */
.tooth-arch { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; }
.tooth {
  width: 2.2rem; height: 2.8rem; border-radius: .7rem .7rem 1.1rem 1.1rem;
  background: var(--mb-enamel); border: 1px solid var(--mb-line);
  display: flex; align-items: flex-end; justify-content: center;
  font-size: .65rem; color: var(--mb-ink-soft); padding-bottom: .25rem;
  position: relative; transition: transform .15s ease;
}
.tooth:hover { transform: translateY(-3px); }
.tooth.caries::after, .tooth.crown::after {
  content: ""; position: absolute; top: .35rem; width: .85rem; height: .85rem;
  border-radius: 50%;
}
.tooth.caries::after { background: var(--mb-amber); }
.tooth.crown::after { background: var(--mb-primary); }

.wa-bubble {
  background: var(--mb-surface); border: 1px solid var(--mb-line);
  border-radius: var(--mb-radius); padding: 1rem 1.1rem; max-width: 22rem;
  box-shadow: var(--mb-shadow);
}
.wa-bubble .btns button {
  border: 1.5px solid var(--mb-primary); color: var(--mb-primary-ink);
  background: transparent; border-radius: 8px; padding: .25rem 1.2rem;
  font-weight: 600;
}
.wa-dot { width: .6rem; height: .6rem; border-radius: 50%; background: #22C55E;
  display: inline-block; }

.feature-icon { width: 3rem; height: 3rem; border-radius: 12px;
  background: var(--mb-mint); display: grid; place-items: center;
  font-size: 1.3rem; }
.step-num { font-family: var(--mb-font-display); font-size: 2.4rem;
  color: var(--mb-primary); font-weight: 700; line-height: 1; }

.price-card { border: 2px solid var(--mb-primary); }
.price-figure { font-family: var(--mb-font-display); font-size: 3.4rem; font-weight: 700; }
.check-list li { padding: .35rem 0; }
.check-list li::before { content: "✓ "; color: var(--mb-primary); font-weight: 700; }
[dir="rtl"] .check-list li::before { content: "✓ "; }

.cta-band { background: linear-gradient(135deg, var(--mb-primary-ink), var(--mb-primary));
  color: #fff; border-radius: var(--mb-radius); }
.cta-band .mb-btn-primary { background: #fff; color: var(--mb-primary-ink); }

footer { border-top: 1px solid var(--mb-line); }

/* Auth + dashboard shells */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 26rem; padding: 2rem; }
.form-control, .form-select { background: var(--mb-surface); color: var(--mb-ink);
  border-color: var(--mb-line); border-radius: 10px; padding: .65rem .9rem; }
.form-control:focus { border-color: var(--mb-primary); box-shadow: 0 0 0 .2rem rgba(14,165,233,.15); }
.slug-group .input-group-text { background: var(--mb-mint); border-color: var(--mb-line);
  color: var(--mb-primary-ink); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media (max-width: 576px) {
  .tooth { width: 1.7rem; height: 2.2rem; font-size: .55rem; }
  .price-figure { font-size: 2.6rem; }
}

/* Dashboard shell */
.mb-sidebar { width: 230px; min-height: calc(100vh - 60px);
  border-inline-end: 1px solid var(--mb-line); background: var(--mb-surface); }
.mb-navlink { display: flex; gap: .6rem; align-items: center;
  padding: .6rem .8rem; border-radius: 10px; color: var(--mb-ink);
  text-decoration: none; margin-bottom: .2rem; font-weight: 500; }
.mb-navlink:hover { background: var(--mb-mint); }
.mb-navlink.active { background: var(--mb-mint); color: var(--mb-primary-ink); }
.kpi-value { font-family: var(--mb-font-display); font-size: 1.9rem; font-weight: 700; }
.status-chip { font-size: .72rem; padding: .2rem .55rem; border-radius: 999px;
  color: #fff; font-weight: 600; display: inline-block; }
.slot-chip { border: 1.5px solid var(--mb-line); background: var(--mb-surface);
  color: var(--mb-ink); border-radius: 10px; padding: .45rem .9rem; font-weight: 600; }
.slot-chip:hover, .slot-chip.selected { border-color: var(--mb-primary);
  background: var(--mb-mint); color: var(--mb-primary-ink); }
.wa-fab { position: fixed; inset-inline-end: 1.2rem; bottom: 1.2rem;
  background: #22C55E; color: #fff; width: 3.4rem; height: 3.4rem;
  border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem;
  box-shadow: 0 8px 20px rgba(34,197,94,.4); text-decoration: none; z-index: 1030; }
.wa-fab:hover { color: #fff; transform: scale(1.05); }
table.mb-table { color: var(--mb-ink); }
table.mb-table th { color: var(--mb-ink-soft); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em; border-color: var(--mb-line); }
table.mb-table td { border-color: var(--mb-line); }
.fc { --fc-border-color: var(--mb-line); --fc-page-bg-color: transparent;
  --fc-today-bg-color: color-mix(in srgb, var(--mb-mint) 50%, transparent); }
.fc .fc-button { background: var(--mb-surface); border-color: var(--mb-line);
  color: var(--mb-ink); }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:hover { background: var(--mb-primary); border-color: var(--mb-primary); color:#fff; }

/* ===== Dental chart (centerpiece) ===== */
.chart-arch { display: flex; gap: .45rem; justify-content: center; flex-wrap: nowrap;
  overflow-x: auto; padding: .4rem .2rem; }
.chart-tooth { flex: 0 0 auto; width: 2.9rem; height: 3.7rem; border-radius: .8rem .8rem 1.3rem 1.3rem;
  background: var(--mb-enamel); border: 2px solid var(--mb-line); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  font-weight: 700; font-size: .8rem; color: var(--mb-ink-soft); padding-bottom: .3rem;
  position: relative; transition: transform .12s ease, box-shadow .12s ease; }
.chart-arch.lower .chart-tooth { border-radius: 1.3rem 1.3rem .8rem .8rem; }
.chart-tooth:hover { transform: translateY(-3px); box-shadow: var(--mb-shadow); }
.chart-tooth.selected { border-color: var(--mb-primary); box-shadow: 0 0 0 3px rgba(14,165,233,.25); }
.chart-tooth .dot { position: absolute; top: .4rem; width: 1rem; height: 1rem; border-radius: 50%; }
.chart-tooth.has-planned::after { content: ""; position: absolute; inset: -2px;
  border: 2px dashed var(--mb-amber); border-radius: inherit; pointer-events: none; }
.chart-tooth.missing { opacity: .35; }
.chart-tooth.missing .dot { background: transparent !important; border: 2px solid var(--mb-ink-soft); }
.chart-midline { width: 2px; background: var(--mb-line); margin: 0 .35rem; flex: 0 0 auto; }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; margin-inline-end: .9rem;
  font-size: .8rem; color: var(--mb-ink-soft); }
.chart-legend i { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; }

/* Surface cross selector */
.surface-grid { display: grid; grid-template-columns: repeat(3, 2.6rem); grid-template-rows: repeat(3, 2.6rem);
  gap: .3rem; justify-content: center; }
.surface-btn { border: 1.5px solid var(--mb-line); border-radius: 9px; background: var(--mb-surface);
  color: var(--mb-ink); font-weight: 700; }
.surface-btn.on { background: var(--mb-primary); border-color: var(--mb-primary); color: #fff; }

/* History timeline */
.tl { border-inline-start: 2px solid var(--mb-line); padding-inline-start: 1rem; }
.tl-item { position: relative; padding-bottom: 1rem; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: -1.42rem; top: .3rem;
  width: .75rem; height: .75rem; border-radius: 50%; background: var(--mb-primary); }

/* Before/After comparison slider */
.ba-compare { position: relative; overflow: hidden; border-radius: var(--mb-radius);
  aspect-ratio: 4/3; background: var(--mb-enamel); direction: ltr; }
.ba-compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba-compare .after-img { clip-path: inset(0 0 0 var(--split, 50%)); }
.ba-compare .ba-handle { position: absolute; top: 0; bottom: 0; left: var(--split, 50%);
  width: 3px; background: #fff; box-shadow: 0 0 8px rgba(0,0,0,.5); pointer-events: none; }
.ba-range { width: 100%; }
.ba-tag { position: absolute; top: .5rem; padding: .15rem .6rem; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; font-size: .72rem; font-weight: 600; }

/* X-ray viewer */
.xray-thumb { aspect-ratio: 4/3; object-fit: cover; width: 100%; border-radius: var(--mb-radius);
  cursor: zoom-in; background: #000; }
.xray-stage { overflow: hidden; background: #000; border-radius: var(--mb-radius);
  height: min(70vh, 640px); display: grid; place-items: center; }
.xray-stage img { max-width: 100%; max-height: 100%; transform: scale(var(--zoom, 1));
  transition: transform .1s ease; cursor: grab; }

@media (max-width: 768px) {
  .chart-tooth { width: 2.3rem; height: 3rem; font-size: .68rem; }
  .surface-grid { grid-template-columns: repeat(3, 2.3rem); grid-template-rows: repeat(3, 2.3rem); }
}

/* Mobile bottom navigation (PWA shell) */
.mb-bottomnav { position: fixed; bottom: 0; inset-inline: 0; z-index: 1030;
  display: flex; background: var(--mb-surface); border-top: 1px solid var(--mb-line);
  padding-bottom: env(safe-area-inset-bottom); }
.mb-bottomnav a { flex: 1; text-align: center; padding: .45rem 0 .4rem; font-size: .68rem;
  color: var(--mb-ink-soft); text-decoration: none; font-weight: 600; }
.mb-bottomnav a .ico { display: block; font-size: 1.15rem; line-height: 1.2; }
.mb-bottomnav a.active { color: var(--mb-primary-ink); }
@media (max-width: 767.98px) {
  .mb-has-bottomnav { padding-bottom: 4.6rem !important; }
  .wa-fab { bottom: 4.6rem; }
}

/* Super-admin console */
.mb-admin { background: #F1F5F9; }
[data-bs-theme="dark"] .mb-admin { background: #0B1620; }
.mb-admin-bar { background: var(--mb-petrol, #0B3142); }
.mb-admin-bar .navbar-brand, .mb-admin-bar .nav-link { color: #E2F2F7 !important; }
.mb-admin-bar .nav-link.active { color: #fff !important; font-weight: 600; }
.mb-metric { border-radius: 1rem; padding: 1.1rem 1.25rem; background: var(--mb-surface); border: 1px solid var(--mb-line); }
.mb-metric .v { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.mb-metric .l { color: var(--mb-ink-soft); font-size: .8rem; }
