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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
}

.clock-section {
    flex: 1;
    display: flex;
    justify-content: center;
}

.clock-display {
    display: flex;
    gap: 2rem;
}

.clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.clock-face {
    position: relative;
    width: 60px;
    height: 60px;
    border: 2px solid #00a8ff;
    border-radius: 50%;
    background: #1a1a1a;
}

.clock-face::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: #00a8ff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.clock-hand {
    position: absolute;
    background: #00a8ff;
    transform-origin: bottom center;
    border-radius: 2px;
}

.hour-hand {
    width: 3px;
    height: 18px;
    top: 12px;
    left: 50%;
    margin-left: -1.5px;
}

.minute-hand {
    width: 2px;
    height: 25px;
    top: 5px;
    left: 50%;
    margin-left: -1px;
}

.clock-label {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
}

.header h1 {
    font-size: 1.5rem;
    color: #00a8ff;
}

/* New header branding styles */
.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 212, 255, 0.3));
}

.header-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.header-links {
    display: flex;
    gap: 0.5rem;
}

.stats-summary {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

.connection-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.connection-status.connected {
    background: #27ae60;
}

.connection-status.disconnected {
    background: #e74c3c;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view-toggle {
    display: flex;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
}

.view-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.view-btn:hover {
    background: #404040;
}

.view-btn.active {
    border-bottom-color: #00a8ff;
    background: #404040;
}

.view {
    flex: 1;
    display: none;
    overflow: hidden;
}

.view.active {
    display: flex;
    flex-direction: column;
}

#map {
    flex: 1;
    z-index: 1;
}

.map-controls {
    position: absolute;
    top: 80px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-controls button {
    padding: 0.5rem 1rem;
    background: #2d2d2d;
    border: 1px solid #404040;
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.map-controls button:hover {
    background: #404040;
}

.display-options {
    position: absolute;
    top: 320px;
    right: 10px;
    z-index: 1000;
    background: rgba(45, 45, 45, 0.95);
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 1rem;
    min-width: 200px;
}

.display-options h4 {
    margin-bottom: 0.5rem;
    color: #ffffff;
    font-size: 0.9rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: #cccccc;
}

.option-group input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: #00d4ff;
    transform: scale(1.1);
}

.option-group label:hover {
    color: #ffffff;
}

.legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(45, 45, 45, 0.95);
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 1rem;
    z-index: 1000;
    min-width: 150px;
}

.legend h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #ffffff;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}

.legend-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.legend-icon svg {
    width: 100%;
    height: 100%;
}

.legend-icon.light svg { color: #00bfff; }      /* Sky blue for light aircraft */
.legend-icon.medium svg { color: #00ff88; }     /* Green for medium aircraft */
.legend-icon.large svg { color: #ff8c00; }      /* Orange for large aircraft */
.legend-icon.high-vortex svg { color: #ff4500; } /* Red-orange for high vortex large */
.legend-icon.heavy svg { color: #ff0000; }      /* Red for heavy aircraft */
.legend-icon.helicopter svg { color: #ff00ff; } /* Magenta for helicopters */
.legend-icon.military svg { color: #ff4444; }   /* Red-orange for military */
.legend-icon.ga svg { color: #ffff00; }         /* Yellow for general aviation */
.legend-icon.ground svg { color: #888888; }     /* Gray for ground vehicles */

.table-controls {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
}

.table-controls input,
.table-controls select {
    padding: 0.5rem;
    background: #404040;
    border: 1px solid #606060;
    color: #ffffff;
    border-radius: 4px;
}

.table-controls input {
    flex: 1;
}

.table-container {
    flex: 1;
    overflow: auto;
}

#aircraft-table {
    width: 100%;
    border-collapse: collapse;
}

#aircraft-table th,
#aircraft-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #404040;
}

#aircraft-table th {
    background: #2d2d2d;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

#aircraft-table tr:hover {
    background: #404040;
}

.type-badge {
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: bold;
    color: #000000;
}

.type-badge.commercial { background: #00ff88; }
.type-badge.cargo { background: #ff8c00; }
.type-badge.military { background: #ff4444; }
.type-badge.ga { background: #ffff00; }
.type-badge.ground { background: #888888; color: #ffffff; }

/* RSSI signal strength colors */
.signal-strong { color: #00ff88; }
.signal-good { color: #ffff00; }
.signal-weak { color: #ff8c00; }
.signal-poor { color: #ff4444; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.stat-card {
    background: #2d2d2d;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #404040;
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #00a8ff;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
}

.chart-card {
    background: #2d2d2d;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #404040;
    display: flex;
    flex-direction: column;
}

.chart-card h3 {
    margin-bottom: 1rem;
    color: #888;
}

.chart-card canvas {
    flex: 1;
    max-height: 300px;
}

.aircraft-marker {
    transform: rotate(0deg);
    filter: drop-shadow(0 0 4px rgba(0,0,0,0.9));
    z-index: 1000;
}

/* Leaflet popup override - ensure our styles take precedence */
.leaflet-popup-content-wrapper {
    background: #2d2d2d !important;
    color: #ffffff !important;
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 12px !important;
    color: #ffffff !important;
}

/* Under Construction Styles */
.under-construction {
    color: #ff8c00;
    font-size: 0.8em;
    font-weight: normal;
    margin-left: 8px;
}

.construction-notice {
    background: rgba(255, 140, 0, 0.1);
    border: 1px solid #ff8c00;
    border-radius: 4px;
    padding: 8px;
    margin: 8px 0;
    font-size: 0.9em;
    color: #ff8c00;
    text-align: center;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(40, 40, 40, 0.95);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 12px 20px;
    color: #ffffff;
    font-size: 0.9em;
    max-width: 300px;
    z-index: 10000;
    transform: translateX(320px);
    transition: transform 0.3s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast-notification.error {
    border-color: #ff8c00;
    background: rgba(255, 140, 0, 0.1);
    color: #ff8c00;
}

.toast-notification.show {
    transform: translateX(0);
}

/* Version Info */
.version-info {
    font-size: 0.6em;
    color: #888;
    font-weight: normal;
    margin-left: 8px;
}

/* Repository Link */
.repo-link {
    color: #888;
    text-decoration: none;
    font-size: 0.7em;
    margin-left: 6px;
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.repo-link:hover {
    color: #4a9eff;
    opacity: 1;
    text-decoration: none;
}

/* Collapsible Sections */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 8px 0;
    padding: 4px 0;
    border-bottom: 1px solid #444;
}

.collapsible-header:hover {
    color: #4a9eff;
}

.collapse-indicator {
    font-size: 0.8em;
    transition: transform 0.2s ease;
    color: #888;
}

.collapsible-header.collapsed .collapse-indicator {
    transform: rotate(-90deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 200px;
}

.collapsible-content.collapsed {
    max-height: 0;
    margin: 0;
    padding: 0;
}

.leaflet-popup-tip {
    background: #2d2d2d !important;
}

.aircraft-popup {
    min-width: 300px;
    max-width: 400px;
    color: #ffffff !important;
}

.popup-header {
    border-bottom: 1px solid #404040;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
    color: #ffffff !important;
}

.flight-info {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff !important;
}

.icao-flag {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.flight-id {
    color: #00a8ff !important;
    font-family: monospace;
}

.callsign {
    color: #00ff88 !important;
}

/* Rich callsign display styles */
.callsign-display {
    display: inline-block;
}

.callsign-display.enriched {
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
}

.callsign-code {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.airline-code {
    color: #00ff88 !important;
    font-weight: 600;
    font-family: monospace;
    background: rgba(0, 255, 136, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.flight-number {
    color: #00a8ff !important;
    font-weight: 500;
    font-family: monospace;
}

.callsign-details {
    font-size: 0.85rem;
    opacity: 0.9;
}

.airline-name {
    color: #ffd700 !important;
    font-weight: 500;
}

.airline-country {
    color: #cccccc !important;
    font-size: 0.8rem;
    opacity: 0.8;
}

.callsign-display.simple {
    color: #00ff88 !important;
    font-family: monospace;
}

.callsign-display.no-data {
    color: #888888 !important;
    font-style: italic;
}

/* Compact callsign for table view */
.callsign-compact {
    color: #00ff88 !important;
    font-family: monospace;
    font-weight: 500;
}

/* Loading state for callsign enhancement */
.callsign-loading {
    position: relative;
}

.callsign-loading::after {
    content: '⟳';
    margin-left: 0.25rem;
    opacity: 0.6;
    animation: spin 1s linear infinite;
    font-size: 0.8rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.callsign-enhanced {
    /* Smooth transition when enhanced */
    transition: all 0.3s ease;
}

.popup-details {
    font-size: 0.9rem;
    color: #ffffff !important;
}

.detail-row {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
    color: #ffffff !important;
}

.detail-row strong {
    color: #ffffff !important;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item .label {
    font-size: 0.8rem;
    color: #888 !important;
    margin-bottom: 0.1rem;
}

.detail-item .value {
    font-weight: bold;
    color: #ffffff !important;
}

/* Ensure all values are visible with strong contrast */
.aircraft-popup .value,
.aircraft-popup .detail-row,
.aircraft-popup .detail-item .value {
    color: #ffffff !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Style for N/A or empty values - still visible but slightly dimmed */
.detail-item .value.no-data {
    color: #aaaaaa !important;
    font-style: italic;
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .stats-summary {
        font-size: 0.8rem;
        gap: 0.5rem;
    }
    
    .table-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .map-controls {
        top: 70px;
        right: 5px;
    }
    
    .map-controls button {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    #aircraft-table {
        font-size: 0.8rem;
    }
    
    #aircraft-table th,
    #aircraft-table td {
        padding: 0.5rem 0.25rem;
    }
}

/* Squawk Code Styling */
.squawk-emergency {
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    cursor: help;
    border: 1px solid #b52532;
}

.squawk-special {
    background: #fd7e14;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    cursor: help;
    border: 1px solid #e06911;
}

.squawk-military {
    background: #6c757d;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    cursor: help;
    border: 1px solid #565e64;
}

.squawk-standard {
    background: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: normal;
    cursor: help;
    border: 1px solid #1e7e34;
}

/* Hover effects for squawk codes */
.squawk-emergency:hover {
    background: #c82333;
}

.squawk-special:hover {
    background: #e8590c;
}

.squawk-military:hover {
    background: #5a6268;
}

.squawk-standard:hover {
    background: #218838;
}

/* 3D Radar Styles */
#radar3d-view {
    position: relative;
}

#radar3d-container {
    flex: 1;
    min-height: 500px;
    width: 100%;
    background: #0a0a0a;
    position: relative;
}

.radar3d-controls {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    align-items: center;
}

.radar3d-controls button {
    padding: 0.5rem 1rem;
    background: #404040;
    color: white;
    border: 1px solid #666;
    border-radius: 4px;
    cursor: pointer;
}

.radar3d-controls button:hover:not(:disabled) {
    background: #505050;
}

.radar3d-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.radar3d-controls button.active {
    background: #00a8ff;
    border-color: #0088cc;
}

.radar3d-controls label {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: #ccc;
}

.radar3d-controls input[type="range"] {
    width: 150px;
}