/* ============================================
   STAUKARTE.NET - Modern Traffic Map Styles
   Google Maps inspired design
   ============================================ */

:root {
    /* Colors - Google Maps inspired */
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --secondary: #202124;
    --background: #f8f9fa;
    --surface: #FFFFFF;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;

    /* Traffic Colors */
    --traffic-green: #34a853;
    --traffic-yellow: #fbbc04;
    --traffic-orange: #ea8600;
    --traffic-red: #ea4335;

    /* Spacing */
    --header-height: 64px;
    --sidebar-width: 280px;

    /* Shadows - Google style */
    --shadow-sm: 0 1px 2px rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-md: 0 1px 3px rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
    --shadow-lg: 0 1px 3px rgba(60,64,67,0.3), 0 8px 16px 4px rgba(60,64,67,0.15);

    /* Transitions */
    --transition: all 0.2s ease;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #202124;
        --surface: #292a2d;
        --text-primary: #e8eaed;
        --text-secondary: #9aa0a6;
        --border: #3c4043;
    }
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Google Sans', Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--background);
    overflow: hidden;
}

/* ============================================
   HEADER - Google Maps style
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--surface);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 18px;
}

.logo-img {
    height: 48px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.logo-domain {
    color: var(--primary);
}

/* Navigation Toggle (Mobile) */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.nav-toggle:hover {
    background: var(--background);
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Language Switch */
.lang-switch {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.visit-counter {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 400;
    margin-left: 8px;
    align-self: center;
}

.lang-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    padding: 8px 10px;
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn:hover {
    background: var(--background);
    color: var(--text-primary);
}

.lang-btn.active {
    background: rgba(26, 115, 232, 0.12);
    color: var(--primary);
}

/* Search - Google Maps style */
.search-container {
    position: relative;
}

.search-input {
    width: 300px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    background: var(--background);
    color: var(--text-primary);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

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

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow-lg);
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-result-item::before {
    display: none;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--background);
}

.search-result-geo {
    flex-direction: column;
    align-items: flex-start;
}

.search-result-geo::before {
    display: none;
}

.search-result-address {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 0;
}

/* Route autocomplete (route panel inputs) */
.route-autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 240px;
    overflow-y: auto;
    z-index: 1100;
}

.route-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.route-autocomplete-item:last-child {
    border-bottom: none;
}

.route-autocomplete-item:hover {
    background: var(--background);
}

.search-divider {
    padding: 8px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--background);
    font-weight: 500;
}

/* Route Button */
.route-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.route-btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

/* Traffic Status */
.traffic-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(52, 168, 83, 0.1);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--traffic-green);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--traffic-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 900;
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
}

.sidebar-header h2 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 50%;
    line-height: 1;
}

.sidebar-close:hover {
    background: var(--background);
}

/* City List */
.city-list {
    padding: 8px;
}

.city-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: 8px;
    transition: var(--transition);
    font-size: 14px;
}

.city-item::before {
    content: '📍';
    font-size: 14px;
}

.city-item:hover {
    background: var(--background);
}

.city-item.active {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary);
    font-weight: 500;
}

/* ============================================
   ROUTE PANEL
   ============================================ */

.route-panel {
    position: fixed;
    top: var(--header-height);
    right: -400px;
    width: 380px;
    max-width: 100%;
    height: calc(100vh - var(--header-height));
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    z-index: 950;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.route-panel.active {
    right: 0;
}

.route-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.route-panel-header h3 {
    font-size: 16px;
    font-weight: 500;
}

.route-panel-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 50%;
    line-height: 1;
}

.route-panel-close:hover {
    background: var(--background);
}

.route-inputs {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.route-input-group {
    position: relative;
}

.route-input-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.route-input-group input {
    width: 100%;
    padding: 12px;
    padding-right: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text-primary);
    transition: var(--transition);
}

.route-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.use-location-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.use-location-btn:hover {
    background: var(--background);
}

.route-calculate-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.route-calculate-btn:hover {
    background: var(--primary-dark);
}

.route-calculate-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.route-result {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.route-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.route-stat {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
}

.route-stat-icon {
    font-size: 20px;
}

.route-stat-value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.route-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
}

.route-stat-warning {
    background: rgba(234, 67, 53, 0.1);
}

.route-stat-warning .route-stat-value {
    color: var(--traffic-red);
}

.route-clear-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.route-clear-btn:hover {
    background: var(--background);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
}

/* Map */
.map {
    width: 100%;
    height: 100%;
}

.ad-banner {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: 320px;
    height: 50px;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .ad-banner {
        bottom: 84px;
    }
}

/* Make the map canvas feel cleaner / closer to Google Maps */
.map canvas {
    outline: none;
}

/* TomTom/Mapbox style control tweaks (best-effort across SDK versions) */
.tt-control, .tt-ctrl, .mapboxgl-ctrl {
    border-radius: 10px !important;
    box-shadow: var(--shadow-md) !important;
}

.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right,
.tt-ctrl-bottom-left,
.tt-ctrl-bottom-right {
    opacity: 0.85;
}

/* Info Panel - Compact Google style */
.info-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    background: var(--surface);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    z-index: 100;
    max-width: 200px;
}

.info-panel h1 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 2px;
}

.info-panel p {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 8px;
}

/* Compact Legend */
.legend-compact {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.legend-item-compact {
    cursor: help;
}

.legend-dot {
    display: block;
    width: 24px;
    height: 4px;
    border-radius: 2px;
}

/* Speed Camera Toggle - Compact */
.speed-camera-toggle {
    padding-top: 8px;
}

.info-actions {
    padding-top: 10px;
}

.route-btn.route-btn-compact {
    width: 100%;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: none;
}

.route-btn.route-btn-compact:hover {
    background: var(--background);
    box-shadow: var(--shadow-sm);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.toggle-label input:checked + .toggle-slider {
    background: var(--traffic-red);
}

.toggle-label input:checked + .toggle-slider::after {
    left: 18px;
}

.toggle-text {
    color: var(--text-secondary);
}

/* Zoom Controls - Google style */
.zoom-controls {
    position: absolute;
    right: 16px;
    bottom: 120px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn + .zoom-btn {
    border-top: 1px solid var(--border);
}

.zoom-btn:last-child {
    border-bottom: none;
}

.zoom-btn:hover {
    background: var(--background);
    color: var(--text-primary);
}

.zoom-btn:active {
    transform: translateY(1px);
}

/* Marker & Popup slightly more "Google" */
.speed-camera-marker {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    font-size: 16px;
}

.roadworks-marker {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    font-size: 16px;
}

.camera-popup {
    font-family: inherit;
    color: var(--text-primary);
    font-size: 13px;
}

/* Mobile City Selector */
.mobile-city-selector {
    display: none;
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 100;
}

.mobile-city-selector select {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 14px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

/* ============================================
   SPEED CAMERA / BLITZER
   ============================================ */

.speed-camera-marker {
    width: 28px;
    height: 28px;
    background: white;
    border: 2px solid var(--traffic-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease;
}

.speed-camera-marker:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-md);
}

.camera-popup {
    padding: 8px;
    min-width: 120px;
}

.camera-popup strong {
    display: block;
    margin-bottom: 4px;
    color: var(--traffic-red);
    font-size: 13px;
}

.camera-popup p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Route Line Style */
.route-line {
    stroke: var(--primary);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    display: none;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.footer-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
}

.footer-nav a:hover {
    color: var(--primary);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main {
        left: 220px;
    }

    .route-btn-text {
        display: none;
    }

    .route-btn {
        padding: 8px 12px;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 12px;
    }

    .nav {
        order: -1;
    }

    .logo {
        order: 0;
    }

    .header-actions {
        order: 1;
    }

    .nav-toggle {
        display: flex;
    }

    .search-container {
        display: none;
    }

    .sidebar {
        left: -100%;
        width: 100%;
        max-width: 320px;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-close {
        display: block;
    }

    .main {
        left: 0;
    }

    .info-panel {
        top: auto;
        bottom: 80px;
        left: 12px;
        right: auto;
        max-width: 180px;
    }

    .zoom-controls {
        right: 12px;
        bottom: 160px;
    }

    .mobile-city-selector {
        display: block;
    }

    .route-panel {
        width: 100%;
        right: -100%;
    }

    .route-btn-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 16px;
    }

    .info-panel {
        max-width: 160px;
        padding: 10px 12px;
    }

    .info-panel h1 {
        font-size: 14px;
    }

    .legend-compact {
        display: none;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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