/* Online consultation app — mobile first, RTL/LTR aware (logical properties) */
:root {
  --ink: #14232b; --muted: #5d6f78; --line: #dde5e8; --bg: #f4f7f8; --card: #fff;
  --brand: #0f3b4c; --brand-2: #17607a; --accent: #c8323b; --go: #138a5a;
  --ok-bg: #e7f6ee; --ok: #0f6b45; --err-bg: #fdecec; --err: #a3242b; --warn-bg: #fff6e0; --warn: #8a5a00;
  --r: 14px; --shadow: 0 1px 2px rgba(15,59,76,.06), 0 4px 16px rgba(15,59,76,.06);
  --font: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand-2); }
h1 { font-size: 1.55rem; line-height: 1.3; margin: .3em 0 .6em; }
h2 { font-size: 1.12rem; margin: 1.2em 0 .6em; display: flex; align-items: center; gap: .5em; }
h2:first-child { margin-top: 0; }
h3 { font-size: 1rem; margin: .8em 0 .4em; }
.m0 { margin: 0; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .tiny { font-size: .75rem; }
.center { text-align: center; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; }
.pre { white-space: pre-wrap; margin: 0; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1rem; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 5; }
.top a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; }
.brand small { color: #b9d3dc; font-weight: 500; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.12); color: #ff9aa0; }
.top nav { display: flex; gap: .9rem; align-items: center; font-size: .95rem; }
.top nav a:hover { text-decoration: underline; }
.lang { border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: .1rem .7rem; }

.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 1rem; flex: 1; }
.foot { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; padding: 1.2rem; color: var(--muted); font-size: .88rem; }
.foot a { color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem; margin: 0 0 1rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin-inline: auto; }
.card.note { background: var(--warn-bg); border-color: #f2dfae; box-shadow: none; }
.card.attention { border-color: #f2dfae; background: #fffbf0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; border: 0; border-radius: 10px; padding: .65rem 1.15rem; font: inherit; font-weight: 600; background: var(--brand-2); color: #fff; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: #fff; color: var(--brand-2); border: 1px solid var(--line); }
.btn-go { background: var(--go); }
.btn-lg { font-size: 1.08rem; padding: .85rem 1.6rem; min-height: 52px; }
.btn-sm { padding: .35rem .8rem; min-height: 36px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn.danger, .linklike.danger { color: var(--err); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); text-decoration: underline; cursor: pointer; }
form.inline { display: inline; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row.wrap-gap { margin-top: 1rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.alert { padding: .75rem 1rem; border-radius: 10px; margin: 0 0 1rem; background: var(--warn-bg); color: var(--warn); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }

.field { display: block; margin: 0 0 .9rem; }
.field > span { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
input:not([type=radio]):not([type=checkbox]):not([type=file]), textarea, select {
  width: 100%; font: inherit; padding: .6rem .75rem; border: 1px solid #c8d4d9; border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px; }
input:focus, textarea:focus { outline: 3px solid rgba(23,96,122,.2); border-color: var(--brand-2); }
input.invalid { border-color: var(--err); }
input.code { font-size: 1.6rem; letter-spacing: .4em; text-align: center; }
input[type=file] { font: inherit; max-width: 100%; }
.check { display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0; }
.check input { margin-top: .35rem; width: 18px; height: 18px; flex: none; }
.inline-field { display: grid; grid-template-columns: 7rem 1fr; align-items: center; gap: .6rem; }
.inline-field > span { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

.hero { text-align: center; padding: 1.8rem 0 1rem; }
.hero h1 { font-size: 1.9rem; margin-bottom: .3em; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 36rem; margin: 0 auto 1.2rem; }
.hero-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }
.price { color: var(--brand); font-weight: 600; margin-top: 1rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; margin: 1.2rem 0; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; }
.step h3 { margin: .5rem 0 .2rem; } .step p { margin: 0; color: var(--muted); font-size: .93rem; }
.num { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--brand); color: #fff; font-size: .85rem; font-weight: 700; flex: none; }

.days { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; scroll-snap-type: x mandatory; }
.day { flex: none; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; min-width: 92px; padding: .6rem .5rem; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: #fff; }
.day.active { border-color: var(--brand-2); background: #e9f3f6; box-shadow: inset 0 0 0 1px var(--brand-2); }
.dname { font-size: .85rem; color: var(--muted); } .dnum { font-weight: 700; } .dcount { font-size: .75rem; color: var(--go); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.slot input, .choice input { position: absolute; opacity: 0; pointer-events: none; }
.slot span { display: block; text-align: center; padding: .55rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; background: #fff; }
.slot input:checked + span { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.slot input:focus-visible + span, .choice input:focus-visible + span { outline: 3px solid rgba(23,96,122,.35); }
.choices { display: grid; gap: .6rem; }
.choice span { display: flex; flex-direction: column; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.choice small { color: var(--muted); }
.choice input:checked + span { border-color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--brand-2); background: #f2f8fa; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin: 1rem 0 0; }
.facts dt { color: var(--muted); font-size: .85rem; } .facts dd { margin: 0; font-weight: 600; }
.badge { display: inline-block; padding: .15rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #eef2f3; color: var(--muted); white-space: nowrap; }
.s-confirmed { background: var(--ok-bg); color: var(--ok); }
.s-pending_payment { background: var(--warn-bg); color: var(--warn); }
.s-cancelled, .s-no_show { background: var(--err-bg); color: var(--err); }
.s-completed { background: #e8eefc; color: #2847a0; }
.p-paid { background: var(--ok-bg); color: var(--ok); } .p-unpaid { background: #f3f3f3; color: #6b6b6b; }
.video-card { border-color: #bfe3d1; }
.tips { padding-inline-start: 1.2rem; margin: 1rem 0 0; }

.upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.upload-box { border: 1.5px dashed #b9c9cf; border-radius: 12px; padding: .9rem; display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; background: #fafcfc; }
.upload-box h3, .upload-box p { margin: 0; }
.progress { width: 100%; height: 8px; background: #e3eaec; border-radius: 99px; overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--go); transition: width .2s; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.thumb { display: flex; flex-direction: column; gap: .2rem; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: .4rem; background: #fff; overflow: hidden; }
.thumb img, .fileicon { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; background: #eef2f3; }
.fileicon { display: grid; place-items: center; font-weight: 800; color: var(--accent); }
.fname { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studies, .history, .checks { list-style: none; padding: 0; margin: 0; }
.studies li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .7rem 0; border-top: 1px solid var(--line); }
.studies .links { display: flex; gap: .4rem; flex-wrap: wrap; }
.history li { padding: .5rem 0; border-top: 1px solid var(--line); }
.checks li { padding: .3rem 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; } .dot.on { background: var(--go); } .dot.off { background: #c3c3c3; }
input.copy { font-size: .8rem; min-height: 34px; padding: .3rem .5rem; margin-top: .3rem; }

.list { display: grid; gap: .6rem; }
.item { display: flex; align-items: center; gap: 1rem; text-decoration: none; color: var(--ink); margin: 0; }
.item:hover { border-color: var(--brand-2); }
.item .grow { flex: 1; min-width: 0; }
.item .when { font-size: 1.05rem; min-width: 4.5rem; }
.badges { display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; }
.dayhead { margin: 1rem 0 .2rem; color: var(--muted); font-size: .95rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem; text-decoration: none; color: var(--muted); display: flex; flex-direction: column; font-size: .85rem; }
.stat .n { font-size: 1.7rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.stat.warn .n { color: var(--warn); }
.tabs { display: flex; gap: .3rem; overflow-x: auto; margin-bottom: .7rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-color: var(--brand-2); font-weight: 700; }
.search { display: flex; gap: .5rem; margin-bottom: 1rem; }

/* Video room */
.room-page { background: #0b1418; color: #fff; }
.room-page .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.prejoin { max-width: 480px; margin: 0 auto; padding: 1.5rem 1rem; text-align: center; display: flex; flex-direction: column; gap: .8rem; align-items: center; }
.prejoin video { width: 100%; max-width: 420px; aspect-ratio: 4/3; object-fit: cover; border-radius: 16px; background: #1b2a31; transform: scaleX(-1); }
.prejoin .muted { color: #9fb3bb; }
.stage { position: fixed; inset: 0; background: #0b1418; }
.remote { position: absolute; inset: 0; display: grid; place-items: center; }
.remote video, .remote-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.room-page .status { position: absolute; top: 40%; inset-inline: 0; text-align: center; font-size: 1.1rem; color: #cfe0e6; padding: 0 1rem; }
.prejoin .status { position: static; }
#local { position: absolute; inset-inline-end: 12px; top: calc(12px + env(safe-area-inset-top)); width: 28vw; max-width: 200px; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.5); background: #1b2a31; transform: scaleX(-1); z-index: 2; }
.controls { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); inset-inline: 0; display: flex; justify-content: center; gap: .8rem; z-index: 3; }
.ctl { width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 1.4rem; cursor: pointer; display: grid; place-items: center; text-decoration: none; backdrop-filter: blur(6px); }
.ctl.off { background: rgba(200,50,59,.85); }
.ctl.leave { background: var(--accent); transform: rotate(135deg); }

@media (max-width: 560px) {
  h1 { font-size: 1.35rem; } .hero h1 { font-size: 1.55rem; }
  .top nav { gap: .6rem; font-size: .88rem; }
  .brand small { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .item { flex-wrap: wrap; } .badges { flex-direction: row; }
  .inline-field { grid-template-columns: 5.5rem 1fr; }
}
