:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-glass: rgba(17, 24, 39, 0.75);
  --bg-glass-hover: rgba(31, 41, 55, 0.85);
  --bg-glass-card: rgba(15, 23, 42, 0.82);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.3);
  
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.4);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.4);
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.25);

  /* Font hệ thống chuẩn quốc tế - Hỗ trợ 100% tiếng Việt, tải tức thì 0ms, không bao giờ lỗi font */
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: #f2efe9;
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  user-select: none;
}

/* Map Container - Tràn ngập 100% màn hình, không bao giờ bị cắt vát hay tạo dải đen */
#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: #f2efe9;
}

#map {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 1;
  background-color: #f2efe9;
  transform: none !important;
}

.leaflet-container {
  width: 100% !important;
  height: 100% !important;
  background-color: #f2efe9 !important;
}

/* Top App Header / Full Width Navigation Bar (Tràn toàn bộ chiều ngang màn hình) */
.top-nav-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  max-width: 100vw;
  transform: none;
  z-index: 30;
  display: flex;
  pointer-events: none;
}

.nav-instruction-banner {
  width: 100%;
  background: var(--bg-glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1.5px solid var(--border-glow);
  border-left: none;
  border-right: none;
  border-top: none;
  border-radius: 0 0 20px 20px;
  padding: calc(env(safe-area-inset-top, 8px) + 10px) 20px 14px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 25px rgba(6, 182, 212, 0.2);
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.turn-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(16, 185, 129, 0.2));
  border: 1.5px solid var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  font-size: 24px;
  flex-shrink: 0;
  animation: pulse-border 2s infinite;
}

.turn-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.turn-distance {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-emerald);
  line-height: 1.2;
}

.turn-instruction {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.turn-next-street {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Floating Left Action Controls (Cụm icon xếp dọc đặt phía DƯỚI thanh thông báo, KHÔNG ĐÈ LÊN NHAU) */
.floating-controls-left {
  position: absolute;
  top: 110px;
  left: 14px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.floating-controls-left .floating-btn {
  pointer-events: auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--bg-glass-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.floating-controls-left .floating-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--accent-cyan);
  border-color: var(--border-glow);
  transform: scale(1.08);
}

.floating-controls-left .floating-btn.active {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

#btn-install-app {
  color: var(--accent-emerald);
}

#btn-install-app:hover {
  color: var(--accent-emerald);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 16px var(--accent-emerald-glow);
}

.floating-controls-left .floating-btn.btn-exit-app {
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.28);
}

.floating-controls-left .floating-btn.btn-exit-app:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border-color: var(--accent-rose);
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.45);
}

.floating-controls-left .floating-btn .tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-glass-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.floating-controls-left .floating-btn:hover .tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}

/* Left Sidebar / Control Panel */
.sidebar-panel {
  position: absolute;
  top: 96px;
  left: 16px;
  width: 380px;
  max-height: calc(100vh - 116px);
  z-index: 35;
  background: var(--bg-glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-panel.collapsed {
  transform: translateX(-420px);
}

/* Nút mở Menu nổi ở mép trái khi ẩn Sidebar */
.sidebar-open-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 25;
  background: var(--bg-glass-card);
  border: 1px solid var(--border-glow);
  color: var(--accent-cyan);
  box-shadow: var(--shadow-lg), 0 0 15px var(--accent-cyan-glow);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-open-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  transform: scale(1.08);
}

/* Khi sidebar bị đóng (collapsed), tự động hiện nút mở menu */
.sidebar-panel.collapsed ~ .sidebar-open-btn,
.sidebar-open-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  box-shadow: 0 4px 12px var(--accent-cyan-glow);
}

.logo-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #f8fafc, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.icon-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
  border-color: var(--border-glow);
}

.sidebar-content {
  padding: 16px 18px 24px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.normal-route-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-content::-webkit-scrollbar {
  width: 4px;
}
.sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Route Inputs Container */
.route-inputs-card {
  position: relative;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 14px 14px 44px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.route-dot-indicator {
  position: absolute;
  left: 18px;
  top: 26px;
  bottom: 26px;
  width: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.dot-start {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

.dot-line {
  flex-grow: 1;
  width: 2px;
  background: dashed 1px rgba(255, 255, 255, 0.2);
  margin: 4px 0;
}

.dot-end {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.location-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.88rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  outline: none;
  transition: all 0.2s;
}

.location-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.input-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.input-action-btn:hover {
  color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.06);
}

/* ================== DEDICATED SEARCH MODE STYLES ================== */

.search-mode-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
  flex-shrink: 0;
}

.search-back-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.search-back-btn:hover {
  background: var(--bg-glass-hover);
  color: #ffffff;
  border-color: var(--border-glow);
  transform: scale(1.05);
}

.search-input-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 44px;
  box-shadow: 0 0 18px var(--accent-cyan-glow);
  transition: all 0.2s ease;
}

.search-box-icon-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent-cyan);
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.search-box-icon-btn:hover {
  transform: scale(1.15);
  color: #38bdf8;
}

.search-box-icon {
  color: inherit;
  flex-shrink: 0;
}

.search-active-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.96rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  min-width: 0;
}

.search-active-input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: var(--text-primary);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.search-clear-btn:hover {
  background: rgba(244, 63, 94, 0.4);
  color: #ffffff;
}

/* Danh sách kết quả tìm kiếm (100% chiều rộng, thẻ card sang trọng) */
.suggestions-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 12px 0;
}

.suggestions-list::-webkit-scrollbar {
  width: 5px;
}

.suggestions-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.suggestion-item-card {
  width: 100%;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.suggestion-item-card:hover {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.35);
  transform: translateY(-1px);
}

.place-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(16, 185, 129, 0.15));
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.place-text-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.place-main-title {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-full-address {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-select-arrow {
  color: var(--text-muted);
  opacity: 0.5;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.suggestion-item-card:hover .place-select-arrow {
  opacity: 1;
  color: var(--accent-cyan);
  transform: translateX(3px);
}

/* Loading state */
.suggestion-loading-state {
  padding: 30px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.loading-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(6, 182, 212, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Empty state */
.suggestion-empty-state {
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.empty-icon {
  color: var(--text-muted);
  opacity: 0.6;
  margin-bottom: 2px;
}

.empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 260px;
  line-height: 1.4;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.swap-btn-container {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}

.swap-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.2s;
}

.swap-btn:hover {
  transform: rotate(180deg);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Route Mode & Presets */
.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preset-routes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preset-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.preset-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.preset-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Action Buttons */
.btn-primary {
  background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.35);
  transition: all 0.2s;
}

#btn-find-route {
  align-self: center;
  width: auto;
  min-width: 130px;
  max-width: 170px;
  padding: 8px 22px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin: 18px auto 6px auto;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.4);
}

#btn-find-route svg {
  width: 15px;
  height: 15px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
  transition: all 0.2s;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(244, 63, 94, 0.6);
}

.btn-danger:active {
  transform: translateY(0);
}

.hud-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Mode Switches (Simulation vs Live GPS) */
.toggle-switch-container {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.toggle-option {
  flex: 1;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.toggle-option.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(16, 185, 129, 0.25));
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
  font-weight: 600;
}



.floating-controls-left .floating-btn .tooltip {
  position: absolute;
  left: calc(100% + 10px);
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-glass);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.floating-controls-left .floating-btn:hover .tooltip {
  opacity: 1;
}

#btn-open-sidebar {
  display: none;
}

.sidebar-panel.collapsed ~ .floating-controls-left #btn-open-sidebar,
#btn-open-sidebar.visible {
  display: flex;
}

/* Bottom HUD Dashboard */
.bottom-dashboard {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: calc(100% - 40px);
  max-width: 820px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hud-card {
  pointer-events: auto;
  background: var(--bg-glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Speedometer Gauge HUD */
.speedometer-section {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 20px;
  border-right: 1px solid var(--border-glass);
}

.speed-dial {
  position: relative;
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speed-dial svg {
  transform: rotate(-90deg);
}

.speed-dial-bg {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 6;
  fill: none;
}

.speed-dial-bar {
  stroke: url(#speedGradient);
  stroke-width: 6;
  stroke-dasharray: 188;
  stroke-dashoffset: 140;
  stroke-linecap: round;
  fill: none;
  transition: stroke-dashoffset 0.2s ease-out;
}

.speed-dial-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.speed-number {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

.speed-unit {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Trip Stats Compact (Còn: ... / Dự kiến: ...) */
.trip-stats-compact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex-grow: 1;
  padding-left: 4px;
}

.stat-inline-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.stat-inline-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.stat-inline-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-inline-value.highlight {
  color: var(--accent-cyan);
  font-size: 1.25rem;
}

/* Trip Progress Bar */
.trip-progress-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan) 0%, var(--accent-emerald) 100%);
  border-radius: 4px;
  box-shadow: 0 0 10px var(--accent-cyan);
  transition: width 0.15s ease-out;
}

/* Control Buttons (HUD) */
.playback-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-emerald-glow);
  transition: all 0.2s;
}

.play-action-btn:hover {
  transform: scale(1.08);
}

.play-action-btn.paused {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.secondary-control-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.secondary-control-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.12);
}

/* Speed Slider inside HUD */
.speed-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.speed-slider-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 600;
}

.speed-slider {
  -webkit-appearance: none;
  width: 70px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-cyan);
}

/* Leaflet Custom DivIcon Resets (Prevent default white box/border) */
.leaflet-div-icon,
.leaflet-bike-icon,
.custom-turn-marker,
.custom-start-marker,
.custom-end-marker {
  background: transparent !important;
  border: none !important;
}

/* Custom Motorbike Marker Styles */
.motorbike-marker-container {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 25px 25px;
  transition: transform 0.08s linear;
  will-change: transform;
}

/* Đèn pha xe máy phát sáng mạnh chiếu thẳng về phía trước */
.headlight-beam {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  width: 76px;
  height: 95px;
  background: linear-gradient(to top, rgba(251, 191, 36, 0.85) 0%, rgba(56, 189, 248, 0.6) 25%, rgba(56, 189, 248, 0.18) 70%, transparent 100%);
  clip-path: polygon(40% 100%, 60% 100%, 100% 0%, 0% 0%);
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.75));
}

.motorbike-pulse-ring {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  animation: pulse-ring 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

.motorbike-icon-svg {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 12px rgba(6, 182, 212, 0.6));
  z-index: 2;
}

/* Next Turn Waypoint Marker (Ngã rẽ tiếp theo) */
.next-turn-waypoint {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.turn-waypoint-ring {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  animation: pulse-ring 1.5s infinite;
}

.turn-waypoint-core {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px var(--accent-cyan);
}

/* Destination Pin Marker */
.destination-pin-marker {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bounce-pin 1.2s infinite alternate ease-in-out;
}

/* Start Pin Marker */
.start-pin-marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: 3px solid white;
  box-shadow: 0 0 15px var(--accent-cyan), 0 4px 6px rgba(0,0,0,0.4);
}

/* Settings Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(20px);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.open .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.api-key-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.api-key-input:focus {
  border-color: var(--accent-cyan);
}

/* Toast Notifications - Đã tắt */
.toast-container {
  display: none !important;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-left: 4px solid var(--accent-cyan);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slide-in-toast 0.3s ease;
}

.toast.success { border-left-color: var(--accent-emerald); }
.toast.warning { border-left-color: var(--accent-amber); }
.toast.error { border-left-color: var(--accent-rose); }

/* Leaflet Layer Control Styling */
.leaflet-control-layers {
  background: var(--bg-glass-card) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 8px 12px !important;
}

.leaflet-control-layers label {
  color: var(--text-primary) !important;
  font-size: 0.85rem;
  margin-bottom: 4px;
  cursor: pointer;
}

.leaflet-control-layers-toggle {
  background-color: var(--bg-glass-card) !important;
  border-radius: 8px !important;
}

/* Animations */
.spin-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(6, 182, 212, 0); }
}

@keyframes bounce-pin {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

@keyframes slide-in-toast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive Mobile Optimization */
@media (max-width: 768px) {
  .sidebar-panel {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 85vh;
    max-height: 85dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom, 16px);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
  }
  
  .sidebar-content {
    padding: 14px 16px calc(env(safe-area-inset-bottom, 16px) + 24px) 16px;
    max-height: calc(85dvh - 65px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .sidebar-panel.collapsed {
    transform: translateY(100%);
  }

  .top-nav-bar {
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    transform: none;
  }

  .nav-instruction-banner {
    min-width: 0;
    width: 100%;
    padding: calc(env(safe-area-inset-top, 6px) + 8px) 16px 10px 16px;
    gap: 14px;
    border-radius: 0 0 16px 16px;
  }

  .turn-icon-wrapper {
    width: 42px;
    height: 42px;
    font-size: 22px;
    border-radius: 12px;
  }

  .turn-distance {
    font-size: 1.2rem;
  }

  .turn-instruction {
    font-size: 0.92rem;
    max-width: none;
    flex: 1;
  }

  .floating-controls-left {
    top: calc(env(safe-area-inset-top, 0px) + 98px);
    left: 10px;
    gap: 6px;
  }

  .floating-controls-left .floating-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .floating-controls-left .floating-btn svg {
    width: 18px;
    height: 18px;
  }

  .bottom-dashboard {
    bottom: 12px;
    width: calc(100% - 24px);
    max-width: none;
  }

  .hud-card {
    padding: 10px 14px;
    gap: 12px;
    border-radius: var(--radius-md);
  }

  .speedometer-section {
    padding-right: 10px;
  }

  .speed-dial {
    width: 52px;
    height: 52px;
  }

  .speed-dial svg {
    width: 52px;
    height: 52px;
  }

  .speed-number {
    font-size: 1.15rem;
  }

  .speed-unit {
    font-size: 0.55rem;
  }

  .trip-stats-compact {
    gap: 3px;
    padding-left: 2px;
  }

  .stat-inline-row {
    gap: 6px;
  }

  .stat-inline-label {
    font-size: 0.8rem;
  }

  .stat-inline-value {
    font-size: 1.05rem;
  }

  .stat-inline-value.highlight {
    font-size: 1.15rem;
  }

  /* Chế độ Tìm kiếm Toàn màn hình trên Mobile (Không bao giờ bị bàn phím ảo che) */
  .sidebar-panel.search-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    z-index: 9999 !important;
    background: rgba(11, 15, 25, 0.98) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    padding-top: env(safe-area-inset-top, 8px) !important;
    display: flex !important;
    flex-direction: column !important;
    transform: none !important;
    animation: search-expand 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar-panel.search-active .sidebar-header {
    display: none !important;
  }

  .sidebar-panel.search-active .sidebar-content {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 12px 14px !important;
    overflow: hidden !important;
  }

  .sidebar-panel.search-active .suggestions-list {
    position: static !important;
    max-height: none !important;
    flex-grow: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 320px !important; /* Tạo không gian cuộn rộng rãi phía trên bàn phím ảo */
  }

  .sidebar-panel.search-active .suggestion-item-card {
    padding: 14px 12px !important;
  }
}

@keyframes search-expand {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================== ACTIVE SEGMENT & NEXT TURN WAYPOINT STYLES ================== */

/* Đường chặng đang đi phát sáng rực rỡ */
.active-segment-glow {
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.75));
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Điểm đánh dấu khúc ngoặt tiếp theo của chặng đang đi */
.custom-turn-marker {
  background: transparent;
  border: none;
}

.next-turn-waypoint {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.turn-waypoint-ring {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.25);
  border: 2px solid #00f2fe;
  animation: turn-pulse 1.8s infinite ease-out;
}

.turn-waypoint-core {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #00f2fe;
  box-shadow: 0 0 12px #00f2fe, 0 2px 6px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

@keyframes turn-pulse {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }
  70% {
    transform: scale(1.4);
    opacity: 0.3;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* Tuyến đường chính hiển thị rõ nét, nổi bật trên bản đồ */
.active-route-line {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  stroke-linejoin: round;
  stroke-linecap: round;
}


