@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --brand: #f26a1b;
  --brand-2: #ff8a3d;
  --brand-ink: #c24d0a;
  --brand-soft: #fff1e7;
  --bg: #fff7f1;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --ink: #1d1714;
  --ink-2: #6b5d55;
  --line: #f0e2d8;
  --me: #1d1714;
  --me-ink: #ffffff;
  --shadow: 0 10px 30px rgba(120, 50, 10, .10), 0 2px 8px rgba(120, 50, 10, .06);
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand-soft: #2b1b11;
  --bg: #17120f;
  --bg-2: #1e1814;
  --surface: #241d18;
  --ink: #f6eee8;
  --ink-2: #b6a59a;
  --line: #3a2e26;
  --me: #f26a1b;
  --me-ink: #ffffff;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(120% 80% at 50% 0%, #ffa261 0%, #f26a1b 55%, #d95209 100%);
  color: #fff;
  transition: opacity .45s ease, visibility .45s;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-logo {
  width: 108px; height: 108px; border-radius: 32px; background: #fff;
  display: grid; place-items: center;
  box-shadow: 0 18px 40px rgba(120, 40, 0, .35);
  animation: pop .7s cubic-bezier(.2, 1.4, .4, 1) both;
}
.splash-logo img { width: 62px; }
.splash-name { font-size: 28px; font-weight: 800; margin-top: 12px; animation: up .6s .15s both; }
.splash-sub { font-size: 15px; opacity: .9; animation: up .6s .25s both; }
.splash-dots { display: flex; gap: 6px; margin-top: 22px; }
.splash-dots i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
.splash-dots i:nth-child(2) { animation-delay: .15s; }
.splash-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes up { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* ---------- Layout ---------- */
.app {
  height: 100dvh; max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* ---------- Header ---------- */
.top {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + var(--safe-t)) 14px 12px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  border-radius: 0 0 26px 26px;
  box-shadow: 0 8px 24px rgba(242, 106, 27, .30);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  position: relative; flex: none;
  width: 46px; height: 46px; border-radius: 16px; background: #fff;
  display: grid; place-items: center;
}
.avatar img { width: 28px; }
.online {
  position: absolute; bottom: -2px; left: -2px;
  width: 13px; height: 13px; border-radius: 50%; background: #22c55e; border: 2.5px solid #fff;
}
.titles { min-width: 0; }
.titles h1 { margin: 0; font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titles p { margin: 2px 0 0; font-size: 12px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* inside the site widget (iframe) */
.close-btn { display: none; }
.embed .close-btn { display: grid; }
.embed #installBtn, .embed .splash { display: none !important; }
.embed .top { border-radius: 0 0 22px 22px; }
.embed .app { height: 100vh; height: 100dvh; }
.embed .hero h2 { font-size: 18px; }
.t-short { display: none; }
@media (max-width: 400px) {
  .titles h1 { font-size: 16px; }
  .t-full { display: none; } .t-short { display: inline; }
  .icon-btn { width: 36px; height: 36px; border-radius: 12px; }
}
.actions { position: relative; display: flex; gap: 4px; flex: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 14px; border: 0;
  background: rgba(255, 255, 255, .18); color: #fff;
  display: grid; place-items: center; transition: background .2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .28); }
.icon-btn svg { width: 20px; height: 20px; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

.menu {
  position: absolute; top: 48px; left: 0; min-width: 220px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 18px; padding: 6px;
  box-shadow: var(--shadow);
  animation: up .18s ease both;
}
.menu button, .menu a {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border: 0; border-radius: 12px; background: none;
  text-align: right; font-size: 14px; color: inherit; text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--brand-soft); }
.menu svg { width: 18px; height: 18px; color: var(--brand); }

/* ---------- Chat ---------- */
.chat { flex: 1; overflow-y: auto; padding: 18px 14px 8px; scroll-behavior: smooth; }
.hero { text-align: center; padding: 10px 6px 4px; animation: up .5s ease both; }
.hero-badge {
  width: 74px; height: 74px; margin: 6px auto 12px; border-radius: 24px;
  background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow);
}
.hero-badge img { width: 44px; }
.hero h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.hero p { margin: 0 auto 18px; max-width: 420px; color: var(--ink-2); font-size: 14px; line-height: 2; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: right; }
.card {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 14px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .2s;
}
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.card:active { transform: scale(.98); }
.card .ic {
  width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-size: 20px;
}
.card b { font-size: 14px; }
.card span { font-size: 12px; color: var(--ink-2); line-height: 1.8; }

.msgs { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.row { display: flex; gap: 8px; align-items: flex-end; animation: up .25s ease both; }
.row.me { flex-direction: row-reverse; }
.row .mini {
  flex: none; width: 30px; height: 30px; border-radius: 11px; background: var(--surface);
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.row .mini img { width: 18px; }
.bubble {
  max-width: 82%; padding: 11px 15px; font-size: 14.5px; line-height: 2;
  white-space: pre-wrap; word-wrap: break-word;
}
.bot .bubble {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 20px 20px 20px 6px; box-shadow: var(--shadow);
}
.me .bubble { background: var(--me); color: var(--me-ink); border-radius: 20px 20px 6px 20px; }
.bubble a { color: var(--brand); }
.time { font-size: 10.5px; color: var(--ink-2); margin: 0 40px; }
.row.me + .time { text-align: left; }
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
.bubble.err { border-color: #f3c4a8; background: var(--brand-soft); }
.retry { margin-top: 6px; border: 0; background: none; color: var(--brand); font-weight: 700; padding: 0; }

/* ---------- Composer ---------- */
.composer {
  padding: 8px 12px calc(8px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.quick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 13px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
  transition: border-color .2s, color .2s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.wa { border-color: #bfe9cf; color: #15803d; }
.bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 6px 6px 6px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.bar:focus-within { border-color: var(--brand); }
.bar textarea {
  flex: 1; min-height: 44px; max-height: 140px; resize: none; border: 0; outline: none; background: transparent;
  padding: 10px 12px; font-size: 15px; line-height: 1.7;
}
.send {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(242, 106, 27, .35);
  transition: transform .15s, opacity .2s;
}
.send svg { width: 20px; height: 20px; transform: scaleX(-1); }
.send:active { transform: scale(.94); }
.send:disabled { opacity: .45; box-shadow: none; }
.note { margin: 8px 0 0; text-align: center; font-size: 11px; color: var(--ink-2); line-height: 1.8; }

/* ---------- Install sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 10, 4, .45); animation: fade .2s both; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  max-height: 88dvh; overflow-y: auto;
  background: var(--bg-2); color: var(--ink);
  border-radius: 28px 28px 0 0; padding: 10px 18px calc(18px + var(--safe-b));
  animation: slide .3s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateY(100%); } }
.grabber { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.sheet-head img { width: 56px; height: 56px; border-radius: 16px; box-shadow: var(--shadow); }
.sheet-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.sheet-head p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.8; }
.steps { border: 1px solid var(--line); border-radius: 20px; padding: 14px; margin-bottom: 12px; background: var(--surface); }
.os-tag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 2; }
.steps .n {
  flex: none; width: 26px; height: 26px; border-radius: 9px; margin-top: 3px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.inl { width: 20px; height: 20px; vertical-align: -5px; color: #2f7cf6; margin: 0 2px; }
.hint { margin: 10px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.9; }
.primary, .ghost { width: 100%; border: 0; border-radius: 16px; padding: 13px; font-size: 15px; font-weight: 700; }
.primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; margin-bottom: 12px; box-shadow: 0 8px 20px rgba(242, 106, 27, .3); }
.ghost { background: transparent; color: var(--ink-2); }

/* ---------- Fare alert (push) card ---------- */
.push-card {
  margin: 4px 0 16px; padding: 14px; border-radius: 22px;
  background: linear-gradient(135deg, #fff3e8, #ffe4d1); border: 1px solid #f8cfb2;
  box-shadow: var(--shadow); animation: up .4s ease both;
}
:root[data-theme="dark"] .push-card { background: linear-gradient(135deg, #2e1d12, #3a2213); border-color: #5a3420; }
.pc-head { display: flex; gap: 12px; align-items: flex-start; }
.pc-bell {
  flex: none; width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); box-shadow: 0 6px 16px rgba(242, 106, 27, .35);
  animation: ring 2.4s ease-in-out infinite;
}
@keyframes ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-12deg); } 85% { transform: rotate(10deg); } 92% { transform: rotate(-6deg); } }
.pc-head b { display: block; font-size: 15px; line-height: 1.8; }
.pc-head span { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.9; }
.pc-x { margin-inline-start: auto; flex: none; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--ink-2); padding: 0 4px; }
.pc-routes { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pc-route {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font-size: 13px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; user-select: none;
}
.pc-route input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
.pc-route:has(input:checked) { border-color: var(--brand); color: var(--brand-ink); }
:root[data-theme="dark"] .pc-route:has(input:checked) { color: var(--brand-2); }
.pc-acts { display: flex; gap: 8px; }
.pc-yes {
  flex: 1; border: 0; border-radius: 16px; padding: 12px; font-size: 15px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); box-shadow: 0 8px 20px rgba(242, 106, 27, .3);
}
.pc-yes:disabled { opacity: .6; }
.pc-later { border: 0; background: none; color: var(--ink-2); padding: 12px 14px; font-size: 14px; }
.push-card.done .pc-routes, .push-card.done .pc-later { display: none; }

/* ---------- Contact strip (hero) ---------- */
.contact { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-top: 12px; }
.cbtn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 8px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s, border-color .2s;
}
.cbtn:active { transform: scale(.97); }
.cbtn .ce { font-size: 22px; line-height: 1.4; }
.cbtn b { font-size: 14px; }
.cbtn small { font-size: 11.5px; color: var(--ink-2); direction: ltr; unicode-bidi: plaintext; }
.cbtn.call:hover { border-color: var(--brand); }
.cbtn.wa:hover { border-color: #1faa59; }
.cbtn.loc:hover { border-color: #2f7cf6; }
.chip.call { border-color: #f6cdb3; color: var(--brand-ink); text-decoration: none; }
:root[data-theme="dark"] .chip.call { color: var(--brand-2); }
.chip.loc { border-color: #c9dbfb; color: #2563d6; }
a.icon-btn { text-decoration: none; }

/* ---------- Location sheet ---------- */
.loc-badge {
  width: 56px; height: 56px; border-radius: 16px; flex: none;
  background: linear-gradient(135deg, #5b9bff, #2f6fe0); color: #fff;
  display: grid; place-items: center; box-shadow: 0 8px 20px rgba(47, 111, 224, .3);
}
.loc-badge svg { width: 28px; height: 28px; }
.loc-addr { margin: 0 0 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; line-height: 2; }
.loc-map { margin: 0 0 12px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); height: 220px; }
.loc-map iframe { width: 100%; height: 100%; border: 0; display: block; }
.loc-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.loc-link {
  text-align: center; padding: 12px 6px; border-radius: 14px; font-weight: 700; font-size: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.loc-link:hover { border-color: #2f7cf6; color: #2f7cf6; }

/* ---------- WhatsApp sheet ---------- */
.wa-badge {
  width: 56px; height: 56px; border-radius: 16px; flex: none;
  background: linear-gradient(135deg, #3ddc84, #1faa59); color: #fff;
  display: grid; place-items: center; box-shadow: 0 8px 20px rgba(31, 170, 89, .3);
}
.wa-badge svg { width: 28px; height: 28px; }
.wa-list { display: grid; gap: 10px; margin-bottom: 12px; }
.wa-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
  transition: border-color .2s, transform .15s;
}
.wa-item:hover { border-color: #1faa59; }
.wa-item:active { transform: scale(.98); }
.wa-ic { width: 42px; height: 42px; border-radius: 14px; flex: none; display: grid; place-items: center; background: #e8f8ef; color: #1faa59; }
:root[data-theme="dark"] .wa-ic { background: #12301f; }
.wa-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wa-txt b { font-size: 15px; }
.wa-txt small { font-size: 12px; color: var(--ink-2); }
.wa-go { flex: none; font-size: 13px; font-weight: 700; color: #fff; background: #1faa59; padding: 7px 14px; border-radius: 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 13px;
  z-index: 60; box-shadow: var(--shadow); animation: up .2s both;
}

@media (min-width: 600px) {
  .cards { grid-template-columns: repeat(4, 1fr); }
  .chat { padding: 22px 22px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
