/* ---- Fonts ----------------------------------------------------------
   Vazirmatn — Persian/Farsi UI (bundled woff2). DIN — picked up via
   the system locally if the user has it installed (no shipped woff2:
   it's a licensed font, can't be bundled). When DIN is absent the
   font-family stack just falls through to the next sans option. */
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Regular.49c0cc018008.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Bold.51265c214faf.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-2: #1b2026;
  --border: #2a3038;
  --text: #e8eaed;
  --muted: #9aa3ad;
  --accent: #6cf;
  --accent-2: #4af;
  --success: #5fdc8b;
  --danger: #ff6b6b;
  --warn: #ffd166;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font-family: "DIN", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Vazirmatn", sans-serif;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { margin: 0.5rem 0 1rem 0; font-size: 1.6rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.5rem 0; }
h3 { font-size: 1.05rem; margin: 0 0 0.5rem 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.big { font-size: 1.6rem; font-weight: 600; margin: 0.25rem 0 0.75rem 0; }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 60ch; }

/* layout */
.container { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.topnav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.65rem 1.25rem; border-bottom: 1px solid var(--border);
  background: var(--panel); position: sticky; top: 0; z-index: 10;
  gap: 0.5rem;
}
.brand { font-weight: 700; color: var(--text); }
.nav-links {
  display: flex; gap: 0.6rem 1rem; align-items: center; flex-wrap: wrap;
  /* On narrow screens we let the nav scroll horizontally instead of
     wrapping into 4 ragged rows. */
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.nav-links a {
  color: var(--muted);
  white-space: nowrap;
  padding: 0.35rem 0.55rem;        /* roomier touch target */
  border-radius: 4px;
}
/* Hover state visible against the dark --panel background — the previous
   rgba(...,0.08) was indistinguishable from the navbar fill. */
.nav-links a:hover,
.nav-links .link-btn:hover {
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.22);
}
.nav-links .link-btn {
  padding: 0.35rem 0.55rem;        /* match link padding so logout / lang look like nav items */
  border-radius: 4px;
}
.lang-switch .link-btn { padding: 0.35rem 0.6rem; }
.balance { font-weight: 600; color: var(--accent); }

/* Mobile: stack brand above nav; bigger touch targets on every clickable. */
@media (max-width: 760px) {
  .topnav {
    flex-direction: column; align-items: stretch; padding: 0.5rem 0.75rem;
  }
  .nav-links {
    justify-content: flex-start;
    padding: 0.25rem 0; gap: 0.4rem 0.7rem;
    flex-wrap: nowrap;               /* horizontal scroll instead of multi-row wrap */
  }
  .nav-links a, .nav-links .link-btn {
    font-size: 0.95rem; padding: 0.5rem 0.7rem;
  }
}

/* Mobile: any wide table inside a .card gets a horizontal scroll instead
   of breaking the layout. */
@media (max-width: 760px) {
  .card { overflow-x: auto; }
}

/* -------- Plan switch — iPhone-style sliding track (Economy / Ultimate) -------- */
/* Form + button wrappers inherit the same pill radius as the track so the
   click target and any focus ring follow the same curve. */
.plan-switch { display: inline-flex; margin: 0; border-radius: 999px; }
.plan-switch-btn {
  background: transparent; border: 0; padding: 0; cursor: pointer;
  border-radius: 999px;
}
.plan-track {
  position: relative;
  display: inline-flex; align-items: center;
  width: 168px; height: 32px;
  background: #e6e9ef;        /* light track so black labels stay readable */
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  user-select: none;
}
/* The sliding pill that highlights the active half. Thumb fills the track
   edge-to-edge (top:0/bottom:0) so its corners share the SAME effective
   radius as the track — no visual mismatch between inner and outer curves.
   Colour is hardcoded per side (NOT via --accent) so the switch keeps
   showing blue=Economy and gold=Ultimate even when the body theme already
   changed. */
.plan-thumb {
  position: absolute; top: 0; bottom: 0;
  width: 50%;
  border-radius: 999px;
  transition: inset-inline-start 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
/* Thumb tracks its label: in LTR Economy is the first/left half, in RTL the
   first half is visually on the right — inset-inline-start handles both. */
.plan-switch.plan-economy  .plan-thumb { inset-inline-start: 0;   background: #6cf;    }
.plan-switch.plan-ultimate .plan-thumb { inset-inline-start: 50%; background: #ffd166; }

.plan-label {
  position: relative; z-index: 1;
  flex: 1; text-align: center;
  font-size: 0.78rem; font-weight: 700;
  color: #000;             /* both labels always black, on coloured + neutral halves */
  padding: 0 0.4rem;
}
.plan-track:hover { background: #eef0f5; }

/* Ultimate paints the whole app in a premium gold accent. Every
   var(--accent) consumer (buttons, links, balance, pills, the thumb
   itself) inherits the new colour. */
body[data-plan="ultimate"] {
  --accent:   #ffd166;   /* warm gold */
  --accent-2: #ffb454;   /* gold-orange for hover */
}

/* cards & grid */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 1.1rem; margin: 0.75rem 0;
}
.card.narrow { max-width: 480px; margin: 2rem auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; margin: 1rem 0; }
@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* hero (home) */
.hero { padding: 2rem 0 1rem; }
.hero h1 { font-size: 2.5rem; margin: 0; }
.cta-row { display: flex; gap: 0.75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.features {
  display: grid; gap: 1rem; grid-template-columns: 1fr 1fr;
  margin: 2rem 0;
}
.feature {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 1rem;
}
@media (max-width: 760px) { .features { grid-template-columns: 1fr; } }
.pricing { margin: 2rem 0; }

/* forms — all text-like inputs share the same styled shell. Without
   `tel`/`url`/`search` here the contact-form phone field falls back to
   browser default and looks alien next to the other rows. */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=url], input[type=search], input[type=date],
textarea, select {
  width: 100%; padding: 0.55rem 0.7rem;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font: inherit; outline: none;
  /* On the RTL Persian site, let each field flow in the direction of what
     the user actually types (Persian RTL, emails/URLs/numbers LTR). The
     caret then tracks the typed text and scrolls with it, so a long value
     doesn't look like it hit a character limit. */
  unicode-bidi: plaintext;
  text-overflow: clip;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 0.85rem; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
.field input + small { display: block; margin-top: 0.25rem; }

/* buttons */
button, .btn-primary, .btn-ghost, .btn-mini {
  display: inline-block; padding: 0.55rem 1rem; border: 0; border-radius: 6px;
  font: inherit; cursor: pointer; text-decoration: none;
}
.btn-primary, button[type=submit] { background: var(--accent); color: #00171f; font-weight: 600; }
.btn-primary:hover, button[type=submit]:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-mini { background: var(--panel-2); color: var(--text); padding: 0.35rem 0.75rem; font-size: 0.9rem; border: 1px solid var(--border); }
.btn-mini:hover { border-color: var(--accent); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.link-btn { background: none; color: var(--accent); padding: 0; cursor: pointer; }
form.inline { display: inline; }
.quick-amounts { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.5rem 0 1rem 0; }
.quick-amounts button { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); padding: 0.35rem 0.75rem; font-size: 0.85rem; }

/* tables */
table.compact, table.programs-table, table.kv {
  width: 100%; border-collapse: collapse; font-size: 0.92rem;
}
/* Long opportunity lists scroll INSIDE this wrapper instead of growing the
   page — header stays in view, filters and pagination stay reachable. */
.table-scroll {
  max-height: calc(100vh - 320px);
  min-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0.6rem 0;
}
.table-scroll table.programs-table { margin: 0; }
.table-scroll table.programs-table thead th {
  position: sticky; top: 0;
  background: var(--panel);
  z-index: 1;
}
table.compact th, table.compact td,
table.programs-table th, table.programs-table td,
table.kv th, table.kv td {
  padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top;
}
table.compact th, table.programs-table th { color: var(--muted); font-weight: 500; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
table.kv th { width: 30%; color: var(--muted); font-weight: 500; }

/* pills */
.pill { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 0.78rem; color: var(--muted); }
.pill-success { color: var(--success); border-color: var(--success); }
.pill-pending { color: var(--warn); border-color: var(--warn); }
.pill-failed { color: var(--danger); border-color: var(--danger); }

/* opportunity status colors — class is `status-<slug>` */
.status-interested  { color: var(--accent);  border-color: var(--accent); }
.status-researching { color: var(--accent-2); border-color: var(--accent-2); }
.status-contacted   { color: #b389ff; border-color: #b389ff; }   /* violet */
.status-applied     { color: var(--warn); border-color: var(--warn); }
.status-interview   { color: #ffb454; border-color: #ffb454; background: rgba(255,180,84,0.08); }
.status-offer       { color: var(--success); border-color: var(--success); }
.status-accepted    { color: #001b0a; background: var(--success); border-color: var(--success); font-weight: 600; }
.status-rejected    { color: var(--danger); border-color: var(--danger); }
.status-withdrawn   { color: var(--muted); border-color: var(--muted); opacity: 0.75; text-decoration: line-through; }

/* result */
.result {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 1rem; margin: 1rem 0; max-height: 60vh; overflow: auto;
  white-space: pre-wrap; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.9rem;
}
.code-block {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.85rem; font-family: ui-monospace, monospace; font-size: 0.85rem;
  white-space: pre-wrap; overflow-x: auto; margin: 0.5rem 0;
}
code { background: var(--panel-2); padding: 0.05rem 0.35rem; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 0.85em; }

/* tool cards */
.tool-card { display: block; transition: border-color 0.15s; }
.tool-card:hover { border-color: var(--accent); text-decoration: none; }

/* filters / pager */
.filters { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 200px; flex: 0 1 auto; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: 1rem 0; }

/* flash */
.flash { list-style: none; padding: 0; margin: 0.75rem 1.25rem; }
.flash li {
  padding: 0.55rem 0.85rem; border-radius: 6px; margin-bottom: 0.4rem;
  border: 1px solid var(--border); background: var(--panel);
}
.flash-success { color: var(--success); border-color: var(--success); }
.flash-error, .flash-danger { color: var(--danger); border-color: var(--danger); }
.flash-warning { color: var(--warn); border-color: var(--warn); }

.alert-success { border-color: var(--success); }

footer.container { padding-top: 2rem; border-top: 1px solid var(--border); margin-top: 2rem; }
