:root {
    --bg-color: #05060a;
    --card-bg: rgba(20, 22, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #e0e6ed;
    --text-secondary: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-green: #4ade80;
    --accent-red: #f87171;
    --accent-amber: #fbbf24;
    --font-main: 'Inter', sans-serif;
    --font-display: 'Orbitron', sans-serif;
    --glow-blue: 0 0 15px rgba(56, 189, 248, 0.4);
}

/* Light Theme - Applied during daytime (7:00 - 20:00) */
body.light-theme {
    --bg-color: #f0f4f8;
    --card-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-blue: #0284c7;
    --accent-green: #16a34a;
    --accent-red: #dc2626;
    --accent-amber: #d97706;
    --glow-blue: 0 0 15px rgba(2, 132, 199, 0.3);
    /* Light theme background gradients */
    background-image:
        radial-gradient(at 0% 0%, rgba(2, 132, 199, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(22, 163, 74, 0.08) 0px, transparent 50%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(74, 222, 128, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
    /* Videowall behavior */
    height: 100vh;
    /* Smooth theme transition */
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Transition for all themed elements */
.panel-card,
.main-header,
.ticker-container {
    transition: background-color 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    height: 70px;
    overflow: hidden;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.app-logo {
    height: 55px;
    max-height: 55px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.2));
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-text h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.airport-id {
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 3px;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
}

.highlight {
    color: var(--accent-blue);
    text-shadow: var(--glow-blue);
}

.header-info {
    display: flex;
    gap: 3rem;
    align-items: center;
}

.clock-container {
    text-align: right;
}

#current-time {
    font-size: 1.6rem;
    font-family: var(--font-display);
    font-weight: bold;
    color: var(--accent-blue);
    line-height: 1;
}

#current-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.admin-btn {
    text-decoration: none;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--accent-blue);
    transform: rotate(45deg);
}

/* Alerts and Emergencies */
.hidden {
    display: none !important;
}

.meteo-badge {
    background: var(--accent-amber);
    color: black;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    animation: flash 1s infinite;
    white-space: nowrap;
}

.lvp-badge {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    animation: flash 1.5s infinite;
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.emergency-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 38, 38, 0.9);
    border: 4px solid white;
    padding: 1rem 2rem;
    border-radius: 12px;
    z-index: 9999;
    box-shadow: 0 0 50px rgba(220, 38, 38, 0.8);
    animation: critical-flash 0.5s infinite;
    min-width: 400px;
}

.emergency-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.emergency-icon {
    font-size: 3rem;
}

.emergency-text h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin: 0;
}

.emergency-text p {
    font-weight: bold;
    font-size: 1.2rem;
    margin: 0;
}

@keyframes flash {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

@keyframes critical-flash {
    0% {
        background: rgba(220, 38, 38, 0.9);
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        background: rgba(153, 27, 27, 1);
        transform: translate(-50%, -50%) scale(1.05);
    }

    100% {
        background: rgba(220, 38, 38, 0.9);
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Sanitary Alert Banner */
.sanitary-banner {
    background: rgba(16, 185, 129, 0.95) !important;
    box-shadow: 0 0 50px rgba(16, 185, 129, 0.8) !important;
    animation: sanitary-pulse 1.5s infinite !important;
}

@keyframes sanitary-pulse {
    0% {
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.8);
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        box-shadow: 0 0 60px rgba(16, 185, 129, 1);
        transform: translate(-50%, -50%) scale(1.02);
    }

    100% {
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.8);
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Security Alert Banner */
.security-banner {
    background: rgba(139, 92, 246, 0.95) !important;
    box-shadow: 0 0 50px rgba(139, 92, 246, 0.8) !important;
    animation: security-flash 0.8s infinite !important;
}

@keyframes security-flash {
    0% {
        background: rgba(139, 92, 246, 0.95);
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        background: rgba(234, 179, 8, 0.95);
        transform: translate(-50%, -50%) scale(1.03);
    }

    100% {
        background: rgba(139, 92, 246, 0.95);
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-green);
}

.pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        transform: scale(0.95);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(0.95);
        opacity: 1;
    }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Row 1: Top Panels (fixed portion of screen), Row 2: Stats Bar (auto), Row 3: Flights (remaining) */
    grid-template-rows: 260px auto 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    padding-right: 0.75rem;
    /* Reclaimed space */
    height: calc(100vh - 70px - 50px);
    box-sizing: border-box;
    margin-bottom: 50px;
}

#data-row-main {
    min-height: 0;
}

/* High Resolution Adaptation (2560x1600) */
@media (min-width: 2500px) {
    :root {
        font-size: 115%;
        /* Increase base font size slightly */
    }

    .dashboard-grid {
        grid-template-rows: 320px auto 1fr;
        gap: 1.25rem;
        padding: 1.25rem;
    }

    .main-header {
        height: 90px;
        padding: 1rem 3rem;
    }

    .app-logo {
        height: 70px;
        max-height: 70px;
    }

    .logo-text h1 {
        font-size: 2.2rem;
    }

    #current-time {
        font-size: 2.4rem;
    }

    .stats-grid {
        gap: 3rem;
    }

    .stat-value {
        font-size: 2.5rem;
    }

    td {
        padding: 0.8rem 1rem;
    }

    .ticker-container {
        height: 65px;
        font-size: 1.2rem;
    }

    .ticker-label {
        font-size: 1.3rem;
    }
}

.full-width {
    grid-column: span 4;
    overflow: hidden;
}

.panel-card {
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
    /* Important: allow flex child to shrink and scroll */
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.3rem;
}

.card-header h2 {
    font-size: 0.85rem;
    font-family: var(--font-display);
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.badge {
    background: var(--accent-red);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.flight-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-block;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.2px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Note: .airline-logo-small defined in Flight Tables section below */

/* Runway */
.runway-item {
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--accent-blue);
    border-radius: 4px;
}

/* LVP Panel (as one of 4 top boxes) */
.lvp-panel {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.15), rgba(245, 158, 11, 0.1)) !important;
    border: 2px solid rgba(251, 146, 60, 0.5) !important;
    animation: lvp-glow 2s ease-in-out infinite;
}

.lvp-badge-active {
    background: linear-gradient(135deg, #f97316, #dc2626);
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.6);
    animation: flash 1s infinite;
}

.lvp-panel-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.lvp-phase-main {
    font-family: var(--font-display);
    font-size: 2.22rem;
    font-weight: bold;
    color: #fed7aa;
    text-shadow: 0 0 20px rgba(251, 146, 60, 0.8);
    text-align: center;
    padding: 0.5rem 0;
    letter-spacing: 1px;
}

.lvp-detail {
    font-size: 1.4rem;
    color: #fbbf24;
    text-align: center;
    font-weight: 700;
    margin-top: 0.5rem;
    text-transform: uppercase;
}

.lvp-action {
    font-size: 1.1rem;
    color: var(--text-primary);
    text-align: center;
    margin-top: 0.5rem;
    line-height: 1.4;
    font-weight: 500;
}

body.light-theme .lvp-phase-main {
    color: #c2410c;
    text-shadow: 0 0 10px rgba(251, 146, 60, 0.3);
}

@keyframes lvp-glow {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(251, 146, 60, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(251, 146, 60, 0.4);
    }
}

/* METEO Adversa Panel */
.meteo-panel {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1)) !important;
    border: 2px solid rgba(251, 191, 36, 0.5) !important;
    animation: meteo-glow 2s ease-in-out infinite;
}

.meteo-panel.rain-active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(14, 165, 233, 0.1)) !important;
    border: 2px solid rgba(56, 189, 248, 0.5) !important;
}

.meteo-panel.wind-active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(139, 92, 246, 0.1)) !important;
    border: 2px solid rgba(168, 85, 247, 0.5) !important;
}

.meteo-panel.storm-active {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1)) !important;
    border: 2px solid rgba(251, 191, 36, 0.5) !important;
}

.meteo-panel.storm-torm3 {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.15)) !important;
    border: 2px solid rgba(239, 68, 68, 0.6) !important;
    animation: meteo-critical 0.8s ease-in-out infinite;
}

.meteo-badge-active {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
    animation: flash 1s infinite;
}

.meteo-badge-active.rain {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

.meteo-badge-active.wind {
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    color: #fff;
}

.meteo-badge-active.storm-critical {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.meteo-panel-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.meteo-phase-main {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: bold;
    color: #fcd34d;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
    text-align: center;
    padding: 0.5rem 0;
    letter-spacing: 1px;
}

.meteo-panel.rain-active .meteo-phase-main {
    color: #7dd3fc;
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
}

.meteo-panel.wind-active .meteo-phase-main {
    color: #c4b5fd;
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
}

.meteo-panel.storm-torm3 .meteo-phase-main {
    color: #fca5a5;
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

.meteo-detail {
    font-size: 1.6rem;
    color: #fbbf24;
    text-align: center;
    font-weight: 800;
    margin-top: 0.5rem;
}

.meteo-action {
    font-size: 1.2rem;
    color: #e2e8f0;
    text-align: center;
    margin-top: 0.5rem;
    line-height: 1.4;
    font-weight: 500;
}

body.light-theme .meteo-phase-main {
    color: #b45309;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

/* Responsive adjustments for Alert Panels in Grid Layout (Sidebar mode) */
#top-right-region {
    grid-column: span 1 !important;
    display: flex;
    min-width: 0;
    /* Critical for flex/grid child to shrink */
    overflow: hidden;
    /* Prevent spillover */
}

#top-right-region .meteo-panel,
#top-right-region .lvp-panel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.5rem !important;
    /* Force small padding */
}

#top-right-region .meteo-phase-main,
#top-right-region .lvp-phase-main {
    font-size: 1.2rem;
    /* Adjusted for readability */
    text-align: left;
    margin-bottom: 0.1rem;
    line-height: 1.1;
    color: #fff;
    /* Increased contrast (white on dark/colored bg) */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    /* Stronger shadow */
    font-weight: 800;
}

#top-right-region .meteo-detail,
#top-right-region .lvp-detail {
    font-size: 1rem;
    text-align: left;
    margin-top: 0.1rem;
    white-space: normal;
    color: #fcd34d;
    /* Bright amber for details */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#top-right-region .meteo-action,
#top-right-region .lvp-action {
    font-size: 0.85rem;
    text-align: left;
    margin-top: 0.2rem;
    line-height: 1.2;
    color: #e2e8f0;
    /* Light gray for action text */
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
}

#top-right-region .meteo-panel-content,
#top-right-region .lvp-panel-content {
    align-items: flex-start;
    /* Left align flex items */
    justify-content: flex-start;
    /* Top align */
    padding: 0;
}

#top-right-region .meteo-action,
#top-right-region .lvp-action {
    font-size: 0.8rem;
    text-align: left;
    margin-top: 0.2rem;
    line-height: 1.2;
}

#top-right-region .meteo-panel-content,
#top-right-region .lvp-panel-content {
    align-items: flex-start;
    /* Left align flex items */
    justify-content: center;
    padding: 0;
}

/* Hide or shrink icons */
#top-right-region .meteo-icon-large {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

@keyframes meteo-glow {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
    }
}

@keyframes meteo-critical {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 25px rgba(239, 68, 68, 0.7);
        transform: scale(1.01);
    }
}

/* Active Runway Display */
.active-runway {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(34, 211, 238, 0.15));
    border: 2px solid var(--accent-blue);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.active-runway-label {
    font-size: 1.2rem;
    color: var(--accent-blue);
    font-weight: 600;
    letter-spacing: 1px;
}

.active-runway-name {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: bold;
    color: var(--accent-blue);
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
}

.runway-id {
    font-weight: bold;
    font-size: 0.9rem;
}

.runway-state {
    font-size: 0.75rem;
    padding: 1px 0;
    margin: 2px 0;
}

.runway-state.open {
    color: var(--accent-green);
}

.runway-state.standby {
    color: var(--accent-amber);
}

.runway-state.closed {
    color: var(--accent-red);
}

.runway-details {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Stats */
#resource-stats {
    display: flex !important;
    flex-direction: column;
    min-height: 130px;
    /* Increased height for more air */
    justify-content: space-evenly;
    /* Distribute content vertically */
    grid-row: 2;
    grid-column: 1 / -1;
}

.stats-grid {
    display: flex;
    gap: 2rem;
}

.stat-box {
    flex: 1;
}

/* Ensure top right panels fill height */
#top-right-region>section {
    flex: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.8rem;
    font-family: var(--font-display);
    font-weight: bold;
    margin-bottom: 0.1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

/* Force flight list headers to align lower */
.live-list-box h3 {
    margin-top: 0.5rem;
    font-size: 1.2rem !important;
}

.live-flights-container {
    margin-top: 0.5rem !important;
    border-top: 1px solid var(--accent-blue) !important;
    padding-top: 0.5rem !important;
    flex: 1;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue);
}

/* Weather Section */
.weather-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.weather-temp {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: bold;
    color: var(--accent-blue);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.weather-icon {
    font-size: 1.5rem;
}

.weather-time {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.weather-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 0.5rem;
}

.weather-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.weather-label {
    color: var(--text-secondary);
}

.weather-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Flight Stats */
.flight-count {
    color: var(--accent-green);
}

.qnh-value {
    font-size: 1rem !important;
    color: var(--accent-amber);
}

/* Stats Grid - unified definition (see also line 765) */
/* Using grid for 4-column layout in stats section */

/* Airport Facilities Grid */
.facilities-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.facility-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid var(--glass-border);
}

.facility-icon {
    font-size: 1.4rem;
    width: 2rem;
    text-align: center;
}

.facility-info {
    flex: 1;
    min-width: 0;
}

.facility-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.facility-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-blue);
}

.facility-detail {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

@media (max-width: 1200px) {
    .split-section-container {
        flex-direction: column;
    }

    .runway-weather-container {
        flex-direction: column;
    }

    .weather-part {
        border-left: none !important;
        padding-left: 0 !important;
        border-top: 1px solid var(--glass-border);
        padding-top: 1rem;
    }
}

/* Weather Mini Grid Styles */
.weather-item-mini {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    /* gap: 0.1rem; REMOVED to allow custom gap control in inline styles */
}

.weather-item-mini .weather-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.weather-item-mini .weather-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* Collapsible Section */
.collapsible-section details {
    width: 100%;
}

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
}

.collapsible-header::-webkit-details-marker {
    display: none;
}

.expand-icon {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

details[open] .expand-icon {
    transform: rotate(180deg);
}

details summary {
    padding: 0.75rem 1rem;
}

details .facilities-grid {
    padding: 0 1rem 1rem;
}

/* Unavailabilities */
.unavail-badge {
    background: var(--accent-amber);
    color: #000;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.no-unavail-message {
    text-align: center;
    padding: 2rem;
    color: var(--accent-green);
    font-size: 1.2rem;
}

.type-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-stand {
    background: var(--accent-blue);
}

.type-puerta {
    background: var(--accent-green);
    color: #000;
}

.type-pasarela {
    background: var(--accent-amber);
    color: #000;
}

.type-apu {
    background: #9c27b0;
}

.type-gpu {
    background: #ff5722;
}

.type-taxiway {
    background: #795548;
}

.type-hipódromo {
    background: #00bcd4;
    color: #000;
}

.type-cinta {
    background: #3f51b5;
}

.type-mostrador {
    background: #e91e63;
}

.type-facturación {
    background: #8bc34a;
    color: #000;
}

.type-pista {
    background: #37474f;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.type-embarque {
    background: #2196f3;
    color: #fff;
}

.type-desembarque {
    background: #03a9f4;
    color: #000;
}

.type-vial {
    background: #607d8b;
    color: #fff;
}

.type-parking {
    background: #9e9e9e;
    color: #000;
}

.type-zona {
    background: #757575;
    color: #fff;
}

.resource-id {
    font-weight: 700;
    color: var(--accent-blue);
}

.status-active-badge {
    background: rgba(255, 152, 0, 0.2);
    color: var(--accent-amber);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Admin unavailability styles */
.unavail-edit-row {
    display: grid;
    grid-template-columns: 40px repeat(6, 1fr) auto;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    align-items: center;
    border-left: 3px solid var(--accent-amber);
}

.unavail-edit-row.active {
    border-left-color: var(--accent-red);
    background: rgba(255, 87, 34, 0.1);
}

.unavail-edit-row.past {
    opacity: 0.5;
    border-left-color: var(--text-secondary);
}

.status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.status-active {
    background: var(--accent-red);
}

.status-pending {
    background: var(--accent-amber);
    color: #000;
}

.status-past {
    background: var(--text-secondary);
}

.unavail-type-badge {
    background: var(--accent-blue);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
}

.unavail-id {
    font-weight: 700;
    color: var(--text-primary);
}

/* Table */
.table-container {
    overflow-y: auto;
    flex-grow: 1;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 0.8rem 0.6rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

#unavail-table {
    table-layout: fixed;
}

.flight-table {
    table-layout: fixed;
    /* Forced fixed to respect percentages */
    width: 100%;
    border-collapse: separate;
    /* Changed to separate for better cell control */
    border-spacing: 0;
}

td {
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 1.1rem;
    font-weight: 600;
    vertical-align: middle;
    color: var(--text-primary);
}

/* Light theme table adjustments */
body.light-theme td {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.light-theme th {
    border-bottom-color: rgba(0, 0, 0, 0.15);
}

body.light-theme tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

.flight-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flight-table img {
    vertical-align: middle;
    margin-right: 5px;
    height: 1.3rem;
}

/* Flight Table Column Optimization - User Final Ratios */
.flight-table th:nth-child(1) {
    width: 20%;
    /* Hora */
}

.flight-table th:nth-child(2) {
    width: 40%;
    /* Vuelo (Logo + Code) */
}

.flight-table th:nth-child(3) {
    width: 15%;
    /* Origen/Dest (IATA) */
}

.flight-table th:nth-child(4) {
    width: 25%;
    /* Estado */
    text-align: right;
}

.flight-table td:nth-child(4) {
    text-align: right;
    padding-right: 0.8rem;
    /* Safety margin for right-aligned text */
}

/* Info */

tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.status-occupied {
    color: var(--accent-amber);
}

.status-free {
    color: var(--accent-green);
}

.status-boarding {
    color: var(--accent-blue);
}

.status-landed {
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.status-delayed {
    color: var(--accent-amber);
    background: rgba(245, 158, 11, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.status-cancelled {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.status-diverted {
    background: #f97316;
    color: white !important;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.6);
    animation: critical-pulse 1.5s infinite;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes critical-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(249, 115, 22, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    }
}

/* Specific Table Column Widths for Videowall */
#unavail-table {
    table-layout: fixed;
    width: 100%;
}

#unavail-table th:nth-child(1) {
    width: 22%;
    /* Recurso - Increased slightly to avoid overlap */
}

#unavail-table th:nth-child(2) {
    width: 15%;
    /* Fin */
}

#unavail-table th:nth-child(3) {
    width: 63%;
    /* Motivo */
}

/* Motivo (flexible) */

/* Add some spacing to the "Motivo" column content */
#unavail-table td:nth-child(3) {
    white-space: normal;
    line-height: 1.15;
    font-size: 0.82rem;
    padding-right: 0.5rem;
    vertical-align: top;
}

#unavail-table td {
    padding: 0.4rem 0.5rem;
    vertical-align: top;
    font-size: 0.8rem;
}

#unavail-table td:nth-child(1) {
    color: var(--accent-blue);
    font-weight: bold;
    word-break: break-word;
    /* Ensure long IDs don't overflow */
    overflow-wrap: anywhere;
}

/* Ticker Fixed Bottom */
.ticker-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 2rem;
    background: rgba(10, 11, 20, 0.98);
    /* Much darker and more opaque */
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    border-radius: 0;
    margin: 0;
}

.ticker-label {
    color: #fbbf24;
    font-weight: bold;
    white-space: nowrap;
    text-shadow: 0 0 5px rgba(251, 191, 36, 0.5);
}

.ticker-content {
    flex-grow: 1;
    overflow: hidden;
}

.ticker-content p {
    white-space: nowrap;
    animation: ticker 30s linear infinite;
    color: #ffffff !important;
    /* Force pure white */
    font-weight: 500;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    /* Strong shadow for readability */
}

@keyframes ticker {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Scrollbar - Optimized for Videowall Visibility */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.5);
    /* Cyan glow */
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* ========== RESPONSIVE DESIGN ========== */

/* Tablets and smaller desktops (max 1200px) */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .full-width,
    .lvp-section {
        grid-column: span 2;
    }
}

/* Tablets (max 1024px) */
@media (max-width: 1024px) {
    .main-header {
        padding: 0.5rem 1rem;
        height: auto;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .logo h1 {
        font-size: 1.2rem;
    }

    .header-info {
        gap: 1.5rem;
    }

    #current-time {
        font-size: 1.3rem;
    }

    .dashboard-grid {
        height: auto;
        min-height: calc(100vh - 80px);
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .panel-card {
        padding: 0.75rem;
    }

    .lvp-phase-main {
        font-size: 1.1rem;
    }

    .lvp-detail {
        font-size: 0.85rem;
    }
}

/* Mobile landscape and small tablets (max 768px) */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .full-width,
    .lvp-section {
        grid-column: span 1;
    }

    .main-header {
        justify-content: center;
        text-align: center;
    }

    .logo {
        width: 100%;
    }

    .header-info {
        width: 100%;
        justify-content: space-around;
    }

    .stats-grid {
        flex-direction: column;
        gap: 1rem;
    }

    th,
    td {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .ticker-label {
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }
}

/* Mobile portrait (max 480px) */
@media (max-width: 480px) {
    .main-header {
        padding: 0.5rem;
    }

    .logo h1 {
        font-size: 1rem;
    }

    .airport-id {
        font-size: 0.65rem;
    }

    #current-time {
        font-size: 1.1rem;
    }

    #current-date {
        font-size: 0.65rem;
    }

    .card-header h2 {
        font-size: 0.75rem;
    }

    .lvp-phase-main {
        font-size: 1rem;
    }

    .lvp-detail {
        font-size: 0.8rem;
    }

    .lvp-action {
        font-size: 0.7rem;
    }

    .runway-id {
        font-size: 0.8rem;
    }

    .runway-details {
        font-size: 0.7rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .emergency-overlay {
        min-width: auto;
        width: 90%;
        padding: 0.75rem 1rem;
    }

    .emergency-icon {
        font-size: 2rem;
    }

    .emergency-text h2 {
        font-size: 1.3rem;
    }

    .emergency-text p {
        font-size: 0.9rem;
    }
}

/* Sidebar for Upcoming Unavailabilities */
.upcoming-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 450px;
    height: 100vh;
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    display: flex;
}

.upcoming-sidebar.open {
    transform: translateX(0);
}

.upcoming-toggle-btn {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-blue);
    color: #000;
    border: none;
    padding: 20px 10px;
    border-radius: 10px 0 0 10px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: bold;
    box-shadow: -5px 0 15px rgba(56, 189, 248, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.3s;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    height: auto;
    min-height: 120px;
    justify-content: center;
    gap: 10px;
    font-size: 0.9em;
}

.upcoming-toggle-btn:hover {
    background: #7dd3fc;
    box-shadow: -5px 0 20px rgba(56, 189, 248, 0.5);
}

.upcoming-toggle-btn div {
    writing-mode: horizontal-tb;
    /* Emoji should be horizontal */
    font-size: 1.5em;
    margin-bottom: 5px;
}

/* Ensure panel inside uses full height */
#upcoming-unavailabilities {
    width: 100%;
    height: 100%;
    margin: 0;
    border-right: none;
    border-top: none;
    border-bottom: none;
    backdrop-filter: blur(20px);
    background: rgba(10, 15, 30, 0.95);
    display: flex;
    flex-direction: column;
}

/* Scrollable container inside sidebar */
#upcoming-unavailabilities .table-container {
    flex: 1;
    overflow-y: auto;
}

body.light-theme #upcoming-unavailabilities {
    background: rgba(255, 255, 255, 0.95);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
}

/* EMERGENCY DETAIL PANEL STYLES */
.emergency-dashboard {
    font-family: var(--font-main);
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    /* Adjusted ratio */
    gap: 3rem;
    /* More breathing room */
    padding: 1.5rem 2rem;
    align-items: start;
}

.emergency-data-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    /* More space between label and value */
    margin-bottom: 0.5rem;
}

.e-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.e-value {
    font-size: 2.2rem;
    /* Larger standard values */
    font-weight: 800;
    color: white;
    line-height: 1.1;
    font-family: var(--font-display);
}

.e-flight {
    font-family: var(--font-display);
    font-size: 4rem;
    /* Much larger flight number */
    color: var(--accent-blue);
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
    line-height: 1;
    margin-top: -0.5rem;
    /* Optical alignment */
}

.e-highlight {
    color: var(--accent-amber);
    font-size: 2.8rem;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

/* Flight Tables (FIDS) */
/* Flight Tables specific values (Legacy section cleaned) */

.flight-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.flight-time {
    font-family: var(--font-display);
    color: var(--text-primary);
}

.flight-code {
    font-weight: 600;
    color: var(--accent-blue);
    white-space: nowrap;
    font-family: inherit;
}

.flight-city {
    font-weight: 700;
    white-space: nowrap;
    color: var(--accent-blue);
}

.iata-label {
    font-weight: bold;
    color: var(--accent-blue);
}

.flight-status {
    font-size: 0.75rem;
    text-transform: uppercase;
}

.status-landed {
    color: var(--accent-green);
}

.status-scheduled {
    color: var(--text-secondary);
}

.status-delayed {
    color: var(--accent-amber);
}

.status-cancelled {
    color: var(--accent-red);
}

.airline-logo-small {
    height: 18px;
    width: 42px;
    min-width: 42px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
    filter: brightness(1.1);
}

/* Flight code and airline logo styles consolidated above */

.live-list-box {
    display: flex;
    flex-direction: column;
}

.table-wrapper {
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    flex: 1;
    min-height: 0;
    /* Force scroll instead of expansion */
}

.table-wrapper table {
    width: 100%;
    table-layout: fixed;
    /* Ensures table stays within bounds */
}

.e-warning {
    color: var(--accent-red);
    font-size: 1.6rem;
    text-transform: uppercase;
    line-height: 1.2;
}

.e-label-small {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    display: block;
    margin-bottom: 0.3rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.e-value-large {
    font-size: 2.5rem;
    font-weight: bold;
    font-family: var(--font-display);
    line-height: 1;
}

.e-value-medium {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.1;
}

.emergency-data-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.2rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* More subtle */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.emergency-remarks-box {
    background: rgba(255, 255, 255, 0.03);
    /* Neutral background */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    padding: 1.5rem 0 0 0;
    margin-top: 1rem;
}

.full-width {
    grid-column: span 2;
}

/* Ensure emergency panel is distinct in light mode too, though mostly it will be red based */
body.light-theme #emergency-detail-panel {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: #dc2626;
}

body.light-theme .e-value {
    color: #1e293b;
}

body.light-theme .e-flight {
    text-shadow: none;
}

body.light-theme .e-label,
body.light-theme .e-label-small {
    color: #64748b;
    /* Slate-500 for better visibility on white */
}

body.light-theme .emergency-data-box {
    background: rgba(0, 0, 0, 0.03);
    /* Slight grey background */
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .emergency-remarks-box {
    border-top-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
}

/* ATIS Ticker Animation */
.atis-ticker-animation {
    display: inline-block;
    padding-left: 100%;
    animation: atis-marquee 25s linear infinite;
    white-space: nowrap;
}

@keyframes atis-marquee {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-100%, 0);
    }
}
@keyframes scan-line {
    0% { left: 0%; }
    100% { left: 100%; }
}
