/* ══════════════════════════════════════════════════════════════════
   GoClinic — نظام التصميم
   حبر أخضر داكن على ورق بارد. عائلة خط واحدة. الجرأة في بطاقة الفرصة فقط.
   ══════════════════════════════════════════════════════════════════ */

@font-face { font-display: swap; }

:root {
  --ink:        #0E1F1B;
  --ink-soft:   #46565170;
  --muted:      #5A6A65;
  --paper:      #F1F4F2;
  --surface:    #FFFFFF;
  --line:       #DBE3DF;
  --brand:      #0B5C4C;
  --brand-deep: #073A30;
  --brand-wash: #E3EFEA;
  --signal:     #B4610E;
  --signal-wash:#FBEFE1;
  --danger:     #96302D;

  --r-sm: 4px;
  --r-md: 10px;
  --r-lg: 18px;

  --shadow: 0 1px 2px rgba(14,31,27,.05), 0 8px 24px -16px rgba(14,31,27,.25);

  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
  --step-4: 2.75rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: var(--step-0);
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  direction: rtl;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: var(--step-4); font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p  { margin: 0 0 1em; max-width: 68ch; }
a  { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-deep); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: var(--r-sm); }
img { max-width: 100%; height: auto; display: block; }
small { font-size: .875rem; color: var(--muted); }

.wrap      { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.wrap-tight{ width: min(760px, 100% - 2.5rem);  margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ── الترويسة ─────────────────────────────────────────────────── */
.site-head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.site-head .wrap { display: flex; align-items: center; gap: 1.5rem; height: 68px; }
.brand { display: flex; align-items: baseline; gap: .4rem; font-weight: 700; font-size: 1.3125rem; color: var(--ink); text-decoration: none; }
.brand span { color: var(--brand); }
.site-nav { display: flex; gap: 1.25rem; margin-inline-start: auto; align-items: center; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: .9375rem; }
.site-nav a:hover { color: var(--brand); }

/* ── الأزرار ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.25rem; border-radius: var(--r-md); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .9375rem;
  cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-signal { background: var(--signal); color: #fff; }
.btn-signal:hover { background: #92500B; color: #fff; }
.btn-lg { padding: .95rem 1.75rem; font-size: 1.0625rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── الحقول ───────────────────────────────────────────────────── */
label { display: block; font-weight: 600; font-size: .9375rem; margin-bottom: .35rem; }
input[type=text], input[type=tel], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: .7rem .85rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand-wash); outline-offset: 0; }
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 1.1rem; }
.field .err { color: var(--danger); font-size: .875rem; margin-top: .3rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.check input { margin-top: .35rem; flex-shrink: 0; }

/* ── الواجهة الرئيسية ─────────────────────────────────────────── */
.hero { padding: 4.5rem 0 3rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.hero h1 { max-width: 16ch; margin-bottom: 1rem; }
.hero p.lede { font-size: 1.1875rem; color: var(--muted); max-width: 52ch; margin-bottom: 2rem; }

.finder { background: var(--brand-wash); border: 1px solid #C7DCD4; border-radius: var(--r-lg); padding: 1.25rem; }
.finder-grid { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: .75rem; align-items: end; }
@media (max-width: 720px) { .finder-grid { grid-template-columns: 1fr; } }

.tally { display: flex; gap: 2.5rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.tally div b { display: block; font-size: 1.625rem; font-weight: 700; line-height: 1.2; }
.tally div span { font-size: .875rem; color: var(--muted); }

/* ── صفوف العيادات (لا شبكة بطاقات) ──────────────────────────── */
.clinic-list { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.clinic-row { display: flex; gap: 1.1rem; padding: 1.25rem; border-bottom: 1px solid var(--line); align-items: flex-start; }
.clinic-row:last-child { border-bottom: 0; }
.clinic-row .avatar {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: var(--r-md);
  background: var(--brand-wash); color: var(--brand-deep);
  display: grid; place-items: center; font-weight: 700; font-size: 1.25rem; overflow: hidden;
}
.clinic-row h3 { font-size: 1.125rem; margin-bottom: .2rem; }
.clinic-row h3 a { color: var(--ink); text-decoration: none; }
.clinic-row h3 a:hover { color: var(--brand); }
.clinic-meta { font-size: .875rem; color: var(--muted); }
.clinic-row .actions { margin-inline-start: auto; display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
@media (max-width: 640px) {
  .clinic-row { flex-wrap: wrap; }
  .clinic-row .actions { margin-inline-start: 0; width: 100%; }
}

.price { font-weight: 600; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: .15rem .55rem; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
.tag-featured { background: var(--signal-wash); border-color: #E9D2B2; color: #7A420A; }

/* ── الأقسام ──────────────────────────────────────────────────── */
.section { padding: 3rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  padding: .5rem .9rem; border-radius: 99px; background: var(--surface);
  border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .9375rem;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.5rem; }

/* ══ بطاقة الفرصة — العنصر الوحيد الجريء ══════════════════════ */
.opp {
  position: relative; display: flex; gap: 1.25rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.25rem 1.25rem 1.25rem 1.25rem;
  margin-bottom: 1rem; overflow: hidden;
}
/* العمود الزمني: شريط يمين البطاقة ينحسر مع الوقت */
.opp .spine { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 6px; background: var(--line); }
.opp .spine i { position: absolute; inset-inline-start: 0; top: 0; width: 100%; background: var(--signal); display: block; }
.opp.is-claimed .spine i { background: var(--brand); }
.opp.is-late  .spine i { background: var(--danger); }

.opp .body { flex: 1 1 auto; min-width: 0; }
.opp .ref {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: .8125rem; color: var(--muted); letter-spacing: .02em; direction: ltr; display: inline-block;
}
.opp h3 { font-size: 1.1875rem; margin: .15rem 0 .4rem; }
.opp dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: .6rem 0 0; font-size: .9375rem; }
.opp dt { color: var(--muted); }
.opp dd { margin: 0; }
.opp .side { flex: 0 0 190px; display: flex; flex-direction: column; gap: .6rem; align-items: stretch; text-align: center; }
@media (max-width: 700px) { .opp { flex-direction: column; } .opp .side { flex-basis: auto; } }

.countdown {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.75rem;
  color: var(--signal); line-height: 1.1; direction: ltr;
}
.countdown.late { color: var(--danger); }
.countdown + small { display: block; margin-top: -.2rem; }

.reveal { background: var(--brand-wash); border: 1px solid #C7DCD4; border-radius: var(--r-md); padding: .75rem; }
.reveal a { font-weight: 700; font-size: 1.125rem; direction: ltr; display: block; text-decoration: none; }

/* ── لوحة التحكم ──────────────────────────────────────────────── */
.dash { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } }
.dash-side { background: var(--brand-deep); color: #DCEAE5; padding: 1.5rem 1rem; }
.dash-side .brand { color: #fff; margin-bottom: 2rem; }
.dash-side .brand span { color: #7FC6B2; }
.dash-side nav { display: flex; flex-direction: column; gap: .25rem; }
.dash-side nav a {
  color: #C4DBD4; text-decoration: none; padding: .6rem .8rem; border-radius: var(--r-md); font-size: .9375rem;
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
}
.dash-side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.dash-side nav a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.dash-side .badge { background: var(--signal); color: #fff; border-radius: 99px; padding: 0 .5rem; font-size: .8125rem; font-weight: 700; }
.dash-main { padding: 2rem; min-width: 0; }
@media (max-width: 640px) { .dash-main { padding: 1.25rem; } }

.dash-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.dash-head h1 { font-size: 1.75rem; margin: 0; }
.balance-pill {
  margin-inline-start: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: .5rem .9rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.balance-pill.low { border-color: #E9D2B2; background: var(--signal-wash); color: #7A420A; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 2rem; }
.metrics div { background: var(--surface); padding: 1.1rem 1.25rem; }
.metrics b { display: block; font-size: 1.5rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metrics span { font-size: .875rem; color: var(--muted); }

.flash { padding: .85rem 1.1rem; border-radius: var(--r-md); margin-bottom: 1.25rem; font-weight: 600; }
.flash.ok    { background: var(--brand-wash); color: var(--brand-deep); }
.flash.error { background: #F8E7E6; color: var(--danger); }

.empty { text-align: center; padding: 3.5rem 1.5rem; border: 1px dashed var(--line); border-radius: var(--r-lg); background: var(--surface); }
.empty h3 { margin-bottom: .35rem; }

table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th, td { text-align: right; padding: .7rem .5rem; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--muted); font-size: .875rem; }
td.num { font-variant-numeric: tabular-nums; }

/* ── التذييل ──────────────────────────────────────────────────── */
.site-foot { background: var(--brand-deep); color: #A8C6BC; padding: 2.5rem 0; margin-top: 4rem; font-size: .9375rem; }
.site-foot a { color: #DCEAE5; text-decoration: none; }
.site-foot a:hover { color: #fff; text-decoration: underline; }
.foot-grid { display: flex; gap: 3rem; flex-wrap: wrap; justify-content: space-between; }
.site-foot .legal { border-top: 1px solid rgba(255,255,255,.12); margin-top: 1.75rem; padding-top: 1.25rem; font-size: .8125rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
