:root {
    --bg-dark: #0f111a;
    --bg-card: rgba(30, 34, 48, 0.7);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --primary-accent: #3b82f6;
    /* Blue for calm/standard */
    --danger-accent: #ef4444;
    /* Red for fire/danger */
    --warning-accent: #f59e0b;
    /* Amber for warning */
    --success-accent: #10b981;
    /* Green for safe */

    --text-main: #f3f4f6;
    --text-muted: #9ca3af;

    --glass-blur: blur(12px);
    --font-main: 'Outfit', sans-serif;
}

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

/* Storm Alert State - Heavy Rain / Grey-Blue Theme */
body.storm-alert {
    background: linear-gradient(to bottom, #1e293b, #0f172a);
    overflow: hidden;
}

#weather-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* Hazard Tape Overlay */
.hazard-tape {
    position: fixed;
    left: 0;
    width: 100%;
    height: 30px;
    z-index: 200;
    pointer-events: none;
    background-size: 50px 50px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.hazard-tape-top {
    top: 0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.5);
}

.hazard-tape-bottom {
    bottom: 0;
    border-top: 2px solid rgba(0, 0, 0, 0.5);
}

/* Fire Tape: Red & Yellow */
.fire-tape {
    background-image: repeating-linear-gradient(-45deg,
            #dc2626,
            #dc2626 15px,
            #facc15 15px,
            #facc15 30px);
    animation: tapeScroll 2s linear infinite;
}

/* Storm Tape: Blue & Black */
.storm-tape {
    background-image: repeating-linear-gradient(-45deg,
            #1d4ed8,
            #1d4ed8 15px,
            #0f172a 15px,
            #0f172a 30px);
    animation: tapeScroll 2s linear infinite;
}

@keyframes tapeScroll {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 50px 0;
    }
}

/* Rain Effect */
.rain-layer {
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 200%;
    background:
        linear-gradient(to bottom, transparent 0%, rgba(200, 220, 255, 0.4) 10%, transparent 20%) 0 0 / 2px 100px,
        linear-gradient(to bottom, transparent 0%, rgba(200, 220, 255, 0.3) 10%, transparent 20%) 50% 0 / 1px 80px;
    animation: rainFall 0.4s linear infinite;
    opacity: 0.5;
}

.rain-layer:nth-child(2) {
    animation-duration: 0.6s;
    opacity: 0.2;
    background-size: 3px 120px, 2px 90px;
    filter: blur(1px);
}

@keyframes rainFall {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(50%);
    }
}

/* Lightning - Subtler Top-Down Flash */
.lightning-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 0%, transparent 60%);
    opacity: 0;
    z-index: 101;
    pointer-events: none;
    mix-blend-mode: overlay;
}

.lightning-active {
    animation: flash 0.3s ease-out;
}

@keyframes flash {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    30% {
        opacity: 0.2;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 0;
    }
}

/* Red Alert State - Realistic Fire Vignette */
body.red-alert {
    background: radial-gradient(circle at 50% 50%, #1a0505 20%, #450a0a 100%);
}

body.red-alert::after {
    /* Vignette pulse instead of full background */
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(220, 38, 38, 0.2) 100%);
    z-index: 90;
    pointer-events: none;
    animation: vignettePulse 2s infinite alternate;
}

@keyframes vignettePulse {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }

    100% {
        opacity: 0.7;
        transform: scale(1.02);
    }
}

/* Embers */
.ember {
    position: absolute;
    bottom: -10px;
    width: 4px;
    height: 4px;
    background: #f59e0b;
    border-radius: 50%;
    box-shadow: 0 0 10px #f97316;
    animation: rise 4s linear forwards;
    opacity: 0;
}

@keyframes rise {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateY(-50vh) translateX(20px) scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: translateY(-100vh) translateX(-20px) scale(0);
        opacity: 0;
    }
}

/* Heat Haze */
body.red-alert::before {
    content: "";
    position: fixed;
    inset: 0;
    backdrop-filter: blur(1px);
    z-index: 99;
    opacity: 0.2;
    animation: heatHaze 5s infinite linear;
}

@keyframes heatHaze {
    0% {
        filter: hue-rotate(0deg);
    }

    50% {
        filter: hue-rotate(-5deg);
    }

    100% {
        filter: hue-rotate(0deg);
    }
}


/* Warning Overlay with Shutters */
.warning-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    /* Always allow clicks through unless specifically blocking */
    display: flex;
    align-items: center;
    justify-content: center;
}

.warning-overlay.active {
    pointer-events: all;
    /* Block clicks only during the active warning phase */
}

.shutter {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    background: rgba(15, 17, 26, 0.95);
    backdrop-filter: blur(15px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

.shutter-top {
    top: 0;
    transform: translateY(-100%);
    border-bottom: 1px solid var(--danger-accent);
}

.shutter-bottom {
    bottom: 0;
    transform: translateY(100%);
    border-top: 1px solid var(--danger-accent);
}

.warning-overlay.active .shutter-top {
    transform: translateY(0);
}

.warning-overlay.active .shutter-bottom {
    transform: translateY(0);
}

.warning-content {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.warning-overlay.active .warning-content {
    opacity: 1;
    transform: scale(1);
    /* Stay visible by default, script will add .retract */
}

.warning-content.retract {
    animation: textRetract 0.8s forwards;
    animation-delay: 0s;
    /* Immediate retraction when class is added */
}

@keyframes textRetract {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(1.1);
    }
}

/* Storm Theme Shutters */
body.storm-alert .shutter-top,
body.storm-alert .shutter-bottom {
    border-color: var(--primary-accent);
}

.warning-content {
    text-align: center;
    z-index: 2;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.5s ease 0.3s;
    /* Delay until shutters close */
}

.warning-overlay.active .warning-content {
    opacity: 1;
    transform: scale(1);
}

.warning-icon {
    font-size: 5rem;
    color: inherit;
    margin-bottom: 1rem;
    animation: blink 0.8s infinite alternate;
}

#warning-text {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* Smooth active states for buttons */
button:active {
    transform: scale(0.95);
}

.icon-btn:active {
    transform: scale(0.92);
}

@keyframes zoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Expert Animations */

/* 1. Staggered Entry */
.card {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.fire-status-card {
    animation-delay: 0.1s;
}

.weather-card {
    animation-delay: 0.2s;
}

.map-card {
    animation-delay: 0.3s;
}

.chart-card {
    animation-delay: 0.4s;
}

.alerts-card {
    animation-delay: 0.5s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 2. Radar Scan Effect for Map */
.map-visual::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg,
            transparent 0%,
            transparent 80%,
            rgba(59, 130, 246, 0.1) 100%);
    transform: translate(-50%, -50%) rotate(0deg);
    border-radius: 50%;
    animation: radarScan 4s linear infinite;
    pointer-events: none;
}

@keyframes radarScan {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* 3. Expert Hover Effects (Glow + Lift) */
.card {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.4s ease,
        border-color 0.4s ease;
}

.card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Pulse for status icons */
.status-indicator .connection-dot {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}


@keyframes blink {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.4;
    }
}



body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(239, 68, 68, 0.08) 0%, transparent 40%);
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(18, 20, 28, 0.95);
    border-right: 1px solid var(--bg-card-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.brand-icon {
    font-size: 1.8rem;
    color: var(--danger-accent);
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-links li.active a,
.nav-links a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success-accent);
    font-size: 0.875rem;
    font-weight: 600;
}

.connection-dot {
    width: 8px;
    height: 8px;
    background: var(--success-accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success-accent);
    animation: pulse 2s infinite;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.location-info h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.location-info .subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-family: var(--font-mono);
}

.top-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    position: relative;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.notification-wrapper {
    position: relative;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 320px;
    background: rgba(18, 20, 28, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--bg-card-border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.notification-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bg-card-border);
    background: rgba(255, 255, 255, 0.02);
}

.notification-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s;
}

.clear-btn:hover {
    color: var(--text-main);
}

.notification-list {
    max-height: 350px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bg-card-border);
    display: flex;
    gap: 0.75rem;
    transition: background 0.2s;
    cursor: pointer;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item i {
    font-size: 1.25rem;
    margin-top: 0.1rem;
}

.notification-item.danger i {
    color: var(--danger-accent);
}

.notification-item.warning i {
    color: var(--warning-accent);
}

.notification-item.success i {
    color: var(--success-accent);
}

.notif-content h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notif-content p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Enhanced Hover Effects for everything */
a,
button,
.card,
.custom-select-trigger {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

button:active,
a:active,
.card:active {
    transform: scale(0.98);
}


.user-profile .avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, minmax(200px, auto));
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--bg-card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Fire Status Card */
.fire-status-card {
    grid-column: span 1;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.risk-gauge {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.gauge-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.gauge-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.gauge-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.gauge-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
    width: 0%;
    /* JS will animate */
    transition: width 1s ease;
}

.card-footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Weather Card */
.weather-card {
    grid-column: span 2;
}

.weather-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    flex: 1;
}

.weather-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weather-item .label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.weather-item .value {
    font-size: 1.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.weather-item .unit {
    font-size: 1rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

/* Map Card */
.map-card {
    grid-column: span 1;
    grid-row: span 2;
    position: relative;
    overflow: hidden;
}

.map-visual {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    position: relative;
    border: 1px solid var(--bg-card-border);
}

.map-grid-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

.pulse-point {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--danger-accent);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px var(--danger-accent);
}

.pulse-point::after {
    content: '';
    position: absolute;
    inset: -10px;
    border: 1px solid var(--danger-accent);
    border-radius: 50%;
    animation: ping 1.5s infinite;
}

/* Charts Card */
.chart-card {
    grid-column: span 2;
}

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

/* Alerts Card */
.alerts-card {
    grid-column: span 1;
}

.alerts-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alert-item {
    display: flex;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-radius: 10px;
    border-left: 3px solid var(--text-muted);
}

.alert-item.warning {
    border-left-color: var(--warning-accent);
}

.alert-item.danger {
    border-left-color: var(--danger-accent);
}

.alert-item i {
    font-size: 1.25rem;
    margin-top: 0.1rem;
}

.alert-item.warning i {
    color: var(--warning-accent);
}

.alert-item.danger i {
    color: var(--danger-accent);
}

.alert-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
}

.alert-content p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes pulse {
    0% {
        opacity: 1;
        box-shadow: 0 0 8px var(--success-accent);
    }

    50% {
        opacity: 0.5;
        box-shadow: 0 0 0px var(--success-accent);
    }

    100% {
        opacity: 1;
        box-shadow: 0 0 8px var(--success-accent);
    }
}

@keyframes ping {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .map-card {
        grid-column: span 2;
        grid-row: span 1;
        min-height: 250px;
    }

    .sidebar {
        width: 80px;
        padding: 2rem 1rem;
    }

    .brand-text,
    .nav-links a span,
    .status-indicator span {
        display: none;
    }

    .nav-links a {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .fire-status-card,
    .weather-card,
    .chart-card,
    .alerts-card,
    .map-card {
        grid-column: span 1;
    }
}

/* Red Alert State - Global Overlay */
body.red-alert {
    background-image:
        radial-gradient(circle at 50% 50%, rgba(239, 68, 68, 0.2) 0%, transparent 60%),
        repeating-linear-gradient(45deg,
            rgba(0, 0, 0, 0.1),
            rgba(0, 0, 0, 0.1) 10px,
            rgba(239, 68, 68, 0.05) 10px,
            rgba(239, 68, 68, 0.05) 20px);
    animation: alertPulse 2s infinite;
}

body.red-alert .sidebar {
    border-right-color: rgba(239, 68, 68, 0.4);
}

body.red-alert .card {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}

@keyframes alertPulse {
    0% {
        box-shadow: inset 0 0 0px rgba(239, 68, 68, 0);
    }

    50% {
        box-shadow: inset 0 0 50px rgba(239, 68, 68, 0.3);
    }

    100% {
        box-shadow: inset 0 0 0px rgba(239, 68, 68, 0);
    }
}

/* Debug Panel */
.debug-panel {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(15, 17, 26, 0.85);
    /* More transparent for glass feel */
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.25rem;
    border-radius: 16px;
    z-index: 9999;
    /* Verify on top */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    width: 260px;
    transform: translateY(0);
    animation: slideInBottom 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.debug-panel:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    background: rgba(15, 17, 26, 0.95);
}

@keyframes slideInBottom {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.debug-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}

.debug-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.debug-controls button {
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-main);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.debug-controls button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.debug-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.debug-controls button:hover::after {
    opacity: 1;
}

.debug-controls button:active {
    transform: translateY(0);
}

.btn-danger {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.2), rgba(220, 38, 38, 0.1));
    color: #f87171;
    border: 1px solid rgba(220, 38, 38, 0.3);
    box-shadow: inset 0 0 10px rgba(220, 38, 38, 0.05);
}

.btn-danger:hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 1), rgba(185, 28, 28, 1));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.2), rgba(217, 119, 6, 0.1));
    color: #fbbf24;
    border: 1px solid rgba(217, 119, 6, 0.3);
    box-shadow: inset 0 0 10px rgba(217, 119, 6, 0.05);
}

.btn-warning:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 1), rgba(217, 119, 6, 1));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-neutral:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Custom Dropdown Styles */
.custom-select-container {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-select-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.custom-select-trigger i {
    font-size: 1rem;
    color: var(--text-muted);
}

.custom-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #1e2230;
    /* Hardcoded dark bg to ensure visibility on top of other cards */
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 200px;
    overflow-y: auto;
}

.custom-select-container.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0);
}

.custom-option {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.custom-option:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    padding-left: 1.25rem;
    /* Slight shift effect */
}

.custom-option.selected {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    font-weight: 600;
}

/* Mobile adjustments for debug panel */
@media (max-width: 768px) {
    .debug-panel {
        width: calc(100% - 2rem);
        right: 1rem;
        left: 1rem;
        bottom: 5rem;
        /* Above nav bar if bottom nav exists, or just higher */
    }
}

/* PDF Print Styles */
.pdf-container-hidden {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1000;
    opacity: 0;
    pointer-events: none;
}

.report-page-a4 {
    width: 210mm;
    height: 297mm;
    background: #ffffff;
    color: #1a1a1a;
    padding: 20mm;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
}

.report-page-header {
    border-bottom: 2px solid #10b981;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.report-page-header .brand {
    font-size: 14px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-page-footer {
    position: absolute;
    bottom: 20mm;
    left: 20mm;
    right: 20mm;
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #94a3b8;
}

.report-content-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.report-page-a4 p {
    font-size: 12px;
    line-height: 1.6;
    color: #334155;
    text-align: justify;
}

.report-page-a4 h2 {
    font-size: 16px;
    color: #0f172a;
    margin-bottom: 0.5rem;
    border-left: 4px solid #10b981;
    padding-left: 0.75rem;
}

.report-page-a4 h3 {
    font-size: 14px;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.report-page-a4 .stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.report-page-a4 .stat-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.report-page-a4 .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.report-page-a4 .stat-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* KPI Grid Styles for PDF */
.report-page-a4 .kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.report-page-a4 .kpi-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.report-page-a4 .kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.report-page-a4 .kpi-label {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.report-page-a4 .kpi-trend {
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.report-page-a4 .kpi-trend.up {
    color: #10b981;
}

.report-page-a4 .kpi-trend.down {
    color: #ef4444;
}

/* Table Styles for PDF */
.report-page-a4 table,
.report-page-a4 .data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 11px;
}

.report-page-a4 table thead,
.report-page-a4 .data-table thead {
    background: #f1f5f9;
}

.report-page-a4 table th,
.report-page-a4 .data-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #0f172a;
    border-bottom: 2px solid #e2e8f0;
}

.report-page-a4 table td,
.report-page-a4 .data-table td {
    padding: 0.75rem;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
}

.report-page-a4 table tr:last-child td,
.report-page-a4 .data-table tr:last-child td {
    border-bottom: none;
}

/* List Styles for PDF */
.report-page-a4 ul,
.report-page-a4 .recommendations-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.report-page-a4 li {
    margin-bottom: 0.5rem;
    font-size: 12px;
    line-height: 1.6;
    color: #334155;
}

/* Alert Timeline Styles for PDF */
.report-page-a4 .alert-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.report-page-a4 .alert-item {
    background: #f8fafc;
    border-left: 4px solid #94a3b8;
    padding: 1rem;
    border-radius: 4px;
}

.report-page-a4 .alert-item.critical {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.report-page-a4 .alert-item.warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.report-page-a4 .alert-item.info {
    border-left-color: #3b82f6;
    background: #eff6ff;
}

.report-page-a4 .alert-header-content {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.report-page-a4 .alert-title-text {
    font-weight: 600;
    font-size: 12px;
    color: #0f172a;
}

.report-page-a4 .alert-timestamp {
    font-size: 10px;
    color: #64748b;
}

.report-page-a4 .alert-description {
    font-size: 11px;
    color: #475569;
    line-height: 1.5;
}

.report-page-a4 .severity-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
}

.report-page-a4 .severity-badge.critical {
    background: #fee2e2;
    color: #991b1b;
}

.report-page-a4 .severity-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.report-page-a4 .severity-badge.info {
    background: #dbeafe;
    color: #1e40af;
}

/* Preview Section Styles for PDF */
.report-page-a4 .preview-section {
    margin-bottom: 1.5rem;
}

.report-page-a4 .metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.report-page-a4 .metric-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    border-radius: 6px;
    text-align: center;
}

.report-page-a4 .metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.report-page-a4 .metric-label {
    font-size: 10px;
    color: #64748b;
    margin-top: 0.25rem;
}

/* Chart Container Styles for PDF */
.report-page-a4 .report-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 1rem 0;
}

.report-page-a4 .report-chart-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
}

.report-page-a4 .chart-container-sm {
    width: 100%;
    height: 200px;
}

.report-page-a4 img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Badge and Status Styles for PDF */
.report-page-a4 .stat-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    background: #dbeafe;
    color: #1e40af;
}

/* Remove dark theme styles in PDF */
.report-page-a4 * {
    background-color: transparent !important;
}

.report-page-a4 .preview-section {
    background: transparent !important;
    border: none !important;
}
/* Force PDF content to use light theme colors - CRITICAL OVERRIDES */
.report-page-a4 p, .report-page-a4 .report-text { color: #334155 !important; background: transparent !important; }
.report-page-a4 h2 { color: #0f172a !important; background: transparent !important; border-right: none !important; border-top: none !important; border-bottom: none !important; }
.report-page-a4 h3 { color: #0f172a !important; background: transparent !important; }
.report-page-a4 strong, .report-page-a4 b { color: #0f172a !important; }
.report-page-a4 .preview-section { background: transparent !important; border: none !important; padding: 0 !important; }
.report-page-a4 div { background: transparent !important; }
.report-page-a4 span { color: inherit !important; }
.report-page-a4 table th { background: #f1f5f9 !important; color: #0f172a !important; }
.report-page-a4 table td { background: transparent !important; color: #334155 !important; }
.report-page-a4 * { background-color: transparent !important; }
