/* Uses logical properties (inline-start/end) throughout so Arabic and Urdu pages mirror correctly. */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #16202c;
  --muted: #5b6b7c;
  --border: #dde3ea;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --accent-soft: #e6f4f2;
  --warn-bg: #fff7e0;
  --warn-text: #7a5300;
  --promo-bg: #fdf0d8;
  --promo-text: #8a4b00;
  --better: #0f766e;
  --focus: #2563eb;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Chart series, one per provider, fixed order. Validated for colour-blind
     separation on #ffffff (light) and #161d26 (dark). Slots 3-5 are under 3:1
     on white, so charts always carry direct labels and a data table. */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --chart-grid: #e8ecf0;
  --chart-axis: #c3c9d1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1319;
    --surface: #161d26;
    --text: #e6ebf1;
    --muted: #9aa8b7;
    --border: #2a3542;
    --accent: #2dd4bf;
    --accent-text: #062a26;
    --accent-soft: #10302d;
    --warn-bg: #3a2e10;
    --warn-text: #f5d98b;
    --promo-bg: #3b2a12;
    --promo-text: #f7c58a;
    --better: #5eead4;
    --focus: #60a5fa;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767;
    --chart-grid: #232d39;
    --chart-axis: #3a4655;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-text-size-adjust: 100%;
}
/* Devanagari and Arabic-script text needs more vertical room. */
html:lang(hi) body, html:lang(ar) body, html:lang(ur) body { line-height: 1.75; }
html:lang(ur) body { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", var(--font); }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 16px; }

a { color: var(--accent); }
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible, .chip input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; inset-inline-start: 8px; inset-block-start: -60px; z-index: 10;
  background: var(--accent); color: var(--accent-text); padding: 8px 14px; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { inset-block-start: 8px; }

/* Language banner */
.lang-banner { background: var(--accent-soft); border-block-end: 1px solid var(--border); }
.lang-banner-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-block: 10px; }
.lang-banner p { margin: 0; font-weight: 600; }
.lang-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Header */
.site-header { background: var(--surface); border-block-end: 1px solid var(--border); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.header-nav { display: flex; align-items: center; gap: 16px; font-size: 0.92rem; }
.header-nav > a { color: var(--text); text-decoration: none; }
.header-nav > a:hover { color: var(--accent); text-decoration: underline; }

/* Language switcher: a <details> dropdown, works without JS */
.lang-switch { position: relative; }
.lang-switch summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; user-select: none; font-weight: 600;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary svg { flex: none; }
.lang-menu {
  position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + 6px); z-index: 20;
  min-width: 180px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
}
.lang-menu a {
  display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; text-align: start;
}
.lang-menu a:hover { background: var(--accent-soft); }
.lang-menu a[aria-current] { font-weight: 700; color: var(--accent); }

/* Footer */
.site-footer { margin-block-start: 56px; border-block-start: 1px solid var(--border); color: var(--muted); font-size: 0.875rem; }
.site-footer .wrap { padding-block: 20px 32px; }
.site-footer p { margin: 0 0 8px; max-width: 70ch; }
.footer-countries { margin-block-end: 16px; }
.footer-countries h2 { font-size: 0.9rem; margin: 0 0 8px; color: var(--text); }
.footer-countries ul { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; }

/* Breadcrumbs */
.breadcrumbs { padding-block-start: 18px; font-size: 0.875rem; color: var(--muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li + li::before { content: "/"; margin-inline: 8px; color: var(--border); }
.breadcrumbs + .intro { padding-block-start: 12px; }

/* Intro and sections */
.intro { padding: 32px 0 20px; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.3rem); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 10px; }
.lede { margin: 0; color: var(--muted); max-width: 62ch; font-size: 1.05rem; }
.section { margin-block-start: 44px; }
.section h2, .faq h2 { font-size: 1.35rem; line-height: 1.3; margin: 0 0 14px; letter-spacing: -0.01em; }
.prose { max-width: 72ch; }
.prose h2 { margin-block-start: 32px; }
.prose h3 { font-size: 1.05rem; margin: 22px 0 8px; }
.prose ul { padding-inline-start: 22px; }
.prose li { margin-block-end: 6px; }
article.prose { padding-block-start: 12px; }

/* Calculator form */
.calculator {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 20px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; font-size: 0.9rem; margin: 0 0 8px; padding: 0; }
select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 76px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: pointer; user-select: none;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.calculator .submit { grid-column: 1 / -1; justify-self: start; }
.js .calculator .submit { display: none; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--accent); color: var(--accent); background: transparent;
  font: inherit; font-weight: 600; font-size: 0.9rem; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.button:hover { background: var(--accent-soft); }
.button-primary { background: var(--accent); color: var(--accent-text); }
.button-primary:hover { background: var(--accent); filter: brightness(1.07); }

/* Results */
.results-wrap { margin-block-start: 24px; transition: opacity 120ms; }
.results-wrap[aria-busy="true"] { opacity: 0.55; }
.summary-lead { font-size: 1.15rem; margin: 0 0 4px; }
.summary-meta { margin: 0; color: var(--muted); font-size: 0.9rem; }
.notice { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; font-size: 0.9rem; }
.notice-warn { background: var(--warn-bg); color: var(--warn-text); }
.disclosure {
  margin: 16px 0 12px; padding: 10px 12px; font-size: 0.85rem; color: var(--muted);
  border-inline-start: 3px solid var(--border); background: var(--surface);
  border-start-start-radius: 0; border-end-start-radius: 0; border-start-end-radius: 8px; border-end-end-radius: 8px;
}

.results {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.results th, .results td { padding: 14px 12px; text-align: start; vertical-align: middle; border-block-end: 1px solid var(--border); }
.results thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: var(--bg); }
html:lang(ar) .results thead th, html:lang(ur) .results thead th, html:lang(hi) .results thead th { letter-spacing: 0; font-size: 0.85rem; }
.results tbody tr:last-child > * { border-block-end: 0; }
.results .n { text-align: end; white-space: nowrap; }
.results abbr { text-decoration: underline dotted; cursor: help; }
.results tbody th { font-weight: 400; }
.results tr.is-best { background: var(--accent-soft); }
.provider { display: block; font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.badges:empty { display: none; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--border);
}
.badge-best { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.badge-promo { background: var(--promo-bg); color: var(--promo-text); border-color: transparent; }
.collected { display: block; font-size: 0.78rem; color: var(--muted); }
.strong { font-weight: 700; font-size: 1.05rem; }
.gap { display: block; font-size: 0.78rem; color: var(--muted); }
.better { color: var(--better); font-weight: 600; }
.action { text-align: end; width: 1%; }
.action .button { white-space: normal; text-align: center; min-width: 7.5em; line-height: 1.3; padding-block: 6px; }
/* Safety net: a long translation never pushes the page sideways. */
.results-wrap { overflow-x: auto; }

.caveats { margin-block-start: 14px; font-size: 0.85rem; color: var(--muted); max-width: 80ch; }
.caveats p { margin: 0 0 6px; }

.empty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.empty h2 { margin: 0 0 6px; font-size: 1.2rem; }
.empty p { margin: 0; color: var(--muted); }

/* Country cards (home) */
.country-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.country-card {
  display: flex; flex-direction: column; gap: 6px; height: 100%;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color 120ms, transform 120ms;
}
.country-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.country-card-name { font-weight: 700; font-size: 1.1rem; }
.country-card-detail { color: var(--muted); font-size: 0.9rem; }
.country-card-cta { margin-block-start: auto; color: var(--accent); font-weight: 600; font-size: 0.9rem; }

/* How it works */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.steps li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 28px; height: 28px; margin-block-end: 8px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.steps h3 { margin: 0 0 4px; font-size: 1rem; }
.steps p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* At a glance */
.glance { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.glance li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 0.92rem; }

/* Amount table */
.simple-table { width: 100%; max-width: 640px; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.simple-table th, .simple-table td { padding: 10px 12px; text-align: start; border-block-end: 1px solid var(--border); }
.simple-table thead th { font-size: 0.8rem; color: var(--muted); font-weight: 600; background: var(--bg); }
.simple-table tbody th { font-weight: 600; }
.simple-table .n { text-align: end; white-space: nowrap; }
.simple-table tr.is-current { background: var(--accent-soft); }

/* Other countries */
.pill-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pill-links a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text); text-decoration: none; font-weight: 600;
}
.pill-links a:hover { border-color: var(--accent); color: var(--accent); }

/* FAQ accordion: <details>/<summary>, one open at a time via a shared name */
.faq { margin-block-start: 44px; max-width: 80ch; }
.faq-list { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.faq-item + .faq-item { border-block-start: 1px solid var(--border); }
.faq-item summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px; cursor: pointer; font-weight: 600; min-height: 56px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { background: var(--bg); }
.faq-q { text-align: start; }
.faq-chevron { flex: none; color: var(--muted); transition: transform 200ms ease; }
.faq-item[open] .faq-chevron { transform: rotate(180deg); color: var(--accent); }
.faq-item[open] summary { color: var(--accent); }
.faq-a { padding: 0 18px 16px; color: var(--text); }
.faq-a p { margin: 0 0 10px; }
.faq-a p:last-child { margin-block-end: 0; }
/* Smooth open/close where supported (Chromium 131+); instant elsewhere. */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  .faq-item::details-content { block-size: 0; overflow: hidden; transition: block-size 220ms ease, content-visibility 220ms allow-discrete; }
  .faq-item[open]::details-content { block-size: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .faq-chevron, .country-card, .results-wrap { transition: none; }
  .faq-item::details-content { transition: none; }
}

/* Price history chart */
.history-intro { max-width: 72ch; color: var(--muted); margin: 0 0 12px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; padding: 0; list-style: none; font-size: 0.9rem; }
.chart-legend li { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: currentColor; }
.swatch-ref { height: 0; background: none; border-block-start: 2px dashed var(--muted); }
.s1 { color: var(--series-1); } .s2 { color: var(--series-2); } .s3 { color: var(--series-3); } .s4 { color: var(--series-4); }
.s5 { color: var(--series-5); } .s6 { color: var(--series-6); } .s7 { color: var(--series-7); } .s8 { color: var(--series-8); }
.chart {
  position: relative; margin: 0; padding: 12px 8px 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.chart svg { display: block; width: 100%; height: auto; overflow: visible; font: 12px var(--font); }
.chart .chart-narrow { display: none; font-size: 13px; }
@media (max-width: 600px) {
  .chart .chart-wide { display: none; }
  .chart .chart-narrow { display: block; }
}
.chart svg:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .baseline { stroke: var(--chart-axis); stroke-width: 1; }
.chart .axis-y text, .chart .axis-x text { fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.ref { stroke: var(--muted); stroke-dasharray: 5 4; stroke-width: 1.5; }
.chart .dot { fill: currentColor; stroke: var(--surface); stroke-width: 2; }
.chart .end-labels text { fill: var(--text); font-size: 12px; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart .hit { cursor: crosshair; }
.chart-tip {
  position: absolute; inset-block-start: 8px; z-index: 5; min-width: 180px; max-width: 260px;
  padding: 8px 10px; border-radius: 8px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 20px rgb(0 0 0 / 0.14);
  font-size: 0.82rem; line-height: 1.4;
}
.chart-tip .tip-time { color: var(--muted); margin-block-end: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; }
.chart-tip .tip-row .swatch { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.chart-tip .tip-row .swatch-ref { width: 10px; height: 0; border-radius: 0; }
.chart-tip .tip-name { flex: 1; color: var(--muted); }
.chart-tip .tip-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-note { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }
.chart-table { margin-block-start: 10px; }
.chart-table summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.92rem; }
.table-scroll { overflow-x: auto; margin-block-start: 10px; }
.table-scroll .simple-table { max-width: none; min-width: 480px; }

/* Price alert sign-up */
.alert-signup { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; max-width: 720px; }
.alert-signup h2 { margin-block-start: 0; }
.alert-signup > p { margin: 0 0 10px; max-width: 64ch; }
.alert-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: end; margin-block-start: 14px; }
.alert-form input[type="email"], .alert-form input[type="text"] {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.alert-form input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.alert-form input[aria-invalid="true"] { border-color: var(--warn-text); }
.alert-form .button { min-height: 44px; }
.hp { position: absolute !important; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }
.fine-print { margin: 12px 0 0 !important; font-size: 0.85rem; color: var(--muted); }
.status-page .lede + .lede { margin-block-start: 10px; }
.status-page form, .status-page p:has(.button) { margin-block-start: 20px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }

/* Narrow screens: form stacks, table rows become cards */
@media (max-width: 760px) {
  .calculator { grid-template-columns: 1fr; padding: 16px; }
  .chips { display: grid; grid-template-columns: repeat(3, 1fr); }
  .chip span { width: 100%; min-width: 0; }
  .header-nav > a { display: none; }
  .alert-form { grid-template-columns: 1fr; }
  .alert-signup { padding: 16px; }
  .chart { padding-inline: 2px; }
}

@media (max-width: 980px) {
  .results-wrap { overflow-x: visible; }
  .results, .results tbody, .results tr, .results th, .results td { display: block; }
  .results { border: 0; background: transparent; }
  .results thead { display: none; }
  .results tbody tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    margin-block-end: 12px; padding: 4px 0;
  }
  .results tr.is-best { background: var(--accent-soft); border-color: var(--accent); }
  .results tbody th, .results tbody td { border: 0; padding: 6px 14px; }
  .results tbody th { padding-block-start: 12px; }
  .results td[data-label] { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: end; }
  .results td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 0.85rem; text-align: start; }
  .results td[data-label] > .num, .results td[data-label] > span { text-align: end; }
  .results td.received { flex-wrap: wrap; }
  .results td.received .gap { flex-basis: 100%; }
  .action { width: auto; text-align: start; padding-block-end: 14px !important; }
  .action .button { width: 100%; min-height: 44px; }
}

/* ---- Private stats page (/admin/stats) ---- */
.admin-main { padding-block: 24px 48px; }
.admin-head h1 { margin: 0 0 4px; }
.admin-periods { display: flex; gap: 8px; margin-block: 12px 20px; }
.admin-periods a, .admin-periods span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; }
.admin-periods span { background: var(--accent-soft); font-weight: 600; }
.admin-flash { padding: 10px 14px; background: var(--accent-soft); border-radius: var(--radius); }
.admin-tiles { list-style: none; padding: 0; margin: 0 0 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.admin-tiles li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 4px; }
.tile-label { font-size: 0.85rem; color: var(--muted); }
.tile-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-note { font-size: 0.8rem; color: var(--muted); }
.admin-section { margin-block-end: 28px; }
.admin-section h2 { font-size: 1.15rem; margin: 0 0 8px; }
.admin-table { max-width: none; }
.admin-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 24px; }
.admin-bar { display: inline-block; inline-size: 120px; block-size: 8px; margin-inline-end: 8px; background: var(--chart-grid); border-radius: 4px; vertical-align: middle; overflow: hidden; }
.admin-bar > span { display: block; block-size: 100%; background: var(--series-1); border-radius: 4px; }
.admin-foot { font-size: 0.85rem; max-width: 70ch; }
