:root {
    /* Sophisticated Light Palette */
    --bg-light: #F8FAFC;
    --bg-surface: #FFFFFF;
    --surface-glass: rgba(255, 255, 255, 0.7);
    
    --brand-emerald: #10B981;
    --brand-sky: #0EA5E9;
    --brand-amber: #F59E0B;
    --brand-red: #EF4444;
    
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    
    --border-light: rgba(0, 0, 0, 0.05);
    --border-active: rgba(16, 185, 129, 0.3);
    
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 10px -2px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-background {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.05), transparent 50%),
                radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.05), transparent 50%);
    z-index: -1;
}

.glass-panel {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
}

.glass-panel:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    padding: 2rem 1.5rem;
    display: flex; flex-direction: column;
    margin: 1rem;
    height: calc(100vh - 2rem);
    position: sticky; top: 1rem;
    border-radius: 20px;
}

.brand { display: flex; align-items: center; gap: 1rem; }
.brand-icon { font-size: 28px; color: var(--brand-emerald); }
.brand h2 { font-size: 1.8rem; font-weight: 700; background: linear-gradient(to right, var(--brand-emerald), var(--brand-sky)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.brand-subtitle { font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin-top: 0.2rem; padding-left: 3.2rem; font-weight: 600;}

.mt-4 { margin-top: 2rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-auto { margin-top: auto; }

.nav-links { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.nav-links li a {
    text-decoration: none; color: var(--text-secondary);
    display: flex; align-items: center; gap: 1rem;
    padding: 14px 16px; border-radius: 12px;
    font-size: 15px; font-weight: 500;
    transition: all 0.25s ease;
}
.nav-links li a i { width: 22px; font-size: 18px; text-align: center; }
.nav-links li a:hover { background: rgba(0, 0, 0, 0.03); color: var(--text-primary); }
.nav-links li.active a { background: rgba(16, 185, 129, 0.08); color: var(--brand-emerald); font-weight: 600; }

.environmental-score {
    padding: 1.5rem; background: #EEF2F6; border-radius: 16px;
}
.score-label { font-size: 11px; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 1px; font-weight: 700;}
.score-value { font-size: 24px; font-weight: 700; color: var(--brand-emerald); margin: 0.5rem 0;}
.score-bar { background: rgba(0, 0, 0, 0.05); height: 8px; border-radius: 4px; overflow: hidden; }
.score-fill { background: linear-gradient(90deg, var(--brand-sky), var(--brand-emerald)); width: 94.2%; height: 100%; border-radius: 4px;}

/* Content */
.content { flex: 1; padding: 2.5rem 2rem; max-width: 1400px; transition: padding 0.3s ease; }
.topbar { margin-bottom: 2.5rem; }
.topbar h1 { font-size: 2.2rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; line-height: 1.2; }
.topbar .subtitle { color: var(--text-secondary); font-size: 16px; margin-top: 0.6rem; font-weight: 400; }

.mobile-nav-header { display: none; margin-bottom: 1.5rem; align-items: center; justify-content: space-between; gap: 1rem; }
.mobile-logo { font-size: 1.4rem; font-weight: 800; color: var(--brand-emerald); }
#menu-toggle {
    width: 45px; height: 45px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 18px; color: var(--text-primary);
}

/* Tabs */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.4s ease-out; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tracking Banner */
.live-tracker {
    display: flex; flex-direction: column; padding: 1.5rem 2rem;
    border-left: 5px solid var(--brand-sky);
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.02) 0%, transparent 100%);
}
.live-header { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 2px; display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.5rem; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background-color: var(--brand-sky); box-shadow: 0 0 8px var(--brand-sky); animation: pulse 2s infinite; }

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(14, 165, 233, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

.live-counter { font-size: 2.8rem; font-weight: 600; color: var(--text-primary); line-height: 1; margin: 0.5rem 0;}
.live-counter .unit { font-size: 18px; color: var(--text-secondary); font-weight: 500; margin-left: 8px;}
.live-sub { font-size: 13px; color: var(--text-secondary); }

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.2rem; margin-bottom: 2rem;}
.kpi-card { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.8rem; height: 100%;}
.kpi-icon-wrapper {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.kpi-icon-wrapper.resource { background: #E0F2FE; color: var(--brand-sky); }
.kpi-icon-wrapper.energy { background: #FEF3C7; color: var(--brand-amber); }
.kpi-icon-wrapper.waste { background: #D1FAE5; color: var(--brand-emerald); }
.kpi-icon-wrapper.danger { background: #FEE2E2; color: var(--brand-red); }
.kpi-icon-wrapper.equity { background: #F5F3FF; color: #7C3AED; }

.kpi-title { color: var(--text-secondary); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;}
.kpi-value { font-size: 1.8rem; font-weight: 700; color: var(--text-primary); margin: 2px 0; }
.kpi-trend { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 4px;}
.kpi-trend.good { color: var(--brand-emerald); }
.kpi-trend.bad { color: var(--brand-red); }

/* charts */
.charts-wrapper { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.chart-card { padding: 1.8rem; border-radius: 20px;}
.card-header { margin-bottom: 1.5rem; padding-bottom: 15px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: flex-start;}
.card-header h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.card-desc { color: var(--text-secondary); font-size: 14px; font-weight: 400;}
.info-badge { background: #F1F5F9; color: var(--text-secondary); padding: 5px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; border: 1px solid var(--border-light); }

.chart-container { position: relative; width: 100%; }

/* Insight Panels */
.insight-panel {
    background: #F8FAFC; border-left: 4px solid var(--brand-emerald);
    padding: 1.2rem; border-radius: 0 12px 12px 0;
    display: flex; gap: 1rem; align-items: flex-start; margin-top: 1.5rem;
}
.highlight-icon { color: var(--brand-amber); font-size: 1.2rem; margin-top: 2px;}
.insight-text { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.insight-text strong { color: var(--text-primary); font-weight: 600;}

/* Optimization Grid */
.optimization-grid { display: flex; flex-direction: column; gap: 1.5rem; }
.opt-goal { padding: 2rem; border-radius: 20px;}
.opt-goal:nth-child(1) { border-left: 6px solid var(--brand-sky); }
.opt-goal:nth-child(2) { border-left: 6px solid var(--brand-amber); }
.opt-goal:nth-child(3) { border-left: 6px solid var(--brand-red); }

.opt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.opt-title { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 12px; }
.opt-status { font-size: 12px; font-weight: 700; padding: 6px 14px; border-radius: 20px; text-transform: uppercase;}
.status-in-progress { background: #E0F2FE; color: var(--brand-sky); }
.status-pending { background: #FEF3C7; color: var(--brand-amber); }
.status-critical { background: #FEE2E2; color: var(--brand-red); }

.opt-desc { font-size: 15px; color: var(--text-secondary); margin-bottom: 1.5rem; line-height: 1.6;}
.opt-stats { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }

/* Maps Styling */
.map-container { height: 450px; width: 100%; border-radius: 16px; overflow: hidden; margin-top: 1rem; border: 1px solid var(--border-light);}
.leaflet-container { background: #F1F5F9 !important; font-family: 'Outfit', sans-serif !important;}
.leaflet-popup-content-wrapper { border-radius: 12px !important; box-shadow: var(--shadow-soft) !important; padding: 5px !important;}
.leaflet-popup-tip { box-shadow: none !important; }

/* REPOSNSIVE MEDIA QUERIES */

@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .sidebar { width: 240px; }
    .content { padding: 2rem 1.5rem; }
    .topbar h1 { font-size: 1.8rem; }
}

@media (max-width: 768px) {
    .app-container { display: block; }
    
    .mobile-nav-header { display: flex; }
    
    .sidebar {
        position: fixed; top: 0; left: 0;
        width: 280px; height: 100vh;
        z-index: 1000; margin: 0;
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        border-radius: 0 20px 20px 0;
    }
    
    .sidebar.active { transform: translateX(0); }
    
    .content { padding: 1rem; margin: 0; width: 100%; }
    .topbar h1 { font-size: 1.5rem; }
    
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-wrapper { grid-template-columns: 1fr; }
    
    .live-counter { font-size: 2rem; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .topbar h1 { font-size: 1.3rem; }
    .live-counter { font-size: 1.8rem; }
}
