/* Stranica karty: sidebar + karta + info-okno. */
#app { display: flex; height: 100vh; }

#sidebar {
  width: 330px;
  min-width: 330px;
  background: var(--bg);
  padding: 18px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.side-head h1 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.side-head .sub { margin: 3px 0 0; font-size: 12px; color: var(--text-dim); max-width: 180px; }

.stat {
  font-size: 22px; font-weight: 700; color: var(--text);
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px;
}
.stat b { color: var(--accent-2); }

.filter { margin-bottom: 16px; }
.filter > label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.checkbox-row > label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); }
.filter input[type='range'] { width: 100%; accent-color: var(--accent); }
.ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-mute); margin-top: 2px; }

.segmented { display: flex; gap: 5px; }
.segmented button {
  flex: 1; padding: 8px 0; border: 1px solid var(--border); background: var(--bg-2);
  color: var(--text-dim); border-radius: 8px; font-size: 13px;
}
.segmented button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.checks { display: flex; flex-direction: column; gap: 5px; max-height: 170px; overflow-y: auto; padding-right: 4px; }
.checks label { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 7px; cursor: pointer; }
.checks label span { flex: 1; }

/* Пиктограммы коннекторов */
.conn-ico { flex: none; vertical-align: middle; }
.conn-ccs, .conn-chademo, .conn-tesla { color: #e8590c; }   /* DC — оранжевый */
.conn-type2, .conn-type1, .conn-schuko { color: #4dabf7; }  /* AC — синий */
.conn-generic { color: #868e96; }
.iw .conn-ico { color: #495057; }
.iw ul li { display: flex; align-items: center; gap: 6px; }

.legend { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; font-size: 12px; color: var(--text-dim); }
.legend .lg-block { margin-bottom: 12px; }
.legend .lg-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-mute); margin-bottom: 5px; }
.legend .lg-block > div { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.legend .lg-row { display: flex; flex-wrap: wrap; gap: 8px; }
.legend .lg-chip { display: flex; align-items: center; gap: 5px; }
.legend .lg-note { font-size: 10.5px; color: var(--text-mute); margin-top: 3px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }

.side-foot { margin-top: 16px; font-size: 11px; color: var(--text-mute); line-height: 1.6; }

/* Поездка: локация + запас хода */
.locate-btn {
  width: 100%; padding: 10px; border-radius: 9px; border: 1px solid var(--accent);
  background: rgba(28, 126, 214, 0.12); color: var(--accent-2); font-size: 14px; font-weight: 600;
}
.locate-btn:hover { background: rgba(28, 126, 214, 0.22); }
.range-band { display: flex; align-items: center; gap: 6px; }
.range-band input[type='number'] { width: 100%; text-align: center; }
.range-band .unit { color: var(--text-mute); font-size: 12px; }
.range-info { margin-top: 7px; font-size: 12px; color: var(--accent-2); min-height: 15px; }

.map-controls .ctl { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); margin-top: 7px; }

/* Панель маршрута */
.route-panel {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin-bottom: 16px; font-size: 13px;
}
.route-panel .rp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 14px; }
.route-panel .rp-close { background: none; border: none; color: var(--text-mute); font-size: 20px; line-height: 1; cursor: pointer; }
.route-panel .rp-close:hover { color: var(--text); }
.route-panel .rp-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; color: var(--text-dim); }
.route-panel .rp-row b { color: var(--text); }
.route-panel .rp-row.muted { color: var(--text-mute); font-size: 12px; }
.route-panel .rp-msg { color: var(--text-dim); }
.route-panel .rp-msg.err { color: #ff8787; }
.route-panel .rp-verdict { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-weight: 600; }
.route-panel .rp-verdict.ok { background: #10331b; color: #8ce99a; }
.route-panel .rp-verdict.tight { background: #3d2c00; color: #ffd8a8; }
.route-panel .rp-verdict.bad { background: #3a1414; color: #ffc9c9; }
.route-panel .rp-suggest { margin-top: 6px; font-size: 12.5px; color: var(--accent-2); }

/* Кнопка "Маршрут отсюда" в инфо-окне */
.iw-route {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  border-radius: 7px; padding: 6px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; margin-right: 8px;
}
.iw-route:hover { background: #1971c2; }

/* Свои подписи городов на карте (читаемость поверх карты) */
.city-label { text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 1px 2px #fff; }

#map { flex: 1; height: 100%; }

/* Info-okno Google Maps */
.iw { font-size: 13px; max-width: 260px; color: #212529; }
.iw h3 { margin: 0 0 3px; font-size: 15px; }
.iw .op { color: #495057; margin-bottom: 7px; font-size: 12.5px; }
.iw .muted { color: #868e96; }
.iw .badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; margin: 0 4px 6px 0; }
.iw .badge.free { background: #d3f9d8; color: #2b8a3e; }
.iw .badge.fast { background: #ffe8cc; color: #d9480f; }
.iw .badge.st-available { background: #d3f9d8; color: #2b8a3e; }
.iw .badge.st-occupied { background: #fff3bf; color: #b8890b; }
.iw .badge.st-out_of_service { background: #ffe3e3; color: #c92a2a; }
.iw .badge.st-unknown { background: #e9ecef; color: #868e96; }
.iw ul { padding-left: 16px; margin: 6px 0; }
.iw .route { margin-top: 8px; }
.iw a { color: var(--accent); }

/* Отзывы */
.fb { margin-top: 10px; border-top: 1px solid #e9ecef; padding-top: 8px; }
.fb-buttons { display: flex; gap: 8px; }
.fb-btn { background: #f1f3f5; border: 1px solid #dee2e6; border-radius: 8px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: #212529; }
.fb-btn:hover { background: #e9ecef; }
.fb-reasons { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; }
.fb-pick { width: 100%; font-size: 11px; color: #868e96; margin-bottom: 2px; }
.fb-chip { background: #fff; border: 1px solid #ced4da; border-radius: 14px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: #343a40; }
.fb-chip:hover { border-color: var(--accent); color: var(--accent); }
.fb-thanks { font-size: 12.5px; color: #2b8a3e; font-weight: 600; }

/* Adaptiv: uzkie ekrany */
@media (max-width: 640px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; min-width: 0; max-height: 45vh; border-right: none; border-bottom: 1px solid var(--border); }
  #map { min-height: 55vh; }
}

/* Выбор цвета машинки */
.car-color { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--text-dim); }
.car-color input[type='color'] { width: 40px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-2); cursor: pointer; }

/* Профиль авто + запас хода */
.vehicle > label { margin-bottom: 8px; }
.veh-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.veh-grid input { width: 100%; padding: 7px 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font-size: 12.5px; }
.veh-grid input:focus { outline: none; border-color: var(--accent); }
.veh-found { font-size: 11px; color: var(--text-mute); margin-top: 6px; min-height: 14px; }
.veh-found.ok { color: #69db7c; }
.veh-result { margin-top: 10px; }
.veh-range { font-size: 15px; color: var(--text-dim); }
.veh-range b { font-size: 26px; color: var(--accent-2); }
.veh-bar { position: relative; height: 18px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--border); margin-top: 6px; overflow: hidden; }
.veh-bar-fill { height: 100%; border-radius: 9px 0 0 9px; transition: width 0.25s; }
.veh-bar-txt { position: absolute; top: 0; left: 8px; line-height: 18px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 0 2px rgba(0,0,0,0.6); }
.veh-meta { font-size: 11.5px; color: var(--text-mute); margin-top: 6px; }

/* Поиск адреса назначения */
.dest-row { display: flex; gap: 6px; }
.dest-row input { flex: 1; }
.dest-go { padding: 0 14px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.dest-go:hover { background: #1971c2; }
.route-panel .rp-stops { margin-top: 8px; font-size: 12.5px; color: var(--text-dim); }
.route-panel .rp-stops b { color: var(--text); }

/* Единицы км/мили + заблокированные заводские поля */
.units-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-dim); }
.units-seg { width: 100px; }
.units-seg button { padding: 5px 0; font-size: 12px; }
.veh-grid input.locked { opacity: 0.75; cursor: not-allowed; border-style: dashed; }

/* Погода по маршруту */
.rp-weather { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.rp-wx-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-mute); margin-bottom: 5px; }
.rp-wx { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 2px 0; color: var(--text-dim); }
.rp-wx b { color: var(--text); }

/* Симуляция + голос */
.sim-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.sim-row .dest-go { flex: 1 1 100%; background: #2f9e44; border-color: #2f9e44; }
.sim-row .dest-go:hover { background: #268a3b; }

/* Выбор языка голоса */
.voice-lang { flex: 1 1 auto; min-width: 120px; padding: 4px 6px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font-size: 12px; }

/* Оверлеи навигации: манёвр + спидометр (поверх карты) */
#app { position: relative; }
.maneuver { position: absolute; top: 16px; left: 62%; transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 10px; background: rgba(15,23,32,0.93); color: #fff;
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.45); }
.maneuver .mnv-ico { display: flex; align-items: center; }
.maneuver .mnv-ico svg { display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.6)); }
.maneuver .mnv-txt { font-size: 14px; }
.maneuver .mnv-km { font-size: 18px; color: var(--accent-2); }
.speedo { position: absolute; bottom: 28px; left: calc(330px + 20px); z-index: 6; display: flex; align-items: center; gap: 10px; }
.spd-now { background: rgba(15,23,32,0.93); color: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 14px; font-size: 22px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,0.45); }
.spd-now .spd-val { font-size: 22px; }
.spd-now span:not(.spd-val) { font-size: 11px; color: var(--text-mute); margin-left: 4px; }
.spd-now.over { color: #ff6b6b; border-color: #ff6b6b; }
.spd-limit { width: 46px; height: 46px; border-radius: 50%; background: #fff; color: #111; border: 4px solid #e03131;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; box-shadow: 0 2px 8px rgba(0,0,0,0.45); }
@media (max-width: 640px) { .speedo { left: 12px; bottom: 12px; } .maneuver { left: 50%; } }
.spd-limit.approx { border-color: #adb5bd; opacity: 0.85; }

/* Диапазон скорости симуляции */
.sim-speed { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }
.sim-speed input { width: 56px; text-align: center; padding: 6px 4px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font-size: 12.5px; }
.sim-speed .unit { color: var(--text-mute); }

/* Избранное + меню клика по карте */
.fav-select { width: 100%; margin-top: 8px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font-size: 13px; }
.clk { display: flex; gap: 6px; }

/* ---- Красивые всплывающие уведомления (замена системного alert) ---- */
.toast-host {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 10000; display: flex; flex-direction: column; gap: 10px;
  align-items: center; pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 14px;
  background: rgba(28, 30, 38, 0.96); color: #f5f6f8;
  font-size: 14px; line-height: 1.35; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(14px) scale(0.97);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  max-width: 92vw;
}
.toast.toast-in { opacity: 1; transform: translateY(0) scale(1); }
.toast-ic { font-size: 18px; flex: none; }
.toast-msg { flex: 1 1 auto; }
.toast-warn { border-left: 4px solid #f59f00; }
.toast-err  { border-left: 4px solid #fa5252; }
.toast-ok   { border-left: 4px solid #2f9e44; }
.toast-info { border-left: 4px solid #1c7ed6; }

/* Виджет текущей реальной погоды (верхний правый угол карты) */
.weather-now {
  position: absolute; top: 16px; right: 16px; z-index: 6;
  display: flex; align-items: center; gap: 6px;
  background: rgba(15,23,32,0.93); color: #fff;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 7px 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.45);
}
.weather-now .wn-ico { font-size: 20px; line-height: 1; }
.weather-now .wn-temp { font-size: 16px; font-weight: 700; }

/* Сворачиваемые секции сайдбара */
.side-sec { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; background: var(--bg-2); overflow: hidden; }
.side-sec > summary {
  cursor: pointer; padding: 11px 14px; font-size: 13.5px; font-weight: 600; color: var(--text);
  list-style: none; display: flex; align-items: center; justify-content: space-between; user-select: none;
}
.side-sec > summary::-webkit-details-marker { display: none; }
.side-sec > summary::after { content: '▾'; color: var(--text-mute); transition: transform 0.2s; }
.side-sec[open] > summary::after { transform: rotate(180deg); }
.side-sec > summary:hover { background: var(--bg-3); }
.side-sec > .filter { padding: 0 14px 14px; margin-bottom: 0; }
.side-sec[open] > summary { border-bottom: 1px solid var(--border); }

/* Плавающая кнопка 3D на карте */
.map-fab {
  position: absolute; right: 16px; bottom: 28px; z-index: 6;
  width: 46px; height: 46px; border-radius: 12px;
  background: rgba(15,23,32,0.93); color: #fff; border: 1px solid var(--border);
  font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.45);
}
.map-fab:hover { background: rgba(30,42,56,0.95); }
.map-fab.active { background: var(--accent); border-color: var(--accent); }

/* Живой индикатор запаса хода в движении (левый верх карты) */
.range-now {
  position: absolute; top: 16px; left: calc(330px + 20px); z-index: 6;
  display: flex; flex-direction: column; gap: 5px; min-width: 120px;
  background: rgba(15,23,32,0.93); color: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 13px; box-shadow: 0 4px 16px rgba(0,0,0,0.45);
}
.range-now .rn-top { display: flex; align-items: baseline; gap: 6px; }
.range-now .rn-km { font-size: 19px; font-weight: 700; }
.range-now .rn-unit { font-size: 11px; color: var(--text-mute); }
.range-now .rn-pct { margin-left: auto; font-size: 12px; font-weight: 600; }
.range-now .rn-bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,0.15); overflow: hidden; }
.range-now .rn-fill { height: 100%; border-radius: 4px; transition: width 0.4s linear, background 0.4s; }
@media (max-width: 640px) { .range-now { left: 12px; top: 64px; } }

/* Кнопка сброса маршрута */
.clear-route { width: 100%; margin-top: 8px; padding: 8px; border-radius: 8px; border: 1px solid #e03131;
  background: rgba(224,49,49,0.12); color: #ff8787; font-size: 13px; font-weight: 600; cursor: pointer; }
.clear-route:hover { background: rgba(224,49,49,0.22); }

/* Живой ETA (низ по центру карты) */
.eta { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 6;
  display: flex; align-items: baseline; gap: 12px; background: rgba(15,23,32,0.93); color: #fff;
  border: 1px solid var(--border); border-radius: 12px; padding: 8px 18px; box-shadow: 0 4px 16px rgba(0,0,0,0.45); }
.eta .eta-clock { font-size: 20px; font-weight: 700; }
.eta .eta-sub { font-size: 12.5px; color: var(--text-mute); }
@media (max-width: 640px){ .eta { bottom: 84px; } }
