*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  /* Color Palette - Premium Light */
  --bg-deep: #F3F4F6;
  --bg-surface: rgba(255, 255, 255, 0.85);
  --bg-surface-solid: #FFFFFF;
  --bg-input: rgba(0, 0, 0, 0.05);
  --border-color: rgba(0, 0, 0, 0.1);
  
  --text-main: #111827;
  --text-muted: #6B7280;
  --text-dark: #1A1D24;

  /* Vibrant Accents */
  --accent-cyan: #0284C7;
  --accent-cyan-glow: rgba(2, 132, 199, 0.2);
  --accent-green: #059669;
  --accent-green-glow: rgba(5, 150, 105, 0.2);
  --accent-yellow: #D97706;
  --accent-red: #DC2626;
  --accent-red-glow: rgba(220, 38, 38, 0.2);

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #0284C7 0%, #2563EB 100%);
  --grad-surface: linear-gradient(145deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.4) 100%);

  /* Border Radius */
  --br-xl: 32px;
  --br-lg: 24px;
  --br-md: 16px;
  --br-sm: 12px;

  /* Effects */
  --blur-heavy: blur(24px);
  --blur-md: blur(16px);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 24px var(--accent-cyan-glow);
}

body.dark-theme {
  --bg-deep: #060910;
  --bg-surface: rgba(18, 22, 33, 0.85);
  --bg-surface-solid: #121621;
  --bg-input: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.1);
  
  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  --text-dark: #000000;

  --accent-cyan: #00f2fe;
  --accent-cyan-glow: rgba(0, 242, 254, 0.25);
  
  --grad-surface: linear-gradient(145deg, rgba(20,24,36,0.9) 0%, rgba(10,12,18,0.95) 100%);
  --shadow-glass: 0 12px 48px 0 rgba(0, 0, 0, 0.5);
}

/* Map Dark Mode Filter */
body.dark-theme .leaflet-tile-pane {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}
body.dark-theme .leaflet-container {
    background: #060910 !important;
}

body, html {
  font-family: 'Inter', 'Outfit', sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  overflow: hidden;
  width: 100%;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Background animated glow */
.dynamic-background {
  position: fixed; top:0; left:0; width:100%; height:100%; z-index:-1; overflow:hidden;
}
.glow {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.3;
  animation: float 20s infinite ease-in-out alternate;
}
.glow-1 { width: 300px; height: 300px; background: var(--accent-cyan); top: -50px; left: -50px; }
.glow-2 { width: 400px; height: 400px; background: #5000ff; bottom: -100px; right: -100px; animation-delay: -5s; }

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 50px) scale(1.2); }
}

/* Typography Utility */
.subtle-text { color: var(--text-muted); font-size: 13px; font-weight: 400; }
.highlight-text { color: var(--text-main); font-size: 15px; font-weight: 600; }
.mt-10 { margin-top: 10px; } .mt-15 { margin-top: 15px; } .mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; } .mb-15 { margin-bottom: 15px; } .mb-20 { margin-bottom: 20px; }
.w-100 { width: 100%; } .flex-1 { flex: 1; }
.hidden { display: none !important; }

/* Layout Containers */
.page-container {
  width: 100%; height: 100%; position: absolute; top: 0; left: 0; transition: opacity 0.4s ease;
}
#auth-container { z-index: 1000; background: transparent; display: flex; align-items: center; justify-content: center; padding: 20px;}
#auth-container.active { display: flex; animation: fadeIn 0.5s ease; }
#app-container { z-index: 100; animation: fadeIn 0.5s ease; }

@keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }

/* Premium Glass Components */
.premium-glass {
  background: var(--bg-surface);
  backdrop-filter: var(--blur-heavy);
  -webkit-backdrop-filter: var(--blur-heavy);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-glass);
}

/* Auth Views */
.premium-box {
  background: var(--grad-surface); backdrop-filter: var(--blur-heavy); -webkit-backdrop-filter: var(--blur-heavy);
  border: 1px solid var(--border-color); border-radius: var(--br-xl);
  padding: 40px 30px; width: 100%; max-width: 420px; box-shadow: var(--shadow-glass);
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }

.logo { text-align: center; margin-bottom: 35px; }
.logo.shrink { margin-bottom: 25px; }
.logo-icon-wrapper {
  width: 64px; height: 64px; border-radius: 20px; background: rgba(0,240,255,0.1);
  display: flex; justify-content: center; align-items: center; margin: 0 auto 15px;
  border: 1px solid rgba(0,240,255,0.2); box-shadow: inset 0 0 20px rgba(0,240,255,0.1);
}
.tl-icon-premium { stroke: var(--accent-cyan); width: 32px; height: 32px; }
.logo h1 { font-family: 'Outfit', sans-serif; font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.logo h1 span { color: var(--accent-cyan); text-shadow: 0 0 20px var(--accent-cyan-glow); }
.subtitle { color: var(--text-muted); font-size: 14px; margin-top: 5px; }

/* Premium Inputs */
.input-row { display: flex; gap: 12px; }
.half { flex: 1; }
.premium-input { position: relative; margin-bottom: 16px; }
.input-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-muted); pointer-events: none; transition: color 0.3s; }
.premium-input input {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: var(--br-md); padding: 16px; color: var(--text-main); font-size: 15px; font-weight: 500;
  outline: none; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-family: 'Inter', sans-serif;
  appearance: none; -webkit-appearance: none;
}
.premium-input.has-icon input { padding-left: 48px; }
.premium-input input[type="time"] { min-height: 50px; }
.premium-input input:focus { background: rgba(0, 240, 255, 0.05); border-color: var(--accent-cyan); box-shadow: 0 0 0 4px rgba(0, 240, 255, 0.1); }
.premium-input input:focus + .input-icon { color: var(--accent-cyan); }
.premium-input .prefix { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.custom-fuel-row .premium-input input { padding-left: 20px; padding-right: 48px; }
.premium-input.no-icon input { padding-left: 16px; }

/* Segmented Control */
.premium-segmented-control {
  display: flex; background: rgba(255,255,255,0.05); border-radius: var(--br-md); padding: 4px; position: relative;
}
.premium-segmented-control input { display: none; }
.premium-segmented-control label {
  flex: 1; text-align: center; padding: 12px 0; color: var(--text-muted); font-size: 14px; font-weight: 600; cursor: pointer; border-radius: var(--br-sm); transition: all 0.3s; z-index: 2;
}
.premium-segmented-control input:checked + label { background: white; color: var(--bg-deep); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

/* Buttons */
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  width: 100%; border: none; border-radius: var(--br-md); font-family: 'Inter', sans-serif;
  font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; outline: none; padding: 16px;
}
.btn:active { transform: scale(0.97); }
.btn-premium { background: var(--grad-primary); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.btn-glow { box-shadow: 0 8px 24px rgba(0, 128, 255, 0.4); }
.btn-glow:hover { box-shadow: 0 8px 32px rgba(0, 240, 255, 0.6); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { background: var(--border-color); }
.btn-small { padding: 12px 20px; width: auto; font-size: 14px; }
.btn-danger { background: rgba(255, 51, 102, 0.1); border: 1px solid rgba(255, 51, 102, 0.3); color: var(--accent-red); }

.red-glow { background: linear-gradient(135deg, #FF3366 0%, #cc0033 100%); box-shadow: 0 8px 24px var(--accent-red-glow); }
.green-glow { background: linear-gradient(135deg, #00FF88 0%, #00cc6a 100%); box-shadow: 0 8px 24px var(--accent-green-glow); text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* Links */
.auth-links { margin-top: 24px; text-align: center; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.auth-links a { color: var(--text-main); text-decoration: none; font-weight: 500; transition: color 0.2s; }
.auth-links a:hover { color: var(--accent-cyan); }
.auth-links .muted-link { color: var(--text-muted); font-weight: 400; }

/* Main App Layout */
/* Header */
.app-header {
  position: absolute; top: 0; left: 0; right: 0; width: 100%; height: 64px; z-index: 1000;
  border-radius: 0 0 var(--br-lg) var(--br-lg); padding: 0; overflow: hidden;
}
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 100%; padding: 0 20px; }
.logo-small { display: flex; align-items: center; gap: 6px; font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 800; }
.logo-small span { color: var(--accent-cyan); }
.pulse-icon { animation: pulseIcon 2s infinite; display: inline-block; }
@keyframes pulseIcon { 0% {transform: scale(1);} 50% {transform: scale(1.1);} 100% {transform: scale(1);} }

.header-items { display: flex; gap: 12px; align-items: center; }
.premium-pill {
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: 20px; padding: 6px 14px; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 6px; color: var(--text-main);
  transition: all 0.2s;
  height: 36px;
}
.premium-pill:hover { background: var(--accent-cyan-glow); border-color: var(--accent-cyan); }
button.premium-pill { border: 1px solid var(--border-color); cursor: pointer; }

.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.green { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.dot.red { background: var(--accent-red); }

/* Theme Toggle Button Styles */
.theme-btn {
    cursor: pointer;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.theme-btn:hover {
    background: var(--accent-cyan-glow);
    border-color: var(--accent-cyan);
}

@media (max-width: 600px) {
    .app-header { height: auto; padding: 8px 0; }
    .header-inner { flex-direction: row; gap: 8px; height: auto; padding: 0 10px; align-items: center; }
    .header-items { flex: 1; justify-content: flex-start; gap: 6px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
    .header-items::-webkit-scrollbar { display: none; }
    .premium-pill { padding: 4px 8px; font-size: 11px; height: 32px; white-space: nowrap; flex-shrink: 0; }
    .logo-small { font-size: 16px; flex-shrink: 0; }
}

.theme-icon-light { display: none; }
.theme-icon-dark { display: inline; }

body.dark-theme .theme-icon-light { display: inline; }
body.dark-theme .theme-icon-dark { display: none; }

/* Map Wrapper */
#map-wrapper { width: 100%; height: 100%; position: absolute; top:0; left:0; overflow: hidden; }
#map { 
    width: 150vmax; 
    height: 150vmax; 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    margin-left: -75vmax; 
    margin-top: -75vmax;
    z-index: 0; 
    background: var(--bg-deep); 
    transform-origin: center center;
    transition: transform 0.5s ease-out;
}
/* Leaflet Overrides */
.leaflet-control-attribution, .leaflet-control-zoom { display: none !important; }

/* Floating Widgets Base */
.floating-widget { position: absolute; z-index: 500; border-radius: var(--br-xl); }
.top-center { top: 75px; left: 50%; transform: translateX(-50%); width: auto; max-width: 90%; }
.bottom-left { bottom: 60px; left: 16px; }
.bottom-right { bottom: 60px; right: 16px; }
.right-actions, .right-actions-map {
    right: 20px;
    bottom: 260px; /* increased to avoid stats panel */
    position: absolute;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Traffic Light Marker Sections */
.tl-marker-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.tl-marker-glow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s;
}
.tl-main-bulb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.2);
}
.tl-sections-container {
  position: absolute;
  top: -12px;
  display: flex;
  gap: 2px;
}
.tl-sec-bulb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Next TL Widget Improvements */
#next-tl-widget { 
  padding: 12px 20px; 
  min-width: 140px; 
  display: flex; 
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.next-tl-bulb {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: white;
  transition: all 0.3s;
}
.bg-green { background-color: #22c55e; box-shadow: 0 0 15px rgba(34,197,94,0.5); }
.bg-red { background-color: #ef4444; box-shadow: 0 0 15px rgba(239,68,68,0.5); }

.tl-phase-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4b5563;
    transition: all 0.3s;
}
.tl-phase-dot.red { background: #ef4444; box-shadow: 0 0 10px rgba(239,68,68,0.8); }
.tl-phase-dot.yellow { background: #f59e0b; box-shadow: 0 0 10px rgba(245,158,11,0.8); }
.tl-phase-dot.green { background: #10b981; box-shadow: 0 0 10px rgba(16,185,129,0.8); }

.tl-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

#next-tl-sections {
  display: flex;
  gap: 12px;
  margin-top: 5px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  width: 100%;
  justify-content: center;
}
.widget-sec-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.widget-sec-bulb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  transition: all 0.3s;
}
.widget-sec-time {
  font-size: 12px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}

.tl-icon-ring.pulse { animation: ringPulse 1s infinite; }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.2); } 100% { box-shadow: 0 0 0 15px rgba(255,255,255,0); } }

/* Speed HUD */
.premium-hud-circle {
  width: 100px; height: 100px; position: relative; display: flex; justify-content: center; align-items: center;
  border-radius: 50%; background: var(--bg-surface); backdrop-filter: var(--blur-heavy); -webkit-backdrop-filter: var(--blur-heavy);
  box-shadow: var(--shadow-glass); border: 1px solid rgba(255, 255, 255, 0.05);
}
.progress-ring { position: absolute; top: 0; left: 0; transform: rotate(-90deg); }
.progress-ring__circle { transition: stroke-dashoffset 0.3s, stroke 0.3s; stroke-dasharray: 289; stroke-dashoffset: 0; stroke: var(--accent-cyan); filter: drop-shadow(0 0 8px var(--accent-cyan-glow)); }
.hud-circle-danger .progress-ring__circle { stroke: var(--accent-red); filter: drop-shadow(0 0 8px var(--accent-red-glow)); }
.hud-circle-warn .progress-ring__circle { stroke: var(--accent-yellow); }

.speed-content { text-align: center; display: flex; flex-direction: column; align-items: center; }
.speed-val { font-size: 36px; font-weight: 800; font-family: 'Outfit', sans-serif; line-height: 1; }
.speed-unit { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px;}

.rec-icon { width: 14px; height: 14px; flex-shrink: 0; }
.recommended-speed { display:flex; justify-content:center; align-items: center; white-space: nowrap; padding: 6px 12px; }
.recommended-speed span:first-of-type { font-weight: 800; color: var(--text-main); margin-left: 5px; margin-right: 3px; font-size: 14px;}

/* Trip Stats Widget */
.compact-stats { padding: 16px; min-width: 180px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.stat-item { display: flex; flex-direction: column; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; font-weight: 600;}
.stat-value { font-size: 15px; font-weight: 700; font-family: 'Outfit', sans-serif; }
.fuel-header { display: flex; justify-content: space-between; align-items: flex-end; }
.fuel-progress-bar { width: 100%; height: 8px; background: rgba(255,255,255,0.05); border-radius: 4px; margin-top: 8px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);}
.fuel-fill { height: 100%; transition: width 0.4s ease, background 0.4s; }
.glow-bg { background: var(--accent-green); box-shadow: 0 0 10px var(--accent-green-glow); }

/* Circular Buttons */
.btn-circular {
  width: 54px; height: 54px; border-radius: 27px;
  background: var(--bg-surface); backdrop-filter: var(--blur-heavy);
  border: 1px solid rgba(255,255,255,0.1); color: var(--text-main);
  display: flex; justify-content: center; align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); cursor: pointer; transition: all 0.2s; outline: none;
}
.btn-premium { background: var(--grad-primary); color: white; border: none; }
.btn-glow { box-shadow: 0 0 20px var(--accent-cyan-glow); }
.btn-circular:hover { transform: scale(1.05); }
.btn-circular svg { width: 24px; height: 24px; transition: transform 0.2s; }
.btn-circular:active { transform: scale(0.9); }
.btn-circular:active svg { transform: scale(0.9); }
.profile-btn { border: 1px solid rgba(0, 240, 255, 0.3); background: rgba(0, 240, 255, 0.05); }
.map-type-btn { border: 1px solid rgba(255, 184, 0, 0.3); background: rgba(255, 184, 0, 0.05); }
.map-type-btn svg { color: var(--accent-yellow); }

/* Kompas düyməsi */
#btn-compass { border: 1px solid rgba(255,255,255,0.15); }
#btn-compass.compass-active {
    background: rgba(99,102,241,0.2);
    border-color: #6366f1;
    box-shadow: 0 0 14px rgba(99,102,241,0.5);
}
#btn-compass.compass-active svg { color: #6366f1; }

/* Bottom Drawers */
.premium-drawer {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--bg-surface-solid);
  border-radius: var(--br-xl) var(--br-xl) 0 0;
  z-index: 6000; transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  border-top: 1px solid var(--border-color);
  color: var(--text-main);
}
.premium-drawer.open { transform: translateY(0); }
.drawer-handle { width: 40px; height: 4px; background: var(--border-color); border-radius: 2px; margin: 12px auto 20px; }
.drawer-content { padding: 0 24px 32px; max-height: 85vh; overflow-y: auto; }
.profile-header h2 { font-family: 'Outfit', sans-serif; font-size: 24px; margin-bottom: 4px; }
.settings-card { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--br-lg); padding: 20px; }
.card-title { font-size: 13px; color: var(--accent-cyan); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 15px; font-weight: 700; }
.icon-sm { width: 18px; height: 18px; }

/* Modals */
.modal { position: absolute; top:0; left:0; width:100%; height:100%; z-index: 7000; display:flex; justify-content:center; align-items:center; }
.premium-modal {
  background: var(--bg-surface-solid); border: 1px solid var(--border-color); border-radius: var(--br-xl);
  padding: 30px; width: 90%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: modalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-main);
}
@keyframes modalPop { 0% { opacity: 0; transform: scale(0.9) translateY(20px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
.premium-modal h3 { font-family: 'Outfit', sans-serif; font-size: 22px; }
.overlay { 
  position: fixed; top:0; left:0; width:100%; height:100%; 
  background: rgba(5, 5, 10, 0.8); z-index: 5000; 
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); 
  opacity: 0; transition: opacity 0.3s; 
  pointer-events: none;
}
.overlay.active { opacity: 1; pointer-events: auto; }

/* Notifications */
#notification-area { position: absolute; top: 96px; left: 16px; right: 16px; z-index: 2000; pointer-events: none; display: flex; flex-direction: column; gap: 10px; }
.notification {
  background: rgba(18, 20, 31, 0.9); backdrop-filter: var(--blur-heavy); border-radius: var(--br-md);
  padding: 16px; border-left: 4px solid var(--accent-cyan); box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: space-between; transform-origin: top center;
  animation: slideInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; pointer-events: auto;
}
.notification.warning { border-color: var(--accent-yellow); }
.notification.danger { border-color: var(--accent-red); }
.notif-text { font-size: 14px; font-weight: 500; font-family: 'Inter', sans-serif;}
.notif-close { background: none; border: none; color: white; opacity: 0.5; cursor: pointer; padding: 4px; display: flex;}
.notif-close svg { width: 16px; height: 16px; }
@keyframes slideInDown { from { transform: translateY(-20px); opacity: 0;} to { transform: translateY(0); opacity: 1;} }

/* Leaflet Overrides */
.custom-tl-icon { background: none; border: none; }
.custom-tl-icon svg { filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6)); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.custom-tl-icon.pulse svg { transform: scale(1.3); filter: drop-shadow(0 0 20px currentColor); }
.driver-marker svg { transition: transform 0.3s ease; filter: drop-shadow(0 0 10px var(--accent-cyan)); }
.other-driver-container { transition: all 0.5s linear; }
.other-driver-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.5));
}
.driver-label {
    position: absolute;
    bottom: -15px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.2);
}
#map.admin-mode { cursor: crosshair; }

/* Hide all map markers when map is zoomed out (< zoom 15) */
#map.map-zoomed-out .custom-tl-icon,
#map.map-zoomed-out .custom-map-icon {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Traffic Light Live Popup */
.tl-premium-popup .leaflet-popup-content-wrapper {
  background: var(--bg-surface-solid);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--br-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  color: var(--text-main);
  padding: 4px;
}
.tl-premium-popup .leaflet-popup-tip {
  background: var(--bg-surface-solid);
  border: 1px solid rgba(0, 240, 255, 0.2);
}
.tl-premium-popup .leaflet-popup-content {
  margin: 10px 12px;
  line-height: 1.3;
}

/* Counter-rotate map elements */
.custom-tl-icon svg,
.leaflet-popup-content-wrapper,
.leaflet-popup-tip-container,
.incident-icon,
.user-icon {
    transform: rotate(var(--map-counter-rotation, 0deg));
    transition: transform 0.5s ease-out;
}
.leaflet-popup-content-wrapper {
    transform-origin: bottom center;
}
.leaflet-popup-tip-container {
    transform-origin: top center;
}
 
/* Map Type Selector Styles */
#map-type-selector {
    position: absolute;
    right: 80px;
    top: 120px;
    z-index: 1000;
    width: 200px;
    padding: 12px;
    border-radius: var(--br-lg);
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.selector-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    padding-left: 4px;
}

.map-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--br-md);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.map-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.map-option.active {
    background: rgba(0, 240, 255, 0.1);
    border-color: rgba(0, 240, 255, 0.3);
}

.map-option.active span {
    color: var(--accent-cyan);
    font-weight: 600;
}

.map-thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.map-thumb.standard { background-color: #2b3e50; background-image: linear-gradient(45deg, #1e293b, #334155); }
.map-thumb.satellite { background-color: #0c1c0c; background-image: linear-gradient(45deg, #062106, #14532d); }
.map-thumb.hybrid { background-color: #1a1a1a; background-image: linear-gradient(45deg, #0f172a, #1e293b); }
.map-thumb.terrain { background-color: #2d2417; background-image: linear-gradient(45deg, #422006, #713f12); }

.map-option span {
    font-size: 13px;
    font-weight: 500;
}

@media (max-width: 600px) {
    #map-type-selector {
        right: 16px;
        top: auto;
        bottom: 250px;
        width: calc(100% - 32px);
    }
    
    .map-option {
        padding: 12px;
    }
}

/* RIGHT DRAWER */
.right-drawer {
    top: 0; right: 0; bottom: 0;
    width: 380px;
    max-width: 90vw;
    border-radius: var(--br-xl) 0 0 var(--br-xl);
    transform: translateX(100%);
    display: flex;
    flex-direction: column;
}
.right-drawer.open {
    transform: translateX(0) !important;
}
@media (max-width: 600px) {
    .right-drawer { 
        width: 100%; 
        max-width: 100%;
        border-radius: 0;
    }
}
.search-result-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}
.search-result-item:hover {
    background: var(--bg-input);
}
.search-result-name {
    font-weight: 600;
    color: var(--text-main);
}
.search-result-id {
    font-size: 12px;
    color: var(--text-muted);
}

.map-actions {
    position: absolute;
    bottom: 260px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 5500;
}
.left-actions { left: 20px; }
.right-actions { right: 20px; }

.premium-drawer {
    position: fixed;
    background: var(--bg-surface-solid);
    z-index: 6000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 50px rgba(0,0,0,0.8);
    border: 1px solid var(--border-color);
    pointer-events: auto;
}

.bottom-drawer {
    bottom: 0; left: 0; right: 0;
    border-radius: var(--br-xl) var(--br-xl) 0 0;
    transform: translateY(100%);
    max-height: 85vh;
    overflow-y: auto;
}



.premium-drawer.open {
    transform: none !important;
}

.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    z-index: 7000;
    pointer-events: none;
}
.modal:not(.hidden) { pointer-events: auto; }
.modal.hidden { display: none; }

@keyframes slideUpMenu {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--br-md);
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.menu-action-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent-cyan);
}

.menu-action-btn svg {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

#map-context-menu {
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
}

.route-stat-box {
    background: var(--bg-input);
    padding: 15px;
    border-radius: var(--br-md);
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.route-stat-box:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.05);
}

.route-stat-box.active {
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 15px var(--accent-cyan-glow);
}

.arrival-time {
    font-weight: 800;
    font-size: 16px;
    color: var(--text-main);
    display: block;
    margin-top: 5px;
}

/* Fix Leaflet Tile Gaps & Black Lines on Desktop Web */
.leaflet-tile {
    outline: 1px solid transparent;
    border: none !important;
}

.leaflet-tile-container {
    will-change: transform;
}

body.dark-theme .leaflet-tile-pane {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

/* Ensure background color doesn't bleed through sub-pixel gaps */
body.dark-theme .leaflet-container {
    background: #0d1117 !important; /* Slightly lighter than pure black to hide gaps */
}


/* ═══════════════════════════════════════════
   YUXARI HUD — Svetofor geri sayımı
════════════════════════════════════════════ */
.hud-top {
    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface, rgba(15,23,34,0.92));
    border: 1.5px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 18px;
    padding: 8px 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.35);
    backdrop-filter: blur(12px);
    min-width: 260px;
    pointer-events: none;
}
.hud-top.hidden { display: none !important; }
.hud-top-left  { display:flex; flex-direction:column; min-width:64px; }
.hud-top-center { display:flex; flex-direction:column; align-items:center; flex:1; }
.hud-top-right { display:flex; flex-direction:column; align-items:flex-end; min-width:64px; }
.hud-big-timer {
    font-size: 36px;
    font-weight: 900;
    font-family: 'Outfit', monospace;
    color: var(--text-main);
    line-height: 1;
    letter-spacing: -1px;
    transition: color 0.3s;
}
.hud-big-timer.phase-red    { color: #ef4444; }
.hud-big-timer.phase-green  { color: #22c55e; }
.hud-big-timer.phase-yellow { color: #f59e0b; }

/* ═══════════════════════════════════════════
   AŞAĞI HUD
════════════════════════════════════════════ */
.hud-bottom {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    pointer-events: none;
}
.hud-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 52px;
    border-radius: 26px;
    background: var(--bg-surface, rgba(15,23,34,0.92));
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 18px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}
.hud-pill.hidden { display: none !important; }
.hud-pill-cyan   { border-color: var(--accent-cyan, #06b6d4); }
.hud-pill-green  { border-color: var(--accent-green, #22c55e); }
.hud-pill-yellow { border-color: #f59e0b; }
.hud-big-num {
    font-size: 31px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    line-height: 1;
}
.hud-pill-label {
    display: flex;
    flex-direction: column;
    line-height: 1;
}
.hud-unit { font-size: 9px;  font-weight: 800; opacity: 0.55; letter-spacing: 0.5px; }
.hud-sub  { font-size: 8px;  font-weight: 700; }

/* ═══════════════════════════════════════════
   HOME & WORK sürətli nav
════════════════════════════════════════════ */
.hud-home-work {
    position: absolute;
    bottom: 88px;
    left: 14px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.hw-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px 7px 10px;
    border-radius: 22px;
    border: 1.5px solid var(--border-color, rgba(255,255,255,0.15));
    background: var(--bg-surface, rgba(15,23,34,0.88));
    color: var(--text-main);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    backdrop-filter: blur(8px);
    white-space: nowrap;
    pointer-events: all;
    transition: border-color 0.2s, background 0.2s;
}
.hw-btn:hover  { background: rgba(34,197,94,0.12); border-color: #22c55e; }
.hw-btn.not-set { opacity: 0.45; }

/* ═══════════════════════════════════════════
   ZOLAQ GÖSTƏRİCİSİ
════════════════════════════════════════════ */
.hud-lanes {
    position: absolute;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    background: var(--bg-surface, rgba(15,23,34,0.9));
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 14px rgba(0,0,0,0.3);
}
.hud-lanes.hidden { display: none !important; }
.lane-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,0.12);
    min-width: 36px;
    font-size: 16px;
    line-height: 1;
    cursor: default;
}
.lane-box.lane-active {
    border-color: var(--accent-cyan, #06b6d4);
    background: rgba(6,182,212,0.12);
}
.lane-box .lane-dir { font-size: 9px; font-weight: 700; opacity: 0.7; margin-top: 2px; }

/* ═══════════════════════════════════════════
   SÜRƏT MƏHDUDİYYƏTİ NİŞANI
════════════════════════════════════════════ */
.speed-limit-sign {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid #dc2626;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35), inset 0 0 0 2px #fff;
    flex-shrink: 0;
    pointer-events: none;
}
.speed-limit-sign .sl-circle {
    font-size: 18px;
    font-weight: 900;
    color: #111;
    font-family: 'Outfit', sans-serif;
    line-height: 1;
}

/* ═══════════════════════════════════════════
   YOL NİŞANLARI ZOLAĞU (yuxarı HUD altında)
════════════════════════════════════════════ */
.road-signs-bar {
    position: absolute;
    top: 128px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 850;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    pointer-events: none;
    max-width: 90vw;
}
.road-signs-bar.hidden { display: none !important; }
.road-sign-tag {
    background: var(--bg-surface, rgba(15,23,34,0.9));
    border: 1.5px solid rgba(239,68,68,0.5);
    color: var(--text-main);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════
   YER SEÇİM BANNERI (Home / Work)
════════════════════════════════════════════ */
.place-select-banner {
    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid #22c55e;
    border-radius: 24px;
    padding: 10px 20px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(34,197,94,0.25);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    pointer-events: all;
    animation: slideDown 0.25s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.psel-cancel {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-main);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.psel-cancel:hover { background: rgba(239,68,68,0.2); border-color: #ef4444; }

/* Xəritə kursor crosshair rejimində */
#map.crosshair-mode { cursor: crosshair !important; }