:root {
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.4);
    --card-border: rgba(255, 255, 255, 0.05);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --primary-color: #f97316;
    
    --nav-height: 80px;
    --nav-bg: rgba(15, 23, 42, 0.65);
    --nav-active: #3b82f6;
    
    /* Status Colors */
    --status-activo: #ef4444; 
    --status-declarado: #f97316; 
    --status-controlado: #eab308; 
    --status-estabilizado: #3b82f6; 
    --status-extinguido: #22c55e; 
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient-start);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh; 
    height: 100dvh; 
    overflow: hidden;
}

/* Main Layout */
.app-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    /* Important: reserve space at the bottom for the absolute navbar so scrollable content isn't hidden */
    padding-bottom: var(--nav-height); 
}

/* Tabs */
.tab-content {
    display: none; 
    width: 100%;
    height: 100%;
    overflow-y: auto;
    position: absolute;
    top: 0; left: 0;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
}

.tab-content.active {
    display: block; 
    animation: fadeIn 0.3s ease;
}

#tab-list, #tab-alerts, #tab-menu {
    padding-top: calc(env(safe-area-inset-top, 20px) + 1rem);
    padding-bottom: calc(var(--nav-height) + 2rem);
}

#tab-map.active {
    background: transparent;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Glass Panels */
.glass-panel {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Slider Styling */
.slider-container {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.slider-container label {
    font-weight: 600;
    font-size: 1rem;
}
.styled-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}
.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.8);
}

/* Floating Glass Map Buttons */
.glass-btn {
    position: absolute;
    top: calc(env(safe-area-inset-top, 20px) + 1rem);
    width: 45px;
    height: 45px;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.glass-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.1);
}

.floating-tl {
    left: 1rem;
}
.floating-tl-2 {
    left: 1rem;
    top: calc(env(safe-area-inset-top, 20px) + 4.5rem);
}
.floating-tr {
    right: 1rem;
}

#btn-toggle-cones:not(.active) .icon {
    filter: grayscale(100%) opacity(0.5) !important;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: none;
}
.secondary-btn.active {
    background: rgba(34, 197, 94, 0.8);
    border: 1px solid rgba(34, 197, 94, 1);
}
#menu-toggle-cones {
    background: rgba(249, 115, 22, 0.8) !important;
    border: 1px solid rgba(249, 115, 22, 1) !important;
    color: white !important;
}
#menu-toggle-cones.active {
    background: rgba(34, 197, 94, 0.8) !important;
    border: 1px solid rgba(34, 197, 94, 1) !important;
}



.loader {
    width: 18px; height: 18px;
    border: 2px solid #fff;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden { display: none !important; }

/* Map Tab Styles */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* List Tab Styles */
.results {
    padding: 1rem;
    padding-bottom: 2rem;
    display: flex; flex-direction: column; gap: 2rem;
}

.result-column h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

.fire-list { display: flex; flex-direction: column; gap: 1rem; }

.fire-card {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 4px solid #fff;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.card-header h3 { font-size: 1rem; font-weight: 600; }
.badge { font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 12px; font-weight: 700; text-transform: uppercase; }
.card-body p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.card-body p strong { color: var(--text-main); }

/* Menu / Screens */
.menu-screen { padding: 1rem; display: flex; flex-direction: column; gap: 1.5rem; }
.menu-section { display: flex; flex-direction: column; gap: 0.8rem; }
.menu-section h2 { font-size: 1.2rem; }
.menu-section p { color: var(--text-muted); font-size: 0.9rem; }

.placeholder-screen {
    text-align: center; margin: 1rem;
}

.btn {
    background: var(--primary-color); color: #fff; border: none; padding: 1rem;
    font-size: 1rem; font-weight: 700; border-radius: 12px;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.5); cursor: pointer;
}
.lang-btn {
    background: rgba(255, 255, 255, 0.1); color: var(--text-main); border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: none; font-size: 1.1rem;
}

@keyframes flashHighlight {
    0% { background-color: rgba(249, 115, 22, 0.5); transform: scale(1.02); }
    100% { background-color: transparent; transform: scale(1); }
}
.flash-highlight {
    animation: flashHighlight 0.6s ease-out;
    border-radius: 12px;
}

/* Status variants */
.status-activo { border-left-color: var(--status-activo); }
.badge-activo { background: rgba(239, 68, 68, 0.2); color: var(--status-activo); }
.status-declarado { border-left-color: var(--status-declarado); }
.badge-declarado { background: rgba(249, 115, 22, 0.2); color: var(--status-declarado); }
.status-controlado { border-left-color: var(--status-controlado); }
.badge-controlado { background: rgba(234, 179, 8, 0.2); color: var(--status-controlado); }
.status-estabilizado { border-left-color: var(--status-estabilizado); }
.badge-estabilizado { background: rgba(59, 130, 246, 0.2); color: var(--status-estabilizado); }
.status-extinguido { border-left-color: var(--status-extinguido); }
.badge-extinguido { background: rgba(34, 197, 94, 0.2); color: var(--status-extinguido); }

/* Premium Floating Glass Nav Pill */
.bottom-nav {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 400px;
    display: flex;
    height: 70px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 35px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
    z-index: 2000;
}

.nav-item {
    background: none; border: none; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 65px; height: 60px; cursor: pointer;
    position: relative;
}

.nav-icon { 
    font-size: 1.5rem; 
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: grayscale(100%) opacity(0.6);
}

.nav-label { 
    font-size: 0.65rem; 
    font-weight: 700; 
    position: absolute;
    bottom: 8px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #fff;
}

.nav-item.active .nav-icon { 
    transform: translateY(-8px) scale(1.1); 
    filter: grayscale(0%) opacity(1);
}

.nav-item.active .nav-label {
    opacity: 1;
    transform: translateY(0);
}

/* Leaflet Overrides */
.leaflet-popup-content-wrapper { background: rgba(255, 255, 255, 0.95); color: #1e293b; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.leaflet-popup-tip { background: rgba(255, 255, 255, 0.95); }
.leaflet-popup-content { min-width: 220px !important; line-height: 1.4; }
.leaflet-container a.leaflet-popup-close-button {
    font-size: 22px !important;
    width: 28px !important;
    height: 28px !important;
    line-height: 24px !important;
    color: #475569 !important;
    padding: 8px 8px 0 0 !important;
}
