/* Smart Idea demo — Sana Dental Clinic. A light, calm clinic look on purpose:
   the demos show the client's brand, not Smart Idea's dark theme.
   Logical properties throughout so Arabic (rtl) and English (ltr) both work. */
:root {
  --bg: #F3F7F6;
  --card: #fff;
  --ink: #12302D;
  --ink-2: #48615E;
  --mut: #6F8582;
  --line: #DCE7E4;
  --brand: #0E7C74;
  --brand-2: #0A625C;
  --brand-soft: #E3F3F1;
  --warn: #B45309;
  --bad: #B42318;
  --radius: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.6 Inter, system-ui, sans-serif; }
:lang(ar) body { font-family: Cairo, Inter, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Clinic header ── */
.cl-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 40px); background: var(--card); border-bottom: 1px solid var(--line);
}
.cl-brand { display: flex; align-items: center; gap: 12px; }
.cl-mark { width: 42px; height: 42px; color: var(--brand); flex: none; }
.cl-brand b { display: block; font-size: 17px; }
.cl-brand small { display: block; color: var(--mut); font-size: 12.5px; }
.cl-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; }
.cl-tabs button {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border: 0; border-radius: 99px;
  background: transparent; color: var(--ink-2); font-weight: 600; cursor: pointer;
}
.cl-tabs button[aria-selected="true"] { background: var(--brand); color: #fff; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #F59E0B; color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }

main { max-width: 1160px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 64px; }

/* ── Shared ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(18, 48, 45, .04); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 20px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--mut); }
.btn.ghost:hover { color: var(--bad); border-color: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Patient hero ── */
.hero { padding: clamp(28px, 5vw, 52px) 0 24px; max-width: 720px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); }
.hero p { color: var(--ink-2); margin-top: 8px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin-top: 16px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.facts li { display: flex; align-items: center; gap: 8px; }
.facts li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }

/* ── Booking ── */
.bk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
#bk-card { padding: clamp(18px, 3vw, 30px); }
.bk-steps { display: flex; gap: 6px; list-style: none; margin-bottom: 22px; }
.bk-steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 3px solid var(--line); color: var(--mut); font-size: 13.5px; font-weight: 600; min-width: 0; }
.bk-steps .n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); font-size: 12px; flex: none; }
.bk-steps li.is-done { border-color: #9BD3CC; color: var(--ink-2); }
.bk-steps li.is-done .n { background: var(--brand-soft); border-color: #9BD3CC; color: var(--brand); }
.bk-steps li.is-current { border-color: var(--brand); color: var(--ink); }
.bk-steps li.is-current .n { background: var(--brand); border-color: var(--brand); color: #fff; }
.bk-h { font-size: 21px; margin-bottom: 16px; }
.bk-h:focus { outline: none; }
.bk-sub { color: var(--ink-2); margin: -8px 0 12px; font-weight: 600; }
.bk-empty { padding: 14px; border-radius: 12px; background: #FFF7ED; color: var(--warn); font-weight: 600; }

.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.opt, .doc, .day, .slot {
  text-align: start; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt:hover, .doc:hover, .day:not(:disabled):hover, .slot:not(:disabled):hover { border-color: var(--brand); }
.opt[aria-pressed="true"], .doc[aria-pressed="true"], .day[aria-pressed="true"], .slot[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.opt { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.opt b { font-size: 15.5px; }
.opt > span { color: var(--mut); font-size: 13.5px; }
.opt em { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-style: normal; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.opt em span:last-child { color: var(--brand); }

.doc-list { display: grid; gap: 10px; margin-bottom: 18px; }
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.ava { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 18px; color: hsl(var(--h) 60% 30%); background: hsl(var(--h) 55% 90%); }
.doc b { display: block; }
.doc small { color: var(--mut); font-size: 13px; }

.day-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.day { flex: 0 0 auto; min-width: 92px; padding: 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 0; text-align: center; }
.day b { font-size: 14px; }
.day span { color: var(--ink-2); font-size: 13px; }
.day small { color: var(--brand); font-size: 12px; font-weight: 600; }
.day:disabled { cursor: not-allowed; background: var(--bg); }
.day:disabled small { color: var(--mut); }
.day.small { min-width: 84px; padding: 8px 10px; }

.slot-h { font-size: 14px; color: var(--mut); margin: 14px 0 8px; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.slot { padding: 10px 6px; text-align: center; font-weight: 600; font-size: 14px; }
.slot:disabled { color: #A9B8B6; background: var(--bg); text-decoration: line-through; cursor: not-allowed; }

#bk-form { display: grid; gap: 16px; max-width: 520px; }
.fld { display: grid; gap: 6px; }
.fld > span { font-weight: 600; font-size: 14px; }
.fld input, .fld textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; }
.fld input:focus, .fld textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(14, 124, 116, .15); }
.fld input[aria-invalid="true"] { border-color: var(--bad); }
.fld small { color: var(--mut); font-size: 12.5px; }
:lang(ar) #f-phone { text-align: right; }
.err { color: var(--bad); font-size: 13px; font-style: normal; font-weight: 600; }
.err:empty { display: none; }
.chk { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--brand); }

.bk-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.bk-nav #bk-next { margin-inline-start: auto; min-width: 140px; }

.bk-sum { padding: 20px; position: sticky; top: 20px; }
.bk-sum h2 { font-size: 16px; margin-bottom: 12px; }
.bk-sum dl { display: grid; gap: 2px; }
.bk-sum dt { color: var(--mut); font-size: 12.5px; margin-top: 8px; }
.bk-sum dd { font-weight: 600; font-size: 14.5px; }
.sum-price { display: flex; justify-content: space-between; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.sum-price b { color: var(--brand); font-size: 18px; }
.sum-note, .sum-empty { color: var(--mut); font-size: 13px; margin-top: 6px; }

/* Success */
.ok { text-align: center; padding: 10px 0; }
.ok-mark { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.ok-code { font-size: 15px; color: var(--ink-2); }
.ok-code b { font-size: 20px; color: var(--ink); letter-spacing: .04em; }
.ok-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; max-width: 420px; margin: 18px auto; text-align: start; padding: 16px; background: var(--bg); border-radius: 12px; }
.ok-dl dt { color: var(--mut); font-size: 13.5px; }
.ok-dl dd { font-weight: 600; font-size: 14.5px; }
.ok-note { color: var(--mut); font-size: 13.5px; max-width: 460px; margin: 0 auto; }
.ok-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }

.mine { padding: 20px; margin-top: 20px; }
.mine h2 { font-size: 16px; margin-bottom: 10px; }
.mine ul { list-style: none; display: grid; gap: 8px; }
.mine li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.mine li b { display: block; }
.mine li small { color: var(--mut); font-size: 13px; }

/* ── Clinic dashboard ── */
.desk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: clamp(24px, 4vw, 40px) 0 16px; }
.desk-head h1 { font-size: clamp(24px, 3.4vw, 32px); }
.desk-head p { color: var(--ink-2); max-width: 60ch; }
.desk-filter select { height: 42px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; min-width: 200px; }
#desk-days { margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi span { display: block; color: var(--mut); font-size: 13px; font-weight: 600; }
.kpi b { font-size: 24px; font-variant-numeric: tabular-nums; }
.desk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.desk-list { list-style: none; padding: 6px; }
.row {
  display: grid; grid-template-columns: 92px minmax(0, 1.2fr) minmax(0, 1.2fr) 92px auto; align-items: center; gap: 12px;
  padding: 12px 10px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row small { display: block; color: var(--mut); font-size: 12.5px; }
.row.is-off { opacity: .55; }
.row.is-new { background: #FFFBEB; border-radius: 12px; animation: flash 1.6s ease-out 1; }
@keyframes flash { from { background: #FDE68A; } }
.r-time { font-weight: 700; font-variant-numeric: tabular-nums; }
:lang(ar) .r-time { text-align: right; }
.r-who b, .r-what b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:lang(ar) .r-who small { text-align: right; }
.r-what small { display: flex; align-items: center; gap: 6px; }
.r-what small i { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h) 60% 45%); }
.tag { display: inline-block; margin-top: 4px; margin-inline-end: 6px; padding: 1px 8px; border-radius: 99px; background: var(--bg); color: var(--ink-2); font-size: 11.5px; font-style: normal; font-weight: 600; }
.tag.new { background: #FEF3C7; color: #92400E; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; }
.s-booked { background: #E0F2FE; color: #075985; }
.s-arrived { background: #FEF3C7; color: #92400E; }
.s-done { background: #DCFCE7; color: #166534; }
.s-cancelled { background: #F1F5F9; color: #64748B; }
.r-act { display: flex; gap: 6px; justify-content: flex-end; }
.desk-empty { padding: 30px; text-align: center; color: var(--mut); }

.week { padding: 18px; }
.week h2 { font-size: 15px; margin-bottom: 14px; }
.chart { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 170px; }
.chart li { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 26px; height: calc(var(--v) * 120px + 4px); background: #B9DFDA; border-radius: 8px 8px 4px 4px; position: relative; }
.chart li.on .bar { background: var(--brand); }
.chart .bar b { position: absolute; top: -20px; inset-inline: 0; text-align: center; font-size: 12px; }
.chart small { font-size: 11px; color: var(--mut); white-space: nowrap; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .bk-grid, .desk-grid { grid-template-columns: 1fr; }
  .bk-sum { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 80px minmax(0, 1fr) auto; }
  .r-what { grid-column: 2; }
  .r-st { grid-column: 3; grid-row: 1; justify-self: end; }
  .r-act { grid-column: 1 / -1; justify-content: flex-start; }
  .r-act:empty { display: none; }
}
@media (max-width: 560px) {
  .cl-tabs { width: 100%; }
  .cl-tabs button { flex: 1; padding: 0 8px; justify-content: center; font-size: 13.5px; }
  .opt-grid { grid-template-columns: 1fr; }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bk-steps li span:not(.n) { display: none; }
  .bk-steps li.is-current span:not(.n) { display: inline; }
  .mine li { flex-direction: column; align-items: stretch; }
  .desk-filter, .desk-filter select { width: 100%; }
}
