/* Flightmaps Design System */

/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Colors */
    --bg-primary: #0D1117;
    --bg-surface: #161B22;
    --bg-elevated: #21262D;
    --accent-blue: #58A6FF;
    --accent-orange: #F0883E;
    --accent-green: #3FB950;
    --accent-red: #F85149;
    --text-primary: #F0F6FC;
    --text-secondary: #9BA4AE;
    --border: #30363D;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Font Awesome font-display override to prevent FOIT */
@font-face {
    font-family: 'Font Awesome 6 Free';
    font-display: swap;
}
@font-face {
    font-family: 'Font Awesome 6 Brands';
    font-display: swap;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    height: 100%;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* Heading font for titles, logos, stat values */
h1, h2, h3, h4, h5, h6,
.logo-text,
.hero-title,
.header-brand,
.stats-panel-title,
.stat-value,
.error-title {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Glass Card */
.glass-card {
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.4);
}

.btn:disabled, .btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:disabled:hover, .btn[disabled]:hover {
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--accent-blue);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: #79B8FF;
}

.btn-success {
    background: var(--accent-green);
    color: var(--bg-primary);
}

.btn-success:hover {
    background: #56D364;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.875rem;
}

.btn-sm:hover {
    transform: none;
}

.btn-lg {
    padding: var(--space-md) var(--space-lg);
    font-size: 1.125rem;
}

/* Form Elements */
.file-input {
    display: none;
}

.file-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.file-label:hover {
    border-color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.1);
}

.file-label.has-file {
    border-color: var(--accent-green);
    border-style: solid;
    background: rgba(63, 185, 80, 0.1);
}

/* Control Panel (for map page) */
.control-panel {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    display: flex;
    gap: var(--space-sm);
    z-index: 1000;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-blue);
}

.control-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.4);
}

/* Style Selector Dropdown */
.style-selector {
    position: relative;
}

.style-dropdown {
    position: absolute;
    top: calc(100% + var(--space-sm));
    right: 0;
    min-width: 160px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.style-selector:hover .style-dropdown,
.style-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.style-option {
    display: block;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: none;
    border: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.style-option:hover {
    background: var(--bg-elevated);
}

.style-option.active {
    color: var(--accent-blue);
}

/* Stats Panel */
.stats-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: var(--space-lg);
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 1001;
    overflow-y: auto;
}

.stats-panel.open {
    transform: translateX(0);
}

.stats-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.stats-panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stats-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-xs);
    line-height: 1;
}

.stats-close:hover {
    color: var(--text-primary);
}

.stats-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.4);
    border-radius: var(--radius-sm);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-value {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

.stat-value.highlight {
    color: var(--accent-blue);
}

/* Stats Toggle Button */
.stats-toggle {
    position: fixed;
    bottom: var(--space-lg);
    left: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    z-index: 1000;
}

.stats-toggle:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-blue);
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 1000;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-up {
    animation: slideUp 0.5s ease;
}

/* Map Container */
#map-container {
    width: 100%;
    height: 100vh;
}

/* Error Page Styles */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: var(--space-lg);
}

.error-card {
    max-width: 500px;
    padding: var(--space-xl);
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    color: var(--accent-red);
    margin-bottom: var(--space-md);
}

.error-title {
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
}

.error-list {
    text-align: left;
    margin: var(--space-lg) 0;
    padding-left: var(--space-lg);
}

.error-list li {
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .stats-panel {
        width: 100%;
    }

    .control-panel {
        top: auto;
        bottom: var(--space-md);
        right: var(--space-md);
    }
}
