/* ============================================
   SKYWARD INSIGHTS - DESIGN SYSTEM
   ============================================ */

/* === CSS VARIABLES === */
:root {
    /* Colors - Light Theme */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --text-tertiary: #adb5bd;
    
    /* Brand Colors */
    --brand-primary: #4361ee;
    --brand-secondary: #7209b7;
    --brand-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --brand-gradient-hover: linear-gradient(135deg, #5568d3 0%, #6a3f91 100%);
    
    /* Status Colors */
    --status-success: #06d6a0;
    --status-warning: #ffd60a;
    --status-danger: #ef476f;
    --status-info: #4cc9f0;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f0f1e;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --text-tertiary: #6c757d;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
}

/* === RESET & BASE === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* === SPLASH SCREEN === */
.splash-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeOut 0.5s ease-out 2s forwards;
}

.splash-content {
    text-align: center;
    animation: slideUp 0.6s ease-out;
}

.splash-icon {
    font-size: 5rem;
    margin-bottom: var(--spacing-lg);
    animation: bounce 1s ease-in-out infinite;
}

.splash-title {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: white;
    margin-bottom: var(--spacing-xl);
    letter-spacing: -0.02em;
}

.splash-loader {
    width: 50px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

.splash-loader::after {
    content: '';
    position: absolute;
    inset: 0;
    background: white;
    border-radius: 2px;
    animation: loading 1.5s ease-in-out infinite;
}

/* === APP CONTAINER === */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity var(--transition-base);
}

.app.hidden {
    opacity: 0;
    pointer-events: none;
}

/* === HEADER === */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    transition: all var(--transition-base);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 700;
    font-size: var(--font-size-xl);
    color: var(--text-primary);
}

.logo-icon {
    font-size: 1.75rem;
    animation: float 3s ease-in-out infinite;
}

.logo-text {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--brand-primary);
    color: white;
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

.theme-icon {
    width: 20px;
    height: 20px;
}

/* === NAVIGATION TABS === */
.nav-tabs {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    flex: 1;
    min-width: 120px;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-tab svg {
    width: 20px;
    height: 20px;
}

.nav-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--brand-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--brand-secondary);
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

.view {
    display: none;
    animation: fadeInUp 0.4s ease-out;
}

.view.active {
    display: block;
}

.view-header {
    margin-bottom: var(--spacing-xl);
}

.view-title {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    margin-bottom: var(--spacing-lg);
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === AIRPORT SELECTOR === */
.airport-selector {
    margin-bottom: var(--spacing-xl);
}

.airport-selector label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.select-input {
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.select-input:hover {
    border-color: var(--brand-primary);
}

.select-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

/* === SEARCH BAR === */
.search-bar {
    position: relative;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-md) 48px;
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    border: 1px solid var(--bg-tertiary);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.stat-icon.arrivals {
    background: linear-gradient(135deg, #06d6a0 0%, #1b9aaa 100%);
}

.stat-icon.departures {
    background: linear-gradient(135deg, #4cc9f0 0%, #4361ee 100%);
}

.stat-icon.on-time {
    background: linear-gradient(135deg, #06d6a0 0%, #52b788 100%);
}

.stat-icon.delayed {
    background: linear-gradient(135deg, #ffd60a 0%, #fca311 100%);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

/* === SECTION === */
.section {
    margin-bottom: var(--spacing-2xl);
}

.section-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

/* === FLIGHTS GRID === */
.flights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-lg);
}

.flight-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--bg-tertiary);
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.flight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--brand-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

.flight-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.flight-card:hover::before {
    transform: scaleX(1);
}

.flight-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--spacing-md);
}

.flight-number {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.flight-airline {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.flight-status {
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.flight-status.scheduled {
    background: rgba(76, 201, 240, 0.15);
    color: var(--status-info);
}

.flight-status.active {
    background: rgba(6, 214, 160, 0.15);
    color: var(--status-success);
}

.flight-status.landed {
    background: rgba(6, 214, 160, 0.15);
    color: var(--status-success);
}

.flight-status.delayed {
    background: rgba(255, 214, 10, 0.15);
    color: var(--status-warning);
}

.flight-status.cancelled {
    background: rgba(239, 71, 111, 0.15);
    color: var(--status-danger);
}

.flight-route {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.flight-location {
    flex: 1;
}

.flight-location-code {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--text-primary);
}

.flight-location-name {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.flight-arrow {
    color: var(--text-tertiary);
    font-size: var(--font-size-lg);
}

.flight-time {
    display: flex;
    justify-content: space-between;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--bg-tertiary);
}

.flight-time-item {
    text-align: center;
}

.flight-time-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.flight-time-value {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
}

/* === ANIMATIONS === */
@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes loading {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .header-content {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .logo-text {
        font-size: var(--font-size-lg);
    }
    
    .nav-tabs {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .nav-tab span {
        display: none;
    }
    
    .nav-tab {
        min-width: auto;
        padding: var(--spacing-md);
    }
    
    .main-content {
        padding: var(--spacing-lg) var(--spacing-md);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .flights-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .view-title {
        font-size: var(--font-size-xl);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .splash-icon {
        font-size: 4rem;
    }
    
    .splash-title {
        font-size: var(--font-size-2xl);
    }
}

/* === UTILITIES === */
.hidden {
    display: none !important;
}
