/* GPS Μάγκας — εμφάνιση
   Φωτεινά, ζεστά χρώματα τη μέρα· σκούρα όταν το κινητό είναι σε σκούρα λειτουργία. */

:root {
  --bg: #f7f3ec;                         /* φόντο φύλλων (ρυθμίσεις κ.λπ.) */
  --card: rgba(255, 255, 255, .9);       /* κάρτες πάνω στον χάρτη, «γυαλί» */
  --card-2: #f2ece3;                     /* κουμπιά/πεδία μέσα στις κάρτες */
  --line: #ece5da;
  --text: #22252d;
  --muted: #727784;
  --accent: #ff8a3d;
  --accent-2: #ff5f6d;
  --accent-ink: #fff;
  --grad-accent: linear-gradient(135deg, #ffb347 0%, #ff7a45 55%, #ff5f6d 100%);
  --blue: #2f7cf6;
  --green: #0f8a63;
  --grad-nav: linear-gradient(135deg, #11a37a 0%, #0c7f66 55%, #0b6b73 100%);
  --danger: #e5484d;
  --warn: #f59e0b;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(34, 37, 45, .16), 0 2px 6px rgba(34, 37, 45, .08);
  --shadow-sm: 0 3px 10px rgba(34, 37, 45, .14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: rgba(28, 34, 43, .9);
    --card-2: #27313d;
    --line: #313c4a;
    --text: #f2f4f7;
    --muted: #9aa5b5;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --shadow-sm: 0 3px 10px rgba(0, 0, 0, .4);
  }
}

/* Ένα χρώμα για κάθε κατηγορία «κοντά μου» (κουμπί, καρφίτσα, λίστα). */
[data-key="fuel"] { --c: #ef4444; }
[data-key="food"] { --c: #f97316; }
[data-key="cafe"] { --c: #a16207; }
[data-key="market"] { --c: #16a34a; }
[data-key="pharmacy"] { --c: #0d9488; }
[data-key="parking"] { --c: #2563eb; }
[data-key="atm"] { --c: #7c3aed; }
[data-key="ev"] { --c: #65a30d; }
[data-key="hotel"] { --c: #4f46e5; }
[data-key="hospital"] { --c: #e11d48; }
[data-key="carwash"] { --c: #0891b2; }
[data-key="repair"] { --c: #64748b; }
[data-key="wc"] { --c: #0284c7; }

/* ---------- βάση: η εφαρμογή γεμίζει ακριβώς την οθόνη, χωρίς κύλιση ή ζουμ σελίδας ---------- */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  position: fixed; inset: 0; margin: 0; width: 100%; height: 100%; height: 100dvh;
  overflow: hidden; overscroll-behavior: none; touch-action: manipulation;
  -webkit-text-size-adjust: 100%; -webkit-user-select: none; user-select: none;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
input { -webkit-user-select: text; user-select: text; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }

@keyframes pulse { 50% { opacity: .65; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- χάρτης ---------- */

#map { position: fixed; inset: 0; z-index: 0; background: #dfe3e8; }
.leaflet-container { direction: ltr; } /* ο χάρτης μένει ίδιος και στα Αραβικά */
#arrow, #then-arrow, #steps-list svg { direction: ltr; }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-bottom { display: none; } /* η αναφορά OSM μπαίνει πάνω, κάτω από την αναζήτηση */
.leaflet-top.leaflet-right { top: calc(var(--safe-top) + 64px); }
body.navigating .leaflet-top.leaflet-right { top: calc(var(--safe-top) + 150px); }

.route-label, .poi-pin, .dest-pin { background: none; border: 0; }
.route-label div {
  display: inline-block; white-space: nowrap; transform: translate(-50%, -50%);
  padding: 4px 8px; border-radius: 8px; font-size: 13px; font-weight: 700;
  background: #fff; color: #333; box-shadow: var(--shadow-sm);
}
.route-label.sel div { background: var(--blue); color: #fff; }
.poi-pin div {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 16px;
  background: #fff; border: 3px solid var(--c, var(--accent)); box-shadow: var(--shadow-sm);
}

/* ---------- κοινά κομμάτια ---------- */

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .55);
}
@media (prefers-color-scheme: dark) { .card { border-color: rgba(255, 255, 255, .06); } }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pill { background: var(--card-2); color: var(--text); padding: 11px 16px; border-radius: 999px; font-weight: 600; font-size: 15px; }
.pill.primary { background: var(--blue); color: #fff; font-size: 17px; padding: 14px; }
.pill.primary:disabled { opacity: .5; }
.pill.danger { background: var(--danger); color: #fff; }
.pill.wide { display: block; width: 100%; margin-top: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 17px; color: var(--text); background: var(--card-2); }
.fab { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.fabs { display: flex; flex-direction: column; gap: 10px; align-self: flex-end; }

/* λίστες (αποτελέσματα, κοντινά, πρόσφατα, διαδρομές) */
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:last-child { border-bottom: 0; }
.list li:active { background: var(--card-2); }
.list li.head, .list li.empty, .list li.loading { color: var(--muted); font-size: 13px; cursor: default; }
.list li.head, .list li.loading { padding: 8px 14px; }
.list li.empty { justify-content: center; text-align: center; }
.list li.loading::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 2px solid var(--muted); border-top-color: transparent; animation: spin .8s linear infinite;
}
.list li.intent .name { color: var(--accent); }
.list .badge { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 17px; background: var(--card-2); }
.list .body { flex: 1; min-width: 0; }
.list .name, .list .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .name { font-size: 15px; font-weight: 600; }
.list .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.list .right { color: var(--muted); font-size: 13px; flex: none; }
.more { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--muted); font-size: 20px; }
.more:active { background: var(--card-2); }

body.navigating #toast { top: auto; bottom: calc(var(--safe-bottom) + 160px); }
#toast {
  position: fixed; z-index: 3000; left: 50%; top: calc(var(--safe-top) + 74px); transform: translateX(-50%);
  max-width: 90vw; padding: 10px 16px; border-radius: 999px; text-align: center; font-size: 14px;
  background: var(--card-2); color: var(--text); box-shadow: var(--shadow);
}

/* Όλα πάνω από τον χάρτη (ο Leaflet φτάνει μέχρι z-index 1000). */
#top, #banner, #bottom { position: fixed; left: 10px; right: 10px; z-index: 1100; }

/* ---------- πάνω: αναζήτηση ---------- */

#top { top: calc(var(--safe-top) + 10px); }
body.navigating #top { display: none; }
#search { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 14px; }
#search .ico { color: var(--muted); flex: none; }
#search input { flex: 1; min-width: 0; padding: 8px 0; font-size: 17px; background: none; border: 0; outline: none; -webkit-appearance: none; }
#search input::placeholder { color: var(--muted); }
.search-go { padding: 10px 18px; border-radius: 999px; font-weight: 800; background: var(--grad-accent); color: var(--accent-ink); box-shadow: 0 4px 12px rgba(255, 106, 69, .35); }
#search .ico { color: var(--accent); }
#results { margin-top: 8px; max-height: 45dvh; }
#results:empty { display: none; }
.install-tip { display: flex; align-items: flex-start; gap: 10px; margin-top: 8px; padding: 12px 12px 12px 14px; font-size: 14px; line-height: 1.4; }
.install-tip p { margin: 4px 0 0; color: var(--muted); }
.locate { display: block; margin: 8px auto 0; padding: 9px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--danger); color: #fff; box-shadow: var(--shadow); }

/* ---------- κάτω: κοντινά, πρόσφατα, κάρτες ---------- */

#bottom { bottom: calc(var(--safe-bottom) + 10px); display: flex; flex-direction: column; gap: 10px; max-height: calc(100dvh - var(--safe-top) - 90px); }
#home-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; }

#ribbon { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: -8px -10px; padding: 8px 10px; }
#ribbon::-webkit-scrollbar { display: none; }
.chip {
  --c: var(--accent);
  flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px;
  font-size: 14px; font-weight: 700; white-space: nowrap; background: var(--card); box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.chip span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 15px;
  background: color-mix(in srgb, var(--c) 18%, transparent); }
.chip.on { background: var(--c); color: #fff; }
.chip.on span { background: rgba(255, 255, 255, .25); }

#drawer { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#drawer-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 16px; font-weight: 700; font-size: 15px; }
#drawer-toggle .chev { transition: transform .2s; }
#drawer.open #drawer-toggle .chev { transform: rotate(180deg); }
#drawer-body { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 6px; padding: 10px 12px 6px; }
.tabs button { flex: 1; padding: 8px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--card-2); color: var(--muted); }
.tabs button.on { background: var(--grad-accent); color: #fff; }
#saved-list { max-height: 38dvh; }

.panel { display: flex; flex-direction: column; min-height: 0; padding-bottom: 12px; }
.panel header { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
#places-panel header { background: linear-gradient(135deg, color-mix(in srgb, var(--c, var(--accent)) 22%, transparent), transparent 70%); }
#preview-panel header { background: linear-gradient(135deg, rgba(47, 124, 246, .16), transparent 70%); }
.panel header h3 { margin: 0; flex: 1; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel .titles { flex: 1; min-width: 0; }
.panel .titles small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#preview-fav.on { color: var(--accent); }
.travel { display: flex; gap: 6px; padding: 10px 12px 4px; }
.travel button { flex: 1; padding: 9px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--card-2); color: var(--muted); }
.travel button.on { background: var(--blue); color: #fff; }
#places-list { max-height: 42dvh; }
#route-list { max-height: 40dvh; }
#go { margin: 10px 12px 0; width: auto; }

/* κάρτες διαδρομών */
.list li.route { flex-direction: column; align-items: stretch; gap: 4px; border-inline-start: 4px solid transparent; }
.list li.route.sel { border-inline-start-color: var(--blue); background: rgba(61, 139, 253, .1); }
.route .line1 { display: flex; align-items: baseline; gap: 10px; }
.route .time { font-size: 20px; font-weight: 800; }
.route .dist { font-size: 15px; color: var(--muted); }
.route .tag { margin-inline-start: auto; font-size: 12px; font-weight: 800; color: var(--green); }
.route .tag.slow { color: var(--muted); }
.route .via { font-size: 14px; opacity: .9; }
.route .flags { display: flex; flex-wrap: wrap; gap: 6px; }
.route .flags span { padding: 3px 8px; border-radius: 999px; font-size: 12px; background: var(--card-2); color: var(--muted); }
.route .flags .warn { color: var(--warn); }

/* ---------- πλοήγηση ---------- */

#banner { top: calc(var(--safe-top) + 10px); display: grid; grid-template-columns: 64px 1fr; gap: 4px 14px; padding: 14px 16px; background: var(--grad-nav); color: #fff; border-color: rgba(255, 255, 255, .18); }
.maneuver { display: grid; place-items: center; }
#arrow { width: 56px; height: 56px; }
#dist { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
#instr { font-size: 17px; font-weight: 600; opacity: .95; }
#quip { grid-column: 1 / -1; margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .15); color: #ffd28a; font-size: 16px; font-style: italic; }
#quip:empty { display: none; }
#then { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, .22); font-size: 15px; font-weight: 600; }
#then .then-label { color: #b7e4cf; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
#then-arrow { width: 24px; height: 24px; flex: none; }
#then-instr { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#then-dist { flex: none; color: #b7e4cf; font-size: 14px; }
.steps-toggle { grid-column: 1 / -1; justify-self: start; margin-top: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: rgba(255, 255, 255, .14); color: #fff; }
.steps-toggle .chev { display: inline-block; transition: transform .2s; }
.steps-toggle.open .chev { transform: rotate(180deg); }
#steps { position: fixed; left: 10px; right: 10px; z-index: 1100; }
#steps-list { max-height: 45dvh; }
#steps-list .badge { background: var(--green); }
#steps-list .badge svg { width: 24px; height: 24px; }
#steps-list li.current { background: rgba(15, 93, 63, .25); }
#status { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 10px; border-radius: 10px; font-size: 14px; font-weight: 600; background: rgba(0, 0, 0, .25); }
#status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--warn); animation: pulse 1s infinite; }

#navbar { padding: 12px; }
.trip { display: flex; justify-content: space-around; text-align: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.trip b { display: block; font-size: 22px; }
.trip div:nth-child(1) b { color: var(--accent); }
.trip div:nth-child(2) b { color: var(--blue); }
.trip div:nth-child(3) b { color: var(--green); }
.trip span { color: var(--muted); font-size: 12px; }
.nav-actions { display: flex; gap: 8px; padding-top: 10px; }
.nav-actions .pill { flex: 1; }
#mute.off { color: var(--danger); }

/* ---------- φύλλα από κάτω: ρυθμίσεις, επιλογές ---------- */

.sheet-wrap { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-end; background: rgba(0, 0, 0, .5); }
.sheet {
  width: 100%; max-height: calc(100dvh - var(--safe-top) - 20px); overflow-y: auto; overscroll-behavior: contain;
  padding: 0 16px calc(var(--safe-bottom) + 24px); border-radius: 20px 20px 0 0; background: var(--bg);
}
.sheet header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 16px 0 10px; background: var(--bg); }
.sheet h2 { margin: 0; font-size: 22px; }
.sheet section { margin-bottom: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--card); }
.sheet section h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); }
.sheet label { display: block; margin: 12px 0 0; font-size: 15px; }
.sheet label.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet select { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 16px; background: var(--card-2); }
.sheet input[type=range] { display: block; width: 100%; margin-top: 8px; accent-color: var(--accent); }
.sheet input[type=checkbox] { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.sheet output { float: inline-end; color: var(--muted); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.hint.version { text-align: center; margin: 4px 0 12px; }

.sheet.small { padding-top: 16px; }
.sheet.small h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; text-align: center; color: var(--muted); }
.sheet.small p { margin: 0 0 8px; font-size: 15px; line-height: 1.5; text-align: start; color: var(--text); }
#actions-buttons .pill { display: block; width: 100%; margin-top: 8px; padding: 14px 18px; text-align: start; font-size: 16px; }

.rec-buttons { display: flex; gap: 8px; margin-top: 12px; }
.rec-buttons .pill { flex: 1; margin: 0; text-align: center; }
.pill.rec.on { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
.pill.file { display: block; }
#rec-list { list-style: none; margin: 10px 0 0; padding: 0; }
#rec-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
#rec-list li span { flex: 1; color: var(--muted); }
#rec-list li.empty { justify-content: center; color: var(--muted); }
#rec-list .icon-btn { width: 36px; height: 36px; font-size: 14px; }

/* ---------- βοηθός ---------- */
.fab.mic { width: 58px; height: 58px; color: #fff; background: linear-gradient(135deg, var(--accent), #ff5e62); }
.fab.mic .ico { width: 26px; height: 26px; stroke: #fff; }
.fab.mic.on { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow); }
.fab.mic.listening { animation: mic-pulse 1.1s ease-in-out infinite; }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow); } }
#assistant { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 96px); z-index: 1200; max-width: 560px; margin: 0 auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; max-height: 48vh; }
#assistant[hidden] { display: none; }
.as-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
#as-state { color: var(--muted); font-size: 14px; }
#as-log { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
#as-log li { padding: 8px 12px; border-radius: 16px; max-width: 85%; line-height: 1.35; font-size: 15px; white-space: pre-wrap; }
#as-log li.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
#as-log li.bot { align-self: flex-start; background: var(--chip, rgba(127, 127, 127, 0.14)); border-bottom-left-radius: 4px; }
#as-form { display: flex; gap: 8px; align-items: center; }
.fab.mic.small { width: 44px; height: 44px; flex: none; box-shadow: none; }
.fab.mic.small .ico { width: 22px; height: 22px; }
.fab.mic.small[hidden] { display: none; }
#as-input { flex: 1; min-width: 0; font-size: 16px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line, rgba(127, 127, 127, 0.3)); background: var(--bg, transparent); color: inherit; }
