/* Alipur One — "Sage & Paper" design system (design_handoff_alipur_one).
   One brand green on warm paper neutrals; hairline borders, not shadows
   (shadows only on FAB + toast). Bilingual pairs: English bold + Urdu soft. */

:root {
  /* brand */
  --green-050:#EDF2EE; --green-100:#D8E2D9; --green-600:#2E6B5A; /* primary */
  --green-700:#245448; --green-900:#16332C;
  /* paper */
  --paper:#F6F5F0; --surface:#FFFFFF; --border:#E7E4DB; --divider:#F0EEE6;
  --ink:#1C2420; --ink-soft:#8A8578; --ink-40:#B9B4A5;
  /* semantic */
  --amber-500:#C98A2D; --amber-tint:#F6E9CB; --amber-line:#E6CE8E; --amber-text:#5C440E; --amber-700:#8A6414;
  --red-500:#C6473E;  --red-tint:#FBEDEA;  --red-line:#EFCFC8;  --red-text:#7A3B34;
  --blue-500:#3E6FA8; --blue-tint:#E8EFF7; --blue-text:#2C5079;
  /* shape & space */
  --r-chip:10px; --r-field:14px; --r-tile:16px; --r-card:18px; --r-hero:22px; --r-pill:999px;
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px; /* screen margin */ --sp-6:32px;
  /* elevation (floating only) */
  --shadow-fab:0 4px 12px rgba(46,107,90,.35); --shadow-toast:0 8px 24px rgba(28,36,32,.28);
  /* motion */
  --t-fast:150ms; --t-std:250ms; --t-gentle:400ms; --ease:cubic-bezier(.2,.7,.3,1);
  /* shell */
  --nav-h: 76px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  overscroll-behavior-y: contain;
}

/* Phone-sized shell centered on larger screens */
#app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
}
@media (min-width: 520px) {
  #app-shell { border-inline: 1px solid var(--border); }
}

#app-content {
  flex: 1;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}
body.nav-hidden #app-content { padding-bottom: var(--safe-bottom); }

a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; text-align: inherit; }

/* ---------- Type ---------- */
.t-display { font-size: 24px; line-height: 30px; font-weight: 800; letter-spacing: -.5px; }
.t-title   { font-size: 21px; line-height: 27px; font-weight: 800; letter-spacing: -.3px; }
.t-section { font-size: 15px; line-height: 20px; font-weight: 800; }
.t-strong  { font-size: 12.5px; line-height: 17px; font-weight: 700; }
.t-body    { font-size: 12px;  line-height: 17px; font-weight: 500; }
.t-caption { font-size: 10.5px; line-height: 15px; font-weight: 500; color: var(--ink-soft); }
.t-overline{ font-size: 10.5px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }

/* Urdu: Nastaliq, always dir=rtl on the node, generous line-height. */
.ur {
  font-family: 'Noto Nastaliq Urdu', serif;
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 1.8;
  font-weight: 400;
}
.ur-label { font-size: 10.5px; line-height: 1.7; color: var(--ink-soft); }
.ur-body  { font-size: 13.5px; line-height: 1.9; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Material Symbols ---------- */
.msr {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  display: inline-block;
  letter-spacing: normal;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 1;
  user-select: none;
}
.msr.o { font-variation-settings: 'FILL' 0; }

/* ---------- Pressables ---------- */
.tap { cursor: pointer; transition: filter var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.tap:active { filter: brightness(.92); }
@media (hover: hover) { .tap:hover { filter: brightness(.96); } }

/* ---------- Cards, rows, dividers ---------- */
.ac-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.ac-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-tile); }
.ac-divider { height: 1px; background: var(--divider); margin: 0 14px; }

.ac-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 9px 14px; }

/* Icon tile (leading square) */
.ac-icotile {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: var(--green-050);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Screen header (back circle + title) ---------- */
.ac-header { display: flex; align-items: center; gap: 12px; padding: 14px 20px 10px; }
.ac-back {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.ac-header-titles { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ac-header-titles .en { font-size: 17px; font-weight: 800; }
.ac-header-titles .ur { font-size: 11px; line-height: 1.7; color: var(--ink-soft); align-self: flex-start; }

/* ---------- Buttons ---------- */
.ac-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-pill); padding: 14px; width: 100%;
  background: var(--green-600); color: #fff;
  font-size: 13.5px; font-weight: 800;
  transition: filter var(--t-fast) var(--ease);
}
.ac-btn:active { filter: brightness(.92); }
.ac-btn:disabled { background: var(--green-050); color: var(--ink-40); }
.ac-btn.secondary { background: var(--surface); color: var(--green-700); border: 1px solid var(--green-100); }
.ac-btn.destructive-outline { background: var(--surface); color: var(--red-500); border: 1.5px solid var(--red-500); }
.ac-btn.sm { width: auto; padding: 8px 13px; font-size: 11.5px; }

.ac-iconbtn {
  position: relative; width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.ac-iconbtn .badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--red-500); color: #fff; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--paper);
}

/* ---------- Status badge (pill 10/800) ---------- */
.ac-badge {
  display: inline-block; border-radius: var(--r-pill); padding: 4px 9px;
  font-size: 10px; font-weight: 800; white-space: nowrap;
}
.ac-badge.amber { background: var(--amber-tint); color: var(--amber-700); }
.ac-badge.blue  { background: var(--blue-tint);  color: var(--blue-text); }
.ac-badge.green { background: var(--green-050);  color: var(--green-700); }
.ac-badge.red   { background: var(--red-tint);   color: var(--red-text); }
/* Small square tag (carousel/news) */
.ac-tag {
  display: inline-block; align-self: flex-start; border-radius: 6px; padding: 3px 7px;
  font-size: 9px; font-weight: 800; letter-spacing: .8px;
}

/* ---------- Banners & notes ---------- */
.ac-banner {
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--r-field); padding: 10px 12px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
}
.ac-banner.warning { background: var(--amber-tint); border: 1px solid var(--amber-line); color: var(--amber-text); }
.ac-banner.danger  { background: var(--red-tint); border: 1px solid var(--red-line); color: var(--red-text); }
.ac-banner.info    { background: var(--green-050); color: var(--green-700); }

.ac-note {
  display: flex; align-items: center; gap: 8px;
  background: var(--green-050); border-radius: 12px; padding: 10px 12px;
  font-size: 11px; color: var(--green-700); line-height: 1.4;
}
.ac-note.amber { background: var(--amber-tint); color: var(--amber-text); }

/* ---------- Search bar ---------- */
.ac-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 12px 16px;
}
.ac-search input {
  flex: 1; border: 0; outline: 0; background: none; min-width: 0;
  font: 500 13px 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--ink);
}
.ac-search input::placeholder { color: var(--ink-soft); }

/* ---------- Form fields ---------- */
.ac-field {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-field); padding: 12px 14px;
  font: 500 12.5px/1.5 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--ink);
  outline: none;
}
.ac-field:focus { border-color: var(--green-600); }
textarea.ac-field { resize: vertical; min-height: 76px; }
select.ac-field { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238A8578' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; padding-right: 34px; }
.ac-label { font-size: 12px; font-weight: 700; margin-bottom: 6px; display: block; }

/* ---------- Location filter — searchable dropdown (buses screen) ---------- */
/* Hairline surfaces per the design; a soft float only while the menu is open. */
.ac-locfilter { position: relative; }
.ac-locfilter-trigger {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-field); padding: 11px 12px; cursor: pointer;
  font: 600 12.5px/1.5 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--ink);
}
.ac-locfilter-trigger[aria-expanded="true"] { border-color: var(--green-600); }
.ac-locfilter-value { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-locfilter-value .ur { font-size: 11px; color: var(--ink-soft); }
.ac-locfilter-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-field); overflow: hidden;
  box-shadow: 0 8px 24px rgba(28, 36, 32, .12);
}
.ac-locfilter-search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--divider);
}
.ac-locfilter-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: 500 13px 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--ink);
}
.ac-locfilter-search input::placeholder { color: var(--ink-soft); }
.ac-locfilter-list { list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow-y: auto; }
.ac-locopt {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px; border-radius: 10px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.ac-locopt[hidden] { display: none; }
.ac-locopt .ur { font-size: 11px; color: var(--ink-soft); }
.ac-locopt:hover { background: var(--paper); }
.ac-locopt.on { background: var(--green-050); color: var(--green-700); }
.ac-locopt.on .ur { color: var(--green-700); }

/* ---------- Service tiles (4-per-row) ---------- */
.ac-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 20px; }
.ac-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ac-service {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-tile);
  padding: 12px 4px 9px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.ac-service .en { font-size: 10.5px; font-weight: 700; text-align: center; }
.ac-service .ur { font-size: 10.5px; line-height: 1.7; color: var(--ink-soft); }
.ac-service.hi { background: var(--green-050); border-color: var(--green-100); }

/* ---------- Section headers ---------- */
.ac-section { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 20px 10px; }
.ac-section .pair { display: flex; align-items: baseline; gap: 8px; }
.ac-section .link { font-size: 11.5px; font-weight: 700; color: var(--green-600); cursor: pointer; }

/* ---------- Carousel ---------- */
.ac-carousel {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  border-radius: var(--r-card); scrollbar-width: none;
}
.ac-carousel::-webkit-scrollbar { display: none; }
.ac-slide {
  flex: 0 0 100%; scroll-snap-align: start; min-height: 126px;
  border-radius: var(--r-card); padding: 14px;
  display: flex; gap: 12px; align-items: stretch;
}
.ac-dots { display: flex; justify-content: center; gap: 5px; margin-top: 8px; }
.ac-dots span { height: 6px; border-radius: 3px; width: 6px; background: #D8D4C6; transition: all var(--t-std) var(--ease); }
.ac-dots span.on { width: 18px; background: var(--green-600); }

/* ---------- Chips (filters / time slots) ---------- */
.ac-chiprow { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.ac-chiprow::-webkit-scrollbar { display: none; }
.ac-chip {
  flex: none; font-size: 11.5px; font-weight: 800; border-radius: var(--r-pill);
  padding: 8px 15px; background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--border); white-space: nowrap;
}
.ac-chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ac-timechip {
  font-size: 11px; font-weight: 800; border-radius: 9px; padding: 5px 11px;
  background: #FBFAF7; color: var(--ink-soft); border: 1px solid var(--border);
}
.ac-timechip.next { background: var(--green-050); color: var(--green-700); border-color: var(--green-100); }

/* ---------- Timeline ---------- */
.ac-tl { display: flex; gap: 11px; }
.ac-tl-rail { display: flex; flex-direction: column; align-items: center; }
.ac-tl-dot { width: 10px; height: 10px; border-radius: 50%; box-sizing: content-box; border: 2px solid transparent; }
.ac-tl-line { width: 2px; flex: 1; min-height: 16px; }
.ac-tl-body { display: flex; flex-direction: column; gap: 1px; padding-bottom: 12px; }

/* ---------- Empty state ---------- */
.ac-empty {
  text-align: center; color: var(--ink-soft); padding: 40px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.ac-empty .msr { font-size: 40px; color: var(--ink-40); }

/* ---------- Toast (ink, above nav, 2300ms, one at a time) ---------- */
#toast-root {
  position: fixed; left: 20px; right: 20px; bottom: calc(var(--nav-h) + var(--safe-bottom) + 20px);
  z-index: 1080; display: flex; justify-content: center; pointer-events: none;
}
body.nav-hidden #toast-root { bottom: calc(var(--safe-bottom) + 24px); }
.ac-toast {
  background: var(--ink); color: var(--paper);
  font-size: 11.5px; font-weight: 600; line-height: 1.4; text-align: center;
  border-radius: 12px; padding: 11px 16px;
  box-shadow: var(--shadow-toast);
  animation: acToast var(--t-std) var(--ease);
}

/* ---------- Bottom nav (5 slots, center FAB) ---------- */
#bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 1030;
  background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 7px 8px calc(9px + var(--safe-bottom)); align-items: end;
}
body.nav-hidden #bottom-nav { display: none; }
.ac-nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.ac-nav-item .msr { font-size: 23px; color: var(--ink-soft); font-variation-settings: 'FILL' 0; }
.ac-nav-item .en { font-size: 9.5px; font-weight: 800; color: var(--ink-soft); }
.ac-nav-item .ur { font-size: 9.5px; line-height: 1.5; color: var(--ink-soft); }
.ac-nav-item.active .msr { color: var(--green-600); font-variation-settings: 'FILL' 1; }
.ac-nav-item.active .en, .ac-nav-item.active .ur { color: var(--green-600); }
.ac-fab-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.ac-fab {
  width: 50px; height: 50px; border-radius: 50%; background: var(--green-600);
  display: flex; align-items: center; justify-content: center;
  margin-top: -26px; border: 4px solid var(--paper);
  box-shadow: var(--shadow-fab);
}
.ac-fab-wrap .en, .ac-fab-wrap .ur { font-size: 9.5px; font-weight: 800; color: var(--green-600); line-height: 1.5; }

/* ---------- Photo placeholders (until real photography lands) ---------- */
.ac-ph {
  background: repeating-linear-gradient(45deg, #ECEAE2 0 8px, #F3F1EA 8px 16px);
  display: flex; align-items: center; justify-content: center;
  color: #9A957F; font-family: ui-monospace, Menlo, monospace; font-size: 8.5px; text-align: center;
}

/* ---------- Spinner ---------- */
.ac-spin { display: flex; justify-content: center; padding: 48px 0; }
.ac-spin::after {
  content: ''; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--green-100); border-top-color: var(--green-600);
  animation: acSpin .8s linear infinite;
}

/* ---------- Animations ---------- */
@keyframes acToast { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes acPop { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes acPulse { 0% { box-shadow: 0 0 0 0 rgba(198,71,62,.45); } 100% { box-shadow: 0 0 0 26px rgba(198,71,62,0); } }
@keyframes acSpin { to { transform: rotate(360deg); } }
