/* --- OPTIMIZATION --- */
.leaflet-map-pane {
    will-change: transform; /* Forces GPU acceleration */
    transform: translate3d(0,0,0); /* Hack to enable hardware compositing */
}

/* (Keep all your existing CSS below this line exactly as it was) */
:root {
    --bg: #0f172a; 
    --panel: #1e293b; 
    /* ... rest of your style.css ... */
    --border: #334155;
    --accent: #f97316; 
    --danger: #ef4444;
    --text: #f8fafc; 
    --text-muted: #94a3b8;
}

* { box-sizing: border-box; }

body { 
    margin: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    overflow: hidden; 
}

/* --- LAYOUT --- */
#map-container { 
    position: absolute; top: 0; left: 320px; right: 0; bottom: 0; 
    transition: left 0.3s ease; z-index: 1; 
}
#map { width: 100%; height: 100%; background: #0b1121; }

#sidebar {
    position: absolute; top: 0; left: 0; bottom: 0; width: 320px;
    background: var(--panel); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 2000; 
    transition: transform 0.3s ease;
}

/* --- HEADER & FOOTER --- */
.header { 
    padding: 20px; border-bottom: 1px solid var(--border); 
    background: rgba(0,0,0,0.2); display: flex; 
    justify-content: space-between; align-items: center; flex-shrink: 0; 
}
.footer { 
    padding: 20px; border-top: 1px solid var(--border); 
    background: rgba(0,0,0,0.2); flex-shrink: 0; 
}
.content { flex: 1; overflow-y: auto; padding: 15px; }

.header h2 { margin: 0; color: var(--accent); font-size: 1.5rem; line-height: 1; }
.subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.pro-badge { 
    color: var(--accent); font-size: 0.6em; vertical-align: middle; 
    border: 1px solid var(--accent); padding: 2px 4px; 
    border-radius: 4px; margin-left: 5px; 
}

/* --- PANELS --- */
.panel { 
    background: rgba(255,255,255,0.03); border: 1px solid var(--border); 
    border-radius: 8px; padding: 15px; margin-bottom: 15px; display: block; 
}
.panel.hidden { display: none !important; }
.panel-header { 
    display: flex; justify-content: space-between; 
    align-items: center; margin-bottom: 12px; 
}
.panel-header h4 { 
    margin: 0; color: var(--accent); font-size: 0.95rem; 
    text-transform: uppercase; letter-spacing: 0.5px; 
}

/* --- ROUTE VIEW & RATINGS --- */
.route-meta { margin-bottom: 15px; font-size: 0.9rem; color: #cbd5e1; }
.meta-row { margin-bottom: 4px; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.meta-desc { 
    margin-top: 10px; padding: 10px; background: rgba(0,0,0,0.3); 
    border-radius: 4px; font-size: 0.85rem; color: #94a3b8; 
    font-style: italic; line-height: 1.4; 
}

.rating-box { 
    display: flex; align-items: center; justify-content: space-between; 
    background: rgba(255,255,255,0.05); padding: 8px 12px; 
    border-radius: 6px; margin-bottom: 15px; 
}
.stars { color: #475569; cursor: pointer; font-size: 1.2rem; }
.stars span:hover, .stars span:hover ~ span { color: #fbbf24; }

/* --- STATS GRID --- */
.stats-grid { 
    display: grid; grid-template-columns: 1fr 1fr; 
    gap: 10px; margin-bottom: 15px; 
}
.stat { 
    background: rgba(0,0,0,0.2); padding: 8px; 
    border-radius: 4px; text-align: center; 
}
.stat .label { 
    display: block; font-size: 0.7rem; color: var(--text-muted); 
    text-transform: uppercase; margin-bottom: 2px; 
}
.stat strong { font-size: 1.1rem; color: white; }

/* --- CONTROLS & INPUTS --- */
.control-group { margin-bottom: 15px; }
.control-group label { 
    display: block; font-size: 0.75rem; color: var(--text-muted); 
    margin-bottom: 6px; text-transform: uppercase; font-weight: bold; 
}
.status-text { 
    font-size: 0.8rem; color: var(--text-muted); 
    margin-top: 6px; font-style: italic; text-align: center; 
}

.slider-row { 
    display: flex; justify-content: space-between; 
    align-items: center; margin-bottom: 8px; font-size: 0.85rem; 
}
input[type=range] { width: 55%; accent-color: var(--accent); cursor: pointer; }

input[type="text"], textarea { 
    width: 100%; padding: 12px; background: #020617; 
    border: 1px solid var(--border); color: white; 
    border-radius: 6px; margin-bottom: 15px; outline: none; 
    font-family: inherit; resize: vertical;
}
input[type="text"]:focus, textarea:focus { border-color: var(--accent); }

/* --- BUTTONS --- */
.btn { 
    border: none; padding: 10px 16px; border-radius: 6px; 
    font-weight: 600; cursor: pointer; color: white; 
    transition: all 0.2s; font-size: 0.9rem; 
}
.btn.primary { background: var(--accent); }
.btn.primary:hover { background: #ea580c; }
.btn.secondary { background: var(--border); color: var(--text); }
.btn.secondary:hover { background: #475569; }
.btn.danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); border: 1px solid var(--danger); }
.btn.danger:hover { background: var(--danger); color: white; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.full { width: 100%; } 
.small { padding: 6px 12px; font-size: 0.8rem; }
.btn-group { display: flex; gap: 8px; }

.icon-btn { 
    background: none; border: none; color: var(--text-muted); 
    cursor: pointer; font-size: 1.2rem; padding: 4px; line-height: 1; 
}
.icon-btn:hover { color: white; }
.text-btn { 
    background: none; border: none; color: var(--accent); 
    font-size: 0.8rem; cursor: pointer; text-decoration: underline; 
}

/* --- FILTERS (New Grouped Style) --- */
.filter-header { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 10px 0; }
.section-title { font-size: 0.8rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1px; margin: 0; }

.group-container { margin-bottom: 8px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: rgba(0,0,0,0.1); }
.group-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px; background: rgba(255,255,255,0.03); cursor: pointer;
    transition: background 0.2s;
}
.group-header:hover { background: rgba(255,255,255,0.08); }

.group-toggle-viz { display: flex; align-items: center; gap: 8px; flex: 1; }
.group-toggle-viz span { font-size: 0.85rem; font-weight: bold; color: var(--text-muted); }
.group-toggle-viz:hover span { color: white; }

.group-expand-icon { font-size: 0.8rem; color: var(--text-muted); transition: transform 0.2s; }
/* Rotate arrow when open */
.group-container.open .group-expand-icon { transform: rotate(180deg); }

.group-content { display: none; padding: 5px; background: rgba(0,0,0,0.2); border-top: 1px solid var(--border); }
.group-container.open .group-content { display: block; }

.filter-item {
    font-size: 0.85rem; padding: 8px 12px; margin-bottom: 2px; border-radius: 4px;
    opacity: 0.5; transition: all 0.2s; cursor: pointer; display: flex; justify-content: space-between;
}
.filter-item:hover { background: rgba(255,255,255,0.05); }
.filter-item.active { opacity: 1; background: rgba(249, 115, 22, 0.15); color: white; font-weight: 500; }
.filter-item .badge { font-size: 0.75rem; opacity: 0.6; }

/* --- MAP BUTTONS (FABs) --- */
.fab {
    width: 48px; height: 48px; border-radius: 12px; background: var(--panel); 
    border: 1px solid var(--border); color: white; cursor: pointer; font-size: 1.2rem; 
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4); pointer-events: auto; transition: transform 0.1s;
}
.fab:active { transform: scale(0.95); }
.fab.extended { width: auto; padding: 0 20px; font-size: 0.9rem; font-weight: 600; }
.fab.active { background: var(--accent); border-color: var(--accent); }

.top-left { position: absolute; top: 20px; left: 20px; z-index: 1000; display: none; }
.top-right { position: absolute; top: 20px; right: 20px; z-index: 1000; }

/* --- POINT EDITOR POPUP --- */
.point-editor { min-width: 180px; }
.editor-input {
    width: 100%; padding: 6px; margin-bottom: 8px;
    border: 1px solid #ccc; border-radius: 4px;
    font-size: 0.9rem;
}
.pe-actions { display: flex; justify-content: space-between; gap: 5px; }
/* --- MODALS --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8); z-index: 5000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal {
    background: var(--panel); border: 1px solid var(--border);
    padding: 25px; border-radius: 12px; width: 90%; max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
}
.modal h3 { margin: 0 0 20px 0; color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* --- MOBILE --- */
.mobile-only { display: none; }
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); width: 85%; max-width: 320px; box-shadow: 10px 0 20px rgba(0,0,0,0.5); }
    #sidebar.open { transform: translateX(0); }
    #map-container { left: 0; width: 100%; }
    .top-left { display: flex; } 
    .mobile-only { display: block; }
}