/* BAWID Advanced Stylesheet */

:root {
    /* Color Palette - Dark Navy Theme with Yellow Accents */
    --bg-dark: #070e1a;
    --bg-darker: #040810;
    --accent-yellow: #facc15;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    /* Highlight Colors */
    --hi-red: #ef4444;
    /* Extreme/High values */
    --hi-blue: #3b82f6;
    /* Low values */
    --hi-green: #10b981;
    /* Active / Good */
    --hi-cyan: #06b6d4;
    /* Humidity / Rain */
    --hi-orange: #f97316;

    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(16px);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Government Top Header - Sleek Version */
.gov-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    /* Tighter padding */
    background: #060b14;
    /* Solid, very dark premium navy instead of messy gradient */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    /* Subtle border */
    z-index: 1001;
}

.gov-logos-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gov-logo {
    height: 45px;
    /* Much smaller, professional size */
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.gov-titles {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 1rem;
}

.gov-title-hi {
    font-size: 0.75rem;
    /* Smaller, sharper */
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: 0.02em;
}

.gov-subtitle-hi {
    font-size: 1rem;
    /* Reduced bulk */
    font-weight: 700;
    color: #e2e8f0;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
    margin-bottom: 1px;
}

.gov-address {
    font-size: 0.7rem;
    color: #94a3b8;
}

.gov-link {
    font-size: 0.75rem;
    color: var(--accent-yellow);
    /* Make link pop elegantly */
    text-decoration: none;
    margin-top: 2px;
    transition: var(--transition);
}

.gov-link:hover {
    color: #ffffff;
}

.header-right-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    /* Tighter gap */
}

/* Slimmer Weather Animation icon */
.weather-mix {
    position: relative;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
}

.weather-mix i {
    position: absolute;
}

.weather-mix .wi-day-sunny {
    color: var(--accent-yellow);
    font-size: 2rem;
    z-index: 1;
    animation: rotateSun 8s linear infinite;
}

.weather-mix .wi-cloud {
    color: #cbd5e1;
    font-size: 1.6rem;
    z-index: 2;
    transform: translate(-4px, 4px);
}

.weather-mix .wi-rain {
    color: #38bdf8;
    font-size: 1.8rem;
    z-index: 3;
    transform: translate(5px, 15px);
    animation: rainDrop 1.5s ease-in-out infinite;
}

@keyframes rotateSun {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes rainDrop {
    0% {
        opacity: 0;
        transform: translate(5px, 5px);
    }

    50% {
        opacity: 1;
        transform: translate(5px, 15px);
    }

    100% {
        opacity: 0;
        transform: translate(5px, 25px);
    }
}

.btn-home {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-home:hover {
    background: var(--accent-yellow);
    border-color: var(--accent-yellow);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.3);
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.title-icon {
    font-size: 2rem;
    color: var(--accent-yellow);
    filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.5));
}

.brand h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.date-picker-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-picker-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--accent-yellow);
    font-size: 1.2rem;
}

.glass-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.6rem 1rem 0.6rem 2.8rem;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
}

.glass-input:focus {
    border-color: var(--accent-yellow);
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.2);
}

/* Make standard date picker icon invert in dark mode */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.btn-primary {
    background: transparent;
    border: 1px solid var(--accent-yellow);
    color: var(--accent-yellow);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-primary:hover {
    background: rgba(250, 204, 21, 0.1);
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.2);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hi-red);
    background: rgba(239, 68, 68, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--hi-red);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Dashboard Grid */
.dashboard-grid {
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* KPI Cards Section */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.kpi-card {
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.kpi-card:hover::before {
    transform: translateX(100%);
}

.kpi-icon {
    font-size: 2.2rem;
    padding: 0.8rem;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.kpi-icon.heat {
    color: var(--hi-orange);
    background: rgba(249, 115, 22, 0.1);
}

.kpi-icon.cold {
    color: var(--hi-blue);
    background: rgba(59, 130, 246, 0.1);
}

.kpi-icon.alert {
    color: var(--hi-red);
    background: rgba(239, 68, 68, 0.1);
}

.kpi-icon.rain {
    color: var(--hi-cyan);
    background: rgba(6, 182, 212, 0.1);
}

.kpi-icon.station {
    color: var(--hi-green);
    background: rgba(16, 185, 129, 0.1);
}

.kpi-details {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    line-height: 1.2;
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

/* Text Highlights */
.highlight-yellow {
    color: var(--accent-yellow);
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
}

.highlight-blue {
    color: var(--hi-blue);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.highlight-red {
    color: var(--hi-red);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.highlight-cyan {
    color: var(--hi-cyan);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.highlight-green {
    color: var(--hi-green);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* Main Workspace */
.workspace {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    /* 3-Column Split View Layout */
    gap: 1.5rem;
    height: calc(100vh - 250px);
    min-height: 500px;
}

.sidebar {
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.control-group h3 {
    font-size: 1rem;
    color: var(--accent-yellow);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.layer-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.layer-option {
    display: block;
    position: relative;
    cursor: pointer;
}

.layer-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.layer-label {
    display: block;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    transition: var(--transition);
    font-size: 0.9rem;
}

.layer-option:hover .layer-label {
    background: rgba(255, 255, 255, 0.05);
}

.layer-option input:checked~.layer-label {
    background: rgba(250, 204, 21, 0.1);
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
    font-weight: 600;
}

/* Intelligence Feed */
.feed-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.feed-item {
    padding: 0.8rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--accent-yellow);
    font-size: 0.85rem;
    line-height: 1.4;
    animation: slideIn 0.5s ease-out forwards;
}

.feed-item.alert-level {
    border-left-color: var(--hi-red);
    background: rgba(239, 68, 68, 0.05);
}

.feed-item.info-level {
    border-left-color: var(--hi-cyan);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Map Container */
.map-container {
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    padding: 4px;
    /* inner border effect */
}

#biharMap {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: #000;
}

/* Customizing Leaflet popups for dark mode */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--bg-darker) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--accent-yellow) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-popup-content {
    margin: 10px 14px !important;
    line-height: 1.5 !important;
    font-family: 'Inter', sans-serif;
}

.popup-title {
    font-family: 'Outfit', sans-serif;
    color: var(--accent-yellow);
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
    margin-bottom: 8px;
    font-weight: 700;
}

/* ------------------------------------- */
/* QUICK ACTIONS SIDEBAR */
/* ------------------------------------- */

.sidebar-right {
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.7) 0%, rgba(4, 8, 16, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.action-grid-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.action-grid-header h3 {
    font-family: 'Outfit', sans-serif;
    color: var(--accent-yellow);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-grid-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.action-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    text-decoration: none;
    color: #f8fafc;
    transition: var(--transition);
}

.action-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-icon {
    font-size: 2rem;
    margin-top: 4px;
}

.action-text h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.action-text p {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
}

/* ------------------------------------- */

.popup-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.popup-label {
    color: var(--text-muted);
}

.popup-val {
    font-weight: 600;
}

.popup-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    background: rgba(250, 204, 21, 0.1);
    border: 1px solid var(--accent-yellow);
    color: var(--accent-yellow);
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 0.8rem;
    transition: var(--transition);
}

.popup-btn:hover {
    background: var(--accent-yellow);
    color: var(--bg-darker);
}

/* Choropleth Text Labels */
.poly-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    padding: 1rem;
    border-radius: 8px;
    pointer-events: none;
    /* Let clicks pass to map if needed, though usually not */
}

.map-legend h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}


/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 800px;
    border-radius: 16px;
    padding: 2rem;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    color: var(--accent-yellow);
    font-family: 'Outfit', sans-serif;
}

.modal-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--hi-red);
}

.modal-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.metric-val {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.chart-container {
    height: 300px;
    width: 100%;
    position: relative;
}

/* Responsive */
@media (max-width: 1200px) {
    .workspace {
        grid-template-columns: 250px 1fr 280px;
    }
}

@media (max-width: 1024px) {
    .workspace {
        grid-template-columns: 1fr;
        height: auto;
    }

    .map-container {
        height: 500px;
    }

    .sidebar-right {
        order: 2;
        /* Move Action panel below map on mobile */
    }
}

@media (max-width: 768px) {
    .kpi-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .gov-header {
        flex-direction: column;
        text-align: center;
        gap: 1.2rem;
        padding: 1.2rem 1rem;
    }

    .gov-logos-container {
        flex-direction: column;
        gap: 0.8rem;
    }

    .desktop-only {
        display: none !important;
    }

    .navbar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .kpi-cards {
        grid-template-columns: 1fr;
    }

    .modal-metrics {
        grid-template-columns: 1fr;
    }
}