/* RAVAN web apps — brand: dark green / white / orange */
:root {
  --green: #0b5d3b;
  --green-dark: #084527;
  --green-light: #e6f2ec;
  --orange: #f58220;
  --orange-dark: #d96d0d;
  --ink: #1c2420;
  --muted: #6b7280;
  --bg: #f4f6f3;
  --card: #ffffff;
  --line: #e3e8e3;
  --danger: #c0392b;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
[dir="rtl"] body { font-family: "Vazirmatn", Tahoma, sans-serif; }
a { color: var(--green); }
button { font-family: inherit; cursor: pointer; }

/* ---------- header ---------- */
header.topbar {
  background: var(--green);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: 1px; cursor: pointer; }
.logo .mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--orange);
  display: flex; align-items: center; justify-content: center; font-size: 21px;
}
.logo small { display: block; font-size: 11px; font-weight: 400; opacity: .85; letter-spacing: 0; }
.topbar .spacer { flex: 1; }
.langsel { display: flex; gap: 4px; background: rgba(255,255,255,.15); border-radius: 999px; padding: 3px; }
.langsel button { border: 0; background: transparent; color: #fff; padding: 5px 10px; border-radius: 999px; font-size: 13px; }
.langsel button.active { background: #fff; color: var(--green); font-weight: 700; }
.iconbtn { border: 0; background: rgba(255,255,255,.15); color: #fff; border-radius: 999px; padding: 7px 12px; font-size: 13px; }

/* ---------- demo banner ---------- */
.demo-banner {
  background: #fff3cd; color: #664d03; border-bottom: 1px solid #ffecb5;
  padding: 8px 16px; font-size: 13px; text-align: center;
}
.demo-banner.hidden { display: none; }

/* ---------- layout ---------- */
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 14px 90px; }
.wrap.wide { max-width: 1020px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card h2 { margin: 0 0 6px; font-size: 20px; color: var(--green); }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 6px 0; color: #374151; line-height: 1.6; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; border: 0; border-radius: 12px; padding: 13px 20px;
  font-size: 16px; font-weight: 700; text-align: center; text-decoration: none;
  background: var(--green); color: #fff; width: 100%;
}
.btn:hover { background: var(--green-dark); }
.btn.orange { background: var(--orange); }
.btn.orange:hover { background: var(--orange-dark); }
.btn.ghost { background: #fff; color: var(--green); border: 2px solid var(--green); }
.btn.danger { background: var(--danger); }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.btnrow { display: flex; gap: 10px; }
.btnrow .btn { flex: 1; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px;
  font-size: 16px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--green); }
textarea { min-height: 90px; resize: vertical; }
.otpboxes { display: flex; gap: 8px; justify-content: center; margin: 18px 0; direction: ltr; }
.otpboxes input {
  width: 46px; height: 54px; text-align: center; font-size: 24px; font-weight: 700;
  border: 2px solid var(--line); border-radius: 12px;
}
.otpboxes input:focus { border-color: var(--orange); outline: none; }
.hint { background: #fff8ec; border: 1px dashed var(--orange); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 12px; }
.err { background: #fdecea; color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.err.hidden, .hidden { display: none !important; }
.okbox { background: var(--green-light); color: var(--green-dark); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }

/* ---------- role chooser ---------- */
.hero { text-align: center; padding: 26px 10px 6px; }
.hero .bigmark { font-size: 54px; }
.hero h1 { margin: 8px 0 4px; color: var(--green); font-size: 30px; }
.hero p { color: var(--muted); margin: 0; }
.rolegrid { display: grid; gap: 12px; margin-top: 20px; }
.rolecard {
  display: flex; gap: 14px; align-items: center; background: #fff; border: 2px solid var(--line);
  border-radius: var(--radius); padding: 16px; text-align: start; width: 100%;
}
.rolecard:hover { border-color: var(--orange); }
.rolecard .ic { font-size: 34px; }
.rolecard b { display: block; font-size: 18px; color: var(--green); }
.rolecard span { color: var(--muted); font-size: 14px; }

/* ---------- map ---------- */
.mapbox { height: 320px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); position: relative; }
.mapbox.small { height: 240px; }
.testbadge {
  position: absolute; top: 10px; inset-inline-start: 10px; z-index: 500;
  background: var(--orange); color: #fff; font-weight: 800; font-size: 12px;
  padding: 5px 10px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.leaflet-container { font-family: inherit; }

/* ---------- lists / places ---------- */
.place { display: flex; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; width: 100%; background: none; border-inline: 0; border-top: 0; text-align: start; }
.place:last-child { border-bottom: 0; }
.place:hover { background: #f8faf8; }
.place .pin { font-size: 20px; }
.place b { display: block; font-size: 15px; }
.place span { color: var(--muted); font-size: 13px; }

/* ---------- fare ---------- */
.farerow { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.farerow.total { font-weight: 800; font-size: 18px; border-bottom: 0; color: var(--green); }
.farerow .cur { font-size: 13px; color: var(--muted); }

/* ---------- badges / status ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.green { background: var(--green-light); color: var(--green-dark); }
.badge.orange { background: #ffedd5; color: #9a3412; }
.badge.red { background: #fdecea; color: var(--danger); }
.badge.grey { background: #eef0ee; color: #4b5563; }
.stars { font-size: 34px; letter-spacing: 4px; cursor: pointer; }
.stars span { color: #d1d5db; }
.stars span.on { color: var(--orange); }

/* ---------- driver card ---------- */
.drivercard { display: flex; gap: 14px; align-items: center; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--green-light); color: var(--green); font-size: 26px; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.drivercard b { font-size: 17px; display: block; }
.drivercard .meta { color: var(--muted); font-size: 13px; }
.spinner { width: 44px; height: 44px; border: 4px solid var(--green-light); border-top-color: var(--green); border-radius: 50%; margin: 18px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- tables (admin) ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.tbl th { color: var(--green); font-size: 13px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 26px; color: var(--green); }
.stat span { color: var(--muted); font-size: 13px; }
.adminlayout { display: flex; gap: 16px; align-items: flex-start; }
.adminnav { width: 200px; flex-shrink: 0; position: sticky; top: 70px; }
.adminnav button { display: block; width: 100%; text-align: start; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; font-size: 14px; }
.adminnav button.active { background: var(--green); color: #fff; border-color: var(--green); }
.adminmain { flex: 1; min-width: 0; }
@media (max-width: 720px) {
  .adminlayout { flex-direction: column; }
  .adminnav { width: 100%; position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .adminnav button { width: auto; flex: 1 1 40%; }
}

/* ---------- bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line);
  display: flex; z-index: 1000; padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav button { flex: 1; border: 0; background: none; padding: 10px 4px 8px; font-size: 12px; color: var(--muted); }
.bottomnav button.active { color: var(--green); font-weight: 700; }
.bottomnav .ic { display: block; font-size: 20px; }

/* ---------- toggle ---------- */
.switch { position: relative; display: inline-block; width: 58px; height: 32px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cbd5d1; border-radius: 999px; transition: .2s; }
.slider:before { content: ""; position: absolute; width: 24px; height: 24px; left: 4px; top: 4px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider:before { transform: translateX(26px); }
[dir="rtl"] .switch input:checked + .slider:before { transform: translateX(-26px); }
