/* =========================================================================
   Hospital Price Matcher — design system
   Direction: a precision reconciliation instrument. Deep clinical ink +
   a single confident teal accent. The signature is the A↔B link connector
   and the circular confidence gauge.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=Tajawal:wght@400;500;700&display=swap');

:root {
  --font-display: 'Space Grotesk', 'Tajawal', system-ui, sans-serif;
  --font-body: 'Inter', 'Tajawal', system-ui, sans-serif;
  --r-sm: 8px;  --r-md: 14px;  --r-lg: 20px;  --r-xl: 28px;
  --t-fast: .15s ease;  --t: .25s cubic-bezier(.4,0,.2,1);
  --shadow: 0 4px 24px rgba(0,0,0,.10);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.22);
}

[data-lang="ar"] { --font-display: 'Tajawal','Space Grotesk',sans-serif;
                    --font-body: 'Tajawal',sans-serif; }

/* ---- dark (default) ---- */
[data-theme="dark"] {
  --bg: #0C1422;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #16304a55, transparent),
             radial-gradient(900px 500px at 0% 110%, #0e3a3855, transparent);
  --surface: #131F33;
  --surface-2: #1A2942;
  --surface-3: #223352;
  --border: #2A3B59;
  --border-soft: #1F2E48;
  --text: #EAF1FA;
  --text-dim: #8DA0BC;
  --text-faint: #5C7191;
  --accent: #2DD4BF;
  --accent-ink: #04201C;
  --accent-glow: #2dd4bf33;
  --sky: #4CB7F5;
  --warn: #F6B445;
  --warn-soft: #3a2f17;
  --pos: #FF6F8B;      /* B more expensive */
  --pos-soft: #3a1f28;
  --neg: #3FD68C;      /* B cheaper */
  --neg-soft: #16321f;
}

/* ---- light ---- */
[data-theme="light"] {
  --bg: #EEF3F9;
  --bg-grad: radial-gradient(1100px 560px at 85% -12%, #cdeae6aa, transparent),
             radial-gradient(800px 480px at -5% 108%, #d4e6fbaa, transparent);
  --surface: #FFFFFF;
  --surface-2: #F4F8FC;
  --surface-3: #E9F0F8;
  --border: #D6E0EC;
  --border-soft: #E6EDF5;
  --text: #102038;
  --text-dim: #5A6B85;
  --text-faint: #93A3B8;
  --accent: #0E9F8E;
  --accent-ink: #FFFFFF;
  --accent-glow: #0e9f8e22;
  --sky: #1E8FD6;
  --warn: #CB8410;
  --warn-soft: #fcf1dc;
  --pos: #D6395C;
  --pos-soft: #fbe3e9;
  --neg: #178F5A;
  --neg-soft: #dff3e8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; }
a { color: inherit; text-decoration: none; }

/* =========================== layout shell =============================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--surface);
  border-inline-end: 1px solid var(--border-soft);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--sky));
  display: grid; place-items: center; color: var(--accent-ink);
  box-shadow: 0 6px 18px var(--accent-glow);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.2px; }
.brand-sub { font-size: 11px; color: var(--text-faint); }

.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--r-md);
  color: var(--text-dim); font-weight: 500; font-size: 14.5px;
  transition: var(--t-fast); position: relative;
}
.nav-link svg { width: 19px; height: 19px; opacity: .85; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-glow); color: var(--accent); }
.nav-link.active::before {
  content:''; position:absolute; inset-inline-start:-16px; top:50%; transform:translateY(-50%);
  width:4px; height:22px; border-radius:0 4px 4px 0; background: var(--accent);
}
[dir="rtl"] .nav-link.active::before { border-radius:4px 0 0 4px; }
.nav-badge {
  margin-inline-start:auto; font-size:11px; font-weight:600;
  background: var(--surface-3); color: var(--text-dim);
  padding:2px 8px; border-radius:20px;
}
.nav-spacer { flex: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display:flex; align-items:center; gap:14px;
  padding: 16px 30px; border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; font-weight: 600; }
.topbar-right { margin-inline-start: auto; display:flex; align-items:center; gap:10px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); cursor: pointer;
  display: grid; place-items: center; transition: var(--t-fast);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

.seg { display:flex; background: var(--surface); border:1px solid var(--border); border-radius: 11px; overflow:hidden; }
.seg a { padding: 8px 13px; font-size: 13px; font-weight: 600; color: var(--text-dim); transition: var(--t-fast); }
.seg a.on { background: var(--accent); color: var(--accent-ink); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sky), var(--accent));
  color: var(--accent-ink); display: grid; place-items: center;
  font-weight: 700; font-size: 14px; font-family: var(--font-display);
}

.content { padding: 30px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* =============================== cards ================================== */
.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: 24px;
}
.card-title { font-size: 16px; margin-bottom: 4px; }
.card-sub { font-size: 13.5px; color: var(--text-dim); margin-bottom: 18px; }

/* =============================== buttons ================================ */
.btn {
  font-family: var(--font-body); font-weight: 600; font-size: 14.5px;
  padding: 12px 22px; border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; transition: var(--t); display: inline-flex;
  align-items: center; gap: 9px; line-height: 1;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 22px var(--accent-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px var(--accent-glow); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* =============================== forms ================================== */
.field { margin-bottom: 16px; }
.field label { display:block; font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.input, select.input {
  width: 100%; padding: 12px 14px; font-size: 14.5px; font-family: var(--font-body);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md); transition: var(--t-fast);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* =============================== flash ================================== */
.flash { padding: 13px 18px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 14px; font-weight: 500;
         display:flex; align-items:center; gap:10px; }
.flash.error { background: var(--pos-soft); color: var(--pos); border: 1px solid color-mix(in srgb,var(--pos) 35%, transparent); }
.flash.success { background: var(--neg-soft); color: var(--neg); border: 1px solid color-mix(in srgb,var(--neg) 35%, transparent); }

/* =============================== login ================================== */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-aside {
  background: linear-gradient(150deg, #0A1322, #0e2a36);
  color: #EAF1FA; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-aside::after {
  content:''; position:absolute; width:520px; height:520px; border-radius:50%;
  background: radial-gradient(circle, #2dd4bf22, transparent 65%);
  bottom:-180px; inset-inline-end:-120px;
}
.login-aside .brand-mark { width: 46px; height: 46px; }
.login-aside h2 { font-size: 34px; line-height: 1.12; margin: 24px 0 14px; max-width: 13ch; }
.login-aside p { color: #9FB4C9; max-width: 38ch; font-size: 15px; }
.login-feature { display:flex; align-items:center; gap:12px; margin-top: 14px; font-size: 14px; color:#C5D4E4; }
.login-feature .dot { width: 28px; height:28px; border-radius:8px; background:#15324088; display:grid; place-items:center; }
.login-feature .dot svg { width:15px; height:15px; color: var(--accent); }
.login-panel { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { font-size: 26px; margin-bottom: 6px; }
.login-box .card-sub { margin-bottom: 26px; }

/* ============================ upload / compare ========================== */
.compare-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 0; }
.drop {
  border: 2px dashed var(--border); border-radius: var(--r-lg); padding: 38px 24px;
  text-align: center; background: var(--surface); transition: var(--t); cursor: pointer;
  display:flex; flex-direction:column; align-items:center; gap: 14px; min-height: 260px; justify-content:center;
}
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--surface-2); }
.drop.filled { border-style: solid; border-color: var(--accent); }
.drop-ico { width: 58px; height: 58px; border-radius: 16px; display:grid; place-items:center;
            background: var(--accent-glow); color: var(--accent); }
.drop-ico svg { width: 26px; height: 26px; }
.drop h3 { font-size: 16px; }
.drop .hint { font-size: 13px; color: var(--text-dim); }
.drop .fname { font-size: 13.5px; font-weight: 600; color: var(--accent); word-break: break-all; }
.drop-tag { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--text-faint);
            text-transform: uppercase; }

.connector { display:flex; flex-direction:column; align-items:center; justify-content:center; padding: 0 22px; }
.connector .line { width: 2px; flex:1; background: linear-gradient(var(--border), var(--accent), var(--border)); }
.connector .knot {
  width: 46px; height: 46px; border-radius: 50%; margin: 12px 0;
  background: var(--surface); border: 2px solid var(--accent); color: var(--accent);
  display: grid; place-items: center; box-shadow: 0 0 0 6px var(--accent-glow);
}
.connector .knot svg { width: 20px; height: 20px; }

/* ============================== review =================================== */
.review-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  padding: 22px 24px; margin-bottom: 16px;
  display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 20px;
  transition: var(--t);
}
.review-card.gone { opacity:0; transform: scale(.96); pointer-events:none; }
.rc-side { min-width: 0; }
.rc-tag { font-size: 11px; font-weight: 700; letter-spacing:.5px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.rc-name { font-size: 16px; font-weight: 600; font-family: var(--font-display); word-break: break-word; }
.rc-price { font-size: 13px; color: var(--text-dim); margin-top: 3px; }
.rc-arrow { color: var(--text-faint); }
.rc-arrow svg { width: 26px; height: 26px; }
[dir="rtl"] .rc-arrow svg { transform: scaleX(-1); }
.rc-actions { display: flex; gap: 10px; }
.btn-approve { background: var(--neg-soft); color: var(--neg); border:1px solid color-mix(in srgb,var(--neg) 40%,transparent); }
.btn-approve:hover { background: var(--neg); color: #fff; }
.btn-reject { background: var(--pos-soft); color: var(--pos); border:1px solid color-mix(in srgb,var(--pos) 40%,transparent); }
.btn-reject:hover { background: var(--pos); color: #fff; }
.btn-sm { padding: 9px 16px; font-size: 13.5px; border-radius: 10px; }

/* confidence gauge (signature element) */
.gauge { position: relative; width: 58px; height: 58px; }
.gauge svg { transform: rotate(-90deg); }
.gauge .track { stroke: var(--surface-3); }
.gauge .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .8s var(--t); }
.gauge .pct { position:absolute; inset:0; display:grid; place-items:center; font-family:var(--font-display);
              font-weight:700; font-size:14px; }

/* ============================== results ================================== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border:1px solid var(--border-soft); border-radius: var(--r-md); padding: 18px 20px; }
.stat .num { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height:1; }
.stat .lbl { font-size: 12.5px; color: var(--text-dim); margin-top: 7px; }
.stat.accent .num { color: var(--accent); }
.stat.warn .num { color: var(--warn); }

.table-wrap { background: var(--surface); border:1px solid var(--border-soft); border-radius: var(--r-lg); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  background: var(--surface-2); text-align: start; padding: 13px 16px;
  font-weight: 600; font-size: 12px; letter-spacing: .4px; text-transform: uppercase;
  color: var(--text-dim); border-bottom: 1px solid var(--border);
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
.svc-name { font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; font-family: var(--font-display); }
.pill { display:inline-flex; align-items:center; gap:6px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--neg-soft); color: var(--neg); }
.pill.no { background: var(--warn-soft); color: var(--warn); }
.diff-up { color: var(--pos); font-weight: 700; }
.diff-down { color: var(--neg); font-weight: 700; }
.diff-zero { color: var(--text-dim); }
.row-nomatch td { background: color-mix(in srgb, var(--warn-soft) 50%, transparent); }

.results-head { display:flex; align-items:center; justify-content:space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }

/* =============================== misc =================================== */
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 24px; margin-bottom: 4px; }
.page-head p { color: var(--text-dim); font-size: 14.5px; }
.empty { text-align:center; padding: 60px 20px; color: var(--text-dim); }
.empty svg { width: 54px; height: 54px; opacity: .4; margin-bottom: 14px; }
.list-row { display:flex; align-items:center; gap: 14px; padding: 15px 18px; border:1px solid var(--border-soft);
            border-radius: var(--r-md); margin-bottom: 10px; background: var(--surface); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .meta { font-size: 12.5px; color: var(--text-faint); }
.tag-mini { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; }
.tag-match { background: var(--neg-soft); color: var(--neg); }
.tag-reject { background: var(--pos-soft); color: var(--pos); }
.two-col { display:grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.inline-form { display:flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; flex: 1; min-width: 130px; }
.btn-danger-x { background: transparent; border:none; color: var(--text-faint); cursor:pointer; padding:6px; border-radius:8px; transition: var(--t-fast); }
.btn-danger-x:hover { color: var(--pos); background: var(--pos-soft); }
.btn-danger-x svg { width: 17px; height: 17px; display:block; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .compare-grid { grid-template-columns: 1fr; }
  .connector { flex-direction: row; padding: 18px 0; }
  .connector .line { height: 2px; width: auto; }
  .two-col, .stats { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .review-card { grid-template-columns: 1fr; text-align: center; gap: 14px; }
  .content { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
