/* Self-hosted Vazirmatn — no external CDN (must work behind filtering).
   font-display: swap → text renders immediately in Tahoma, swaps to Vazir when ready. */
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 400;
  src: url("/fonts/Vazirmatn-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 500;
  src: url("/fonts/Vazirmatn-Medium.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 600;
  src: url("/fonts/Vazirmatn-SemiBold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 700;
  src: url("/fonts/Vazirmatn-Bold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 800 900;
  src: url("/fonts/Vazirmatn-Black.woff2") format("woff2"); font-display: swap; }

:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --ink: #16242e;
  --muted: #6b7c88;
  --line: #e4eaee;
  --primary: #0e8f8a;        /* medical teal */
  --primary-dark: #0a6f6b;
  --primary-soft: #e3f4f3;
  --accent: #f0843e;
  --danger: #d65745;
  --night: #3d4f9e;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(16, 40, 50, .06);
  --shadow-lg: 0 8px 28px rgba(16, 40, 50, .10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 15px;
}

a { color: inherit; text-decoration: none; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; flex: 0 0 auto; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--primary); color: #fff; font-weight: 900; font-size: 22px;
}
.brand-mark.sm { width: 24px; height: 24px; font-size: 17px; border-radius: 7px; }

/* nav + actions share a flex wrapper so the desktop layout is unchanged
   and the whole thing can collapse into a dropdown on mobile. */
.nav-collapse { display: flex; align-items: center; gap: 18px; flex: 1; }
.main-nav { display: flex; gap: 18px; margin-inline-start: 6px; flex: 1; }
.main-nav a { color: var(--muted); font-weight: 600; font-size: 15px; white-space: nowrap; transition: color .15s; }
.main-nav a:hover { color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }
.nav-action { font-weight: 600; font-size: 15px; color: var(--muted); white-space: nowrap; transition: color .15s; }
.nav-action:hover { color: var(--primary); }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* Bell: icon-only on desktop (label shows inside the mobile dropdown). */
.bell-inline { display: inline-flex; align-items: center; gap: 6px; position: relative; font-size: 18px; }
.bell-inline .bell-label { display: none; }

/* Hamburger + mobile-only bell — hidden on desktop */
.nav-burger, .bell-mobile { display: none; }
.nav-burger {
  margin-inline-start: auto; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 9px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
}
.nav-burger span { display: block; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .2s, opacity .2s; }
.nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
.nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.bell-mobile { position: relative; font-size: 20px; margin-inline-start: auto; line-height: 1; }

/* ---------- Live notification toasts (SSE) ---------- */
.toast-host {
  position: fixed; inset-block-end: 16px; inset-inline-start: 16px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--primary);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.16); color: var(--ink);
  opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ico { font-size: 18px; line-height: 1.4; }
.toast-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toast-body strong { font-size: 14px; }
.toast-body span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Buttons ---------- */
/* Browsers do NOT inherit font-family on <button>/<input> — without this they render
   Persian text in the UA default font (Tahoma/Arial), which clashes with Vazirmatn. */
button, input, select, textarea, optgroup { font-family: inherit; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
  padding: 9px 18px; border-radius: 10px; font-weight: 700; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #d96f28; }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 13px 26px; font-size: 16px; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #0e8f8a 0%, #0a6f6b 100%);
  color: #fff; padding: clamp(40px, 8vw, 64px) 0 clamp(48px, 9vw, 80px); text-align: center;
}
.hero h1 { font-size: clamp(23px, 5.5vw, 34px); font-weight: 900; margin: 0 0 14px; line-height: 1.45; }
.hero p { font-size: clamp(15px, 3.2vw, 17px); opacity: .92; max-width: 620px; margin: 0 auto 30px; }

/* search box on hero */
.search-card {
  background: var(--surface); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 18px; max-width: 860px; margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 12px; align-items: end;
}
.search-card .field { display: flex; flex-direction: column; gap: 5px; text-align: start; }
.search-card label { font-size: 12px; font-weight: 700; color: var(--muted); }

/* ---------- Forms ---------- */
select, textarea,
input[type="text"], input[type="tel"], input[type="number"], input[type="password"],
input[type="email"], input[type="url"], input[type="search"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 17px; height: 17px; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); }
label { font-size: 13px; }

/* ---------- Sections / grid ---------- */
.section { padding: 48px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.section-head h2 { font-size: clamp(19px, 4.2vw, 23px); font-weight: 800; margin: 0; }
.section-head a { color: var(--primary); font-weight: 700; font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card-pad { padding: 18px; }

.shift-card { display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, transform .15s; }
.shift-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.shift-card .facility { font-weight: 800; font-size: 16px; overflow-wrap: anywhere; }
.shift-card .row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; color: var(--muted); font-size: 13.5px; }
.shift-card .pay { font-weight: 800; color: var(--primary-dark); font-size: 14px; overflow-wrap: anywhere; }
.shift-card .foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.shift-card .foot .pay { flex: 1; min-width: 0; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-day { background: #fff4e8; color: #c5670f; }
.badge-evening { background: #fdeede; color: #b25c12; }
.badge-night { background: #e9ecfb; color: var(--night); }
.badge-oncall { background: #f0eaf6; color: #6b3fa0; }
.badge-verified { background: var(--primary-soft); color: var(--primary-dark); }
.badge-type { background: #eef3f6; color: var(--muted); }
.badge-distance { background: #fff1e8; color: #c5670f; }
.badge-job { background: #eaf3ff; color: #2563eb; }
.badge-gender { background: #f3eefb; color: #6b3fa0; }

/* ---------- Filters layout ---------- */
.layout-2 { display: grid; grid-template-columns: 270px 1fr; gap: 24px; align-items: start; }
.filter-card { position: sticky; top: 84px; }
.filter-card h3 { font-size: 15px; margin: 0 0 14px; }
.filter-group { margin-bottom: 16px; }
.filter-group > label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }

/* ---------- Calendar ---------- */
.cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cal { width: 100%; min-width: 660px; border-collapse: separate; border-spacing: 8px; }
.cal th { font-size: 13px; color: var(--muted); font-weight: 700; padding-bottom: 6px; }
.cal td {
  vertical-align: top; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px; height: 130px; width: 14.28%;
}
.cal .day-num { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.cal td.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.cal td.empty { background: #fafcfc; }
.cal-chip {
  display: block; font-size: 12px; padding: 4px 7px; border-radius: 7px;
  margin-bottom: 5px; font-weight: 700; border: 1px solid transparent;
}
.cal-chip.day { background: #fff4e8; color: #c5670f; }
.cal-chip.evening { background: #fdeede; color: #b25c12; }
.cal-chip.night { background: #e9ecfb; color: var(--night); }
.cal-chip.oncall { background: #f0eaf6; color: #6b3fa0; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }

/* ---------- Misc ---------- */
.page-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: clamp(20px, 5vw, 28px) 0; }
.page-head h1 { margin: 0; font-size: clamp(20px, 4.6vw, 26px); line-height: 1.4; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.info-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--muted); }
.info-row .v { font-weight: 700; }
.stat-pills { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 26px; }
.stat-pill { background: rgba(255,255,255,.14); border-radius: 12px; padding: 12px 20px; }
.stat-pill .n { font-size: 24px; font-weight: 900; display: block; }
.stat-pill .l { font-size: 13px; opacity: .9; }
.site-footer { background: var(--surface); border-top: 1px solid var(--line); margin-top: 48px; padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-inner p { margin: 4px 0 0; font-size: 13px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 8px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--primary); }

/* ---------- Guided tour ---------- */
.tour-overlay { position: fixed; inset: 0; z-index: 1000; }
.tour-hole {
  position: fixed; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(13,30,40,.62);
  outline: 2px solid var(--accent); transition: all .2s ease;
}
.tour-bubble {
  position: fixed; z-index: 1001; background: var(--surface); color: var(--ink);
  border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.28);
  padding: 16px; max-width: 320px;
}
.tour-title { font-weight: 800; font-size: 16px; margin-bottom: 6px; }
.tour-text { font-size: 14px; color: var(--muted); line-height: 1.9; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.tour-count { font-size: 12px; color: var(--muted); }
.tour-btns { display: flex; gap: 6px; }

/* ---------- Mobile sticky action bar (detail pages feel like a native app) ---------- */
.mobile-action-bar { display: none; }
@media (max-width: 860px) {
  .mobile-action-bar {
    display: flex; gap: 8px; align-items: stretch;
    position: fixed; inset-inline: 0; bottom: 0; z-index: 95;
    padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(0,0,0,.10);
  }
  .mobile-action-bar form { margin: 0; }
  .mobile-action-bar .cta-main { flex: 1; }
  .mobile-action-bar .btn { margin: 0; }
  /* breathing room so the fixed bar never covers page content */
  .has-action-bar { padding-bottom: 92px; }
  /* the in-aside primary CTA is redundant on mobile — the sticky bar replaces it */
  .aside-apply { display: none; }
}

/* ---------- Admin settings: sidebar tabs ---------- */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.settings-tabs {
  position: sticky; top: 80px; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px;
}
.settings-tabs button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: start;
  padding: 11px 12px; border: none; background: transparent; border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.settings-tabs button:hover { background: var(--primary-soft); color: var(--primary-dark); }
.settings-tabs button.active { background: var(--primary); color: #fff; }
.settings-tabs .tab-ico { font-size: 16px; }

.settings-panel { display: none; }
.settings-panel.active { display: block; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.settings-panel h3:first-child { margin-top: 0; }

/* Toggle rows — give each boolean field a clean, card-like row. */
.toggle-row {
  display: flex; align-items: flex-start; gap: 10px; font-weight: 700;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  cursor: pointer; margin-bottom: 4px;
}
.toggle-row input[type="checkbox"] { margin-top: 2px; flex: 0 0 auto; }
.toggle-row .t-body { display: flex; flex-direction: column; gap: 3px; }
.toggle-row .t-hint { font-size: 12px; font-weight: 500; color: var(--muted); }
.settings-save { position: sticky; bottom: 0; padding-top: 12px; background: linear-gradient(transparent, var(--bg) 40%); }
.proxy-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.proxy-toggle input { width: 15px; height: 15px; }

@media (max-width: 760px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { position: static; flex-direction: row; overflow-x: auto; }
  .settings-tabs button { white-space: nowrap; }
}

/* Legal/policy pages (privacy, rules, terms) — comfortable long-form reading. */
.legal { line-height: 2; }
.legal h2 { font-size: 17px; margin: 22px 0 8px; color: var(--primary-dark); }
.legal h2:first-of-type { margin-top: 4px; }
.legal p { margin: 0 0 10px; }
.legal ul { margin: 0 0 12px; padding-inline-start: 22px; }
.legal li { margin-bottom: 6px; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.alert-success { background: var(--primary-soft); color: var(--primary-dark); }

/* notification bell badge */
.bell-badge { position:absolute; top:-6px; inset-inline-start:-8px; background:var(--accent); color:#fff;
  font-size:10px; font-weight:800; min-width:16px; height:16px; line-height:16px; text-align:center;
  border-radius:999px; padding:0 3px; }

/* account-type chooser on login */
.acct-toggle { display: flex; gap: 10px; }
.acct-opt { flex: 1; display: block; cursor: pointer; }
.acct-opt input { position: absolute; opacity: 0; }
.acct-opt span { display: block; text-align: center; padding: 12px 8px; border: 1.5px solid var(--line);
  border-radius: 12px; font-weight: 700; font-size: 14px; transition: all .15s; }
.acct-opt span small { font-weight: 400; color: var(--muted); font-size: 11px; }
.acct-opt input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }

/* hour-range timeline bar */
.hourbar-wrap { direction: ltr; margin: 6px 0 2px; }
.hourbar {
  position: relative; height: 9px; background: #eef3f6;
  border-radius: 999px; overflow: hidden;
}
.hourbar-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,.06); }
.hourbar-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.hourbar-fill.day { background: #f0a052; }
.hourbar-fill.evening { background: #e07b3a; }
.hourbar-fill.night { background: #5566c4; }
.hourbar-fill.oncall { background: linear-gradient(90deg, #8a5cc0 25%, #b79be0 50%, #8a5cc0 75%); }
.hourbar-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 3px; }

/* recommendation reason chips */
.rec-reasons { display: flex; flex-direction: column; gap: 4px; margin: 2px 0; }
.rec-reason { font-size: 12px; color: var(--primary-dark); font-weight: 600; }
.rec-banner { background: linear-gradient(135deg,#0e8f8a 0%,#0a6f6b 100%); color:#fff;
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; display:flex;
  align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.rec-banner .btn-outline { border-color:#fff; color:#fff; }
.rec-banner .btn-outline:hover { background: rgba(255,255,255,.15); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .search-card { grid-template-columns: 1fr 1fr; }
  .layout-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .filter-card { position: static; }

  /* Header: brand + bell + hamburger on one row; menu drops down below. */
  .header-inner { height: 60px; gap: 10px; }
  .nav-burger { display: flex; }
  .bell-mobile { display: inline-flex; align-items: center; }

  /* Collapsed dropdown panel — hidden until the burger is toggled. */
  .nav-collapse {
    position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(0,0,0,.08);
    max-height: 0; overflow: hidden; visibility: hidden;
    transition: max-height .25s ease, visibility .25s;
  }
  .nav-toggle:checked ~ .nav-collapse { max-height: 80vh; overflow-y: auto; visibility: visible; }

  .main-nav { flex-direction: column; gap: 0; margin: 0; flex: none; padding: 6px 0; }
  .main-nav a { padding: 13px 20px; font-size: 15px; border-bottom: 1px solid var(--line); }
  .main-nav a:last-child { border-bottom: none; }

  .header-actions {
    flex-direction: column; align-items: stretch; gap: 0;
    margin: 0; padding: 8px 14px 16px; border-top: 1px solid var(--line);
  }
  .nav-action { padding: 12px 6px; font-size: 15px; }
  .bell-inline { font-size: 15px; }
  .bell-inline .bell-label { display: inline; }
  .header-actions .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 6px; }

  .cal { border-spacing: 4px; }
  .cal td { height: auto; min-height: 80px; padding: 6px; }
}
@media (max-width: 520px) {
  .container { padding: 0 14px; }
  .grid-3, .grid-4, .search-card { grid-template-columns: 1fr; }
  .section { padding: 32px 0; }
  .btn-lg { padding: 12px 20px; font-size: 15px; }
  .stat-pill { padding: 10px 16px; }
  .stat-pill .n { font-size: 20px; }
  /* Tighten in-card action rows so buttons don't overflow */
  .rec-banner { padding: 16px; }
}
