/* ==========================================================================
   MapsInfo Core Design System (styles.css)
   Aesthetic: Sleek Dark Glassmorphism, Modern Typography, Fluid Transitions
   ========================================================================== */

:root {
    --bg-primary: #121214;
    --card-bg: rgba(22, 22, 26, 0.72);
    --border-light: rgba(255, 255, 255, 0.09);
    --text-primary: #f3f3f6;
    --text-muted: #a1a1aa;
    --accent-color: #3b82f6; /* Modern Blue */
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --active-green: #10b981;
    --active-green-pulse: rgba(16, 185, 129, 0.4);
    --danger-red: #ef4444;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --shadow-premium: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Leaflet Map Styling
   ========================================================================== */
#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Override standard leaflet styles for modern look */
.leaflet-bar {
    border: none !important;
    box-shadow: var(--shadow-premium) !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden;
}
.leaflet-bar a {
    background-color: rgba(22, 22, 26, 0.85) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-light) !important;
    transition: var(--transition-smooth);
}
.leaflet-bar a:hover {
    background-color: var(--accent-color) !important;
}
.leaflet-control-zoom {
    margin-right: 20px !important;
    margin-bottom: 20px !important;
}
/* Move zoom controls to bottom-right dynamically in JS or CSS */
.leaflet-bottom.leaflet-right {
    margin-bottom: 100px; /* Give room on mobile */
}

/* Custom Marker Styling */
.custom-vehicle-marker {
    background: var(--accent-gradient);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.6);
}

.custom-poi-marker {
    font-size: 20px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    text-align: center;
    line-height: 1.2;
    cursor: pointer;
}

/* Popup van een verteld-plek-marker: navigeer er alsnog heen */
.leaflet-popup-content-wrapper {
    background: var(--card-bg) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-premium) !important;
}
.leaflet-popup-tip { background: var(--card-bg) !important; }
.poi-popup { font-family: var(--font-body); }
.poi-popup strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 14px;
    margin-bottom: 6px;
}
.poi-popup a {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}
.poi-popup a:hover { text-decoration: underline; }

/* ==========================================================================
   Glassmorphic Helper Class
   ========================================================================== */
.glassmorphic {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-premium);
}

/* ==========================================================================
   Floating Dashboard
   ========================================================================== */
.dashboard {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 380px;
    max-height: calc(100% - 40px);
    z-index: 10;
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Custom scrollbars for Dashboard */
.dashboard::-webkit-scrollbar {
    width: 4px;
}
.dashboard::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 16px;
}
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-icon {
    font-size: 28px;
}
.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #d4d4d8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo-text p {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.icon-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition-smooth);
}
.icon-button:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: rotate(45deg);
}

/* Main Toggle Section */
.main-toggle-section {
    display: flex;
    justify-content: center;
    width: 100%;
}
.btn-toggle {
    position: relative;
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.btn-toggle.active-off {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}
.btn-toggle.active-off:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-toggle.active-on {
    background: var(--active-green);
    color: #ffffff;
    box-shadow: 0 0 20px var(--active-green-pulse);
    font-weight: 600;
}

.toggle-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    z-index: 2;
    position: relative;
}

/* Pulsing effect for active button */
.pulse-ring {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 105%;
    height: 105%;
    border-radius: var(--radius-md);
    border: 3px solid var(--active-green);
    animation: pulse 2s infinite;
    pointer-events: none;
    z-index: 1;
}
.btn-toggle.active-on .pulse-ring {
    display: block;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.98);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.08);
        opacity: 0;
    }
}

/* Section Panel Styling */
.section-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.section-title h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 500;
}
.badge.active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-color);
}

/* Routing Inputs */
.routing-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--border-light);
    padding-bottom: 12px;
}
.routing-inputs input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    width: 100%;
    outline: none;
    transition: var(--transition-smooth);
}
.routing-inputs input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}
.btn-primary-small {
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition-smooth);
    text-align: center;
}
.btn-primary-small:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

/* Simulator controls layout */
.sim-controls {
    display: flex;
    gap: 10px;
}
.btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition-smooth);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}
.btn-secondary.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Slider Design */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.slider-group label {
    font-size: 12px;
    color: var(--text-muted);
}
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: transform 0.1s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Interests tags */
.interests-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.interest-tag {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    padding: 10px 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    flex: 1 1 calc(50% - 4px);
}
.interest-tag:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}
.interest-tag.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}
.tag-icon {
    font-size: 14px;
}

/* ==========================================================================
   AI Narrator Display Panel
   ========================================================================== */
#narrator-panel {
    background: rgba(59, 130, 246, 0.07);
    border: 1px solid rgba(59, 130, 246, 0.15);
    transition: max-height 0.4s ease, opacity 0.3s ease;
    max-height: 350px;
    opacity: 1;
    overflow: hidden;
}

.narrator-hidden {
    max-height: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    border: none !important;
    margin: 0 !important;
}

.narrator-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Dynamic Soundwave animation styling */
.now-playing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    width: 20px;
    height: 15px;
}
.now-playing-indicator .bar {
    width: 3px;
    height: 3px;
    background-color: var(--accent-color);
    animation: bounce-sound 0.8s ease-in-out infinite alternate;
}
.now-playing-indicator .bar:nth-child(2) {
    animation-delay: 0.2s;
}
.now-playing-indicator .bar:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce-sound {
    0% { height: 3px; }
    100% { height: 15px; }
}

.now-playing-title {
    font-size: 12px;
    font-weight: 600;
    color: #60a5fa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.narrator-subtitle-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #e4e4e7;
    max-height: 180px;
    overflow-y: auto;
}

.narrator-audio-controls {
    display: flex;
    justify-content: flex-end;
}
.btn-small-control {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: var(--transition-smooth);
}
.btn-small-control:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Switch control styling */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mode-section {
    padding: 12px 16px;
}
.mode-section span {
    font-size: 13px;
    font-weight: 500;
}
.helper-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 4px;
}

/* Styled Switch (Toggle Switch) */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider.round {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid var(--border-light);
}
.slider.round:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--accent-color);
}
input:checked + .slider:before {
    transform: translateX(20px);
}

/* Dashboard Footer */
.dashboard-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    font-family: monospace;
}

/* ==========================================================================
   Settings Modal Overlay
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    pointer-events: all;
    transition: opacity 0.3s ease;
}

.modal-hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 480px;
    max-width: 90%;
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-hidden .modal-content {
    transform: scale(0.95);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 14px;
}
.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}
.close-button {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.close-button:hover {
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.modal-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}
.form-group input, .form-group select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: var(--transition-smooth);
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

.help-link {
    font-size: 11px;
    color: var(--text-muted);
}
.help-link a {
    color: #60a5fa;
    text-decoration: none;
}
.help-link a:hover {
    text-decoration: underline;
}

/* API Status box */
.api-status-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.status-indicator.offline {
    background: var(--text-muted);
    box-shadow: 0 0 8px rgba(161, 161, 170, 0.5);
}
.status-indicator.online {
    background: var(--active-green);
    box-shadow: 0 0 8px var(--active-green-pulse);
}
.status-text {
    font-size: 12px;
    font-weight: 500;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
}
.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.hidden-settings {
    display: none !important;
}

.engine-settings-group {
    margin-top: 10px;
    border-top: 1px dashed var(--border-light);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 500px) {
    .dashboard {
        left: 10px;
        right: 10px;
        bottom: 20px;
        top: auto;
        width: auto;
        max-height: 50%;
        border-radius: var(--radius-lg);
        padding: 16px;
        gap: 12px;
    }
    
    .dashboard-header {
        padding-bottom: 10px;
    }
    
    .section-panel {
        padding: 12px;
    }
    
    .interests-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
}


/* --- Ingeklapt dashboard: kaart voorop, alleen kop + ondertitels --- */
.dashboard.collapsed .section-panel,
.dashboard.collapsed .main-toggle-section,
.dashboard.collapsed .dashboard-footer {
    display: none;
}
.dashboard.collapsed #narrator-panel:not(.narrator-hidden) {
    display: block;
}
