/**
 * Galactic EA AI - Layout Styles
 * Optimized for performance with CSS variables and modern techniques
 */

/* ================================================================
   CSS VARIABLES (if not already defined in styles.css)
   ================================================================ */
:root {
    --color-primary: #7b77c6;
    --color-secondary: #ff77c6;
    --color-accent: #00d4ff;
    --color-bg-primary: #000000;
    --color-bg-secondary: #0a0a1a;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --radius-lg: 20px;
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ================================================================
   HEADER STYLES (Optimized)
   ================================================================ */
.header {
    text-align: center;
    padding: clamp(3rem, 8vw, 5rem) var(--spacing-xl);
    background: rgba(10, 10, 26, 0.6);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(123, 119, 198, 0.3);
    box-shadow: var(--shadow-lg), inset 0 0 100px rgba(123, 119, 198, 0.1);
    will-change: transform;
}

.header::before {
    content: '';
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(123, 119, 198, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
    will-change: transform;
}

.header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

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

.header-content {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    position: relative;
    z-index: 1;
}

.header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: var(--spacing-sm);
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
    margin: 0;
    font-weight: 400;
}

.header p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    z-index: 1;
}

/* Navigation Links - Desktop */
.nav-links.desktop-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    position: relative;
    z-index: 1;
}

/* Mobile Navigation Menu - Floating outside header */
.nav-links.mobile-nav-menu {
    display: none; /* Hidden by default, shown when active */
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    border: 1px solid rgba(123, 119, 198, 0.3);
    background: rgba(10, 10, 26, 0.4);
    backdrop-filter: blur(10px);
}

.nav-link:hover {
    color: var(--color-primary);
    background: rgba(123, 119, 198, 0.2);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(123, 119, 198, 0.3);
}

/* Mobile Menu Overlay - Floating */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: all;
}

@media (max-width: 768px) {
    /* Hide desktop navigation on mobile */
    .nav-links.desktop-nav {
        display: none !important;
    }
    
    /* Floating mobile navigation menu - Positioned above floating menu toggle */
    .nav-links.mobile-nav-menu {
        position: fixed;
        bottom: 180px; /* Above floating menu toggle (which is at bottom: 100px) */
        right: 20px;
        width: 280px;
        max-width: calc(100vw - 40px);
        background: linear-gradient(180deg, 
            rgba(10, 10, 26, 0.98) 0%, 
            rgba(26, 10, 46, 0.95) 100%);
        backdrop-filter: blur(20px);
        flex-direction: column;
        gap: 10px;
        margin: 0;
        padding: 24px;
        border-radius: 20px;
        box-shadow: 
            0 15px 50px rgba(0, 0, 0, 0.9),
            0 0 0 1px rgba(123, 119, 198, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.15),
            0 0 60px rgba(123, 119, 198, 0.2);
        border: 2px solid rgba(123, 119, 198, 0.4);
        z-index: 1002;
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px) scale(0.9); /* Slide up from bottom */
        transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        align-items: stretch;
        max-height: calc(100vh - 200px); /* Account for FAB space at bottom */
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    /* Active state - Show floating menu */
    .nav-links.mobile-nav-menu.active {
        display: flex !important;
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }
    
    /* On very small screens, position menu above floating menu toggle */
    @media (max-width: 480px) {
        .nav-links.mobile-nav-menu {
            bottom: 170px; /* Above floating menu toggle (which is at bottom: 90px) */
            right: 20px;
            left: 20px;
            width: auto;
            max-width: none;
            max-height: calc(100vh - 200px);
        }
    }
    
    .nav-link {
        width: 100%;
        text-align: left;
        padding: 0.9rem 1rem;
        margin: 0;
        border-radius: 10px;
        border: 1px solid rgba(123, 119, 198, 0.2);
        background: rgba(123, 119, 198, 0.1);
        backdrop-filter: blur(10px);
        font-size: 0.95rem;
        font-weight: 600;
        transition: all 0.2s ease;
        position: relative;
        overflow: hidden;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .nav-link::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, 
            transparent, 
            rgba(255, 119, 198, 0.15) 50%, 
            transparent);
        transition: left 0.4s ease;
    }
    
    .nav-link:hover::before,
    .nav-link:active::before {
        left: 100%;
    }
    
    .nav-link:hover {
        background: linear-gradient(135deg, 
            rgba(123, 119, 198, 0.25) 0%, 
            rgba(255, 119, 198, 0.15) 100%);
        border-color: rgba(255, 119, 198, 0.5);
        transform: translateX(3px);
        box-shadow: 0 4px 12px rgba(123, 119, 198, 0.3);
        color: #fff;
    }
    
    .nav-link:active {
        transform: translateX(2px) scale(0.98);
    }
}

.version-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(255, 119, 198, 0.3), rgba(123, 119, 198, 0.3));
    border-radius: 20px;
    font-size: 0.9rem;
    margin-top: var(--spacing-md);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 119, 198, 0.5);
}

/* ================================================================
   SECTIONS & CONTAINERS
   ================================================================ */
.section {
    margin-bottom: var(--spacing-xl);
}

/* ================================================================
   STATS GRID (Optimized with CSS Grid)
   ================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-xl) 0;
}

.stat-card {
    background: rgba(10, 10, 26, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-lg);
    border-radius: 12px;
    border: 1px solid rgba(123, 119, 198, 0.3);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(123, 119, 198, 0.4);
}

.stat-card .number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--spacing-md);
}

.stat-card .label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

/* ================================================================
   FEATURE GRID (Optimized)
   ================================================================ */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-xl) 0;
}

.feature-card {
    background: rgba(10, 10, 26, 0.6);
    backdrop-filter: blur(10px);
    padding: var(--spacing-lg);
    border-radius: 12px;
    border: 1px solid rgba(123, 119, 198, 0.2);
    transition: transform 0.2s ease, border-color 0.2s ease;
    will-change: transform;
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: rgba(123, 119, 198, 0.5);
}

.feature-card h4 {
    color: var(--color-primary);
    margin-bottom: var(--spacing-md);
    font-size: 1.1rem;
}

.feature-card p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

/* ================================================================
   ALERTS
   ================================================================ */
.alert {
    padding: var(--spacing-lg);
    border-radius: 12px;
    margin: var(--spacing-lg) 0;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
    color: #86efac;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #93c5fd;
}

.alert-warning {
    background: rgba(234, 179, 8, 0.1);
    border-color: #eab308;
    color: #fde047;
}

/* ================================================================
   FOOTER
   ================================================================ */
.footer {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    margin-top: var(--spacing-xl);
    border-top: 1px solid rgba(123, 119, 198, 0.2);
    color: rgba(255, 255, 255, 0.7);
    position: relative;
}

.footer a {
    color: var(--color-primary);
    margin: 0 var(--spacing-md);
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--color-secondary);
}

/* Mobile Menu Toggle - Now floating (removed from footer, moved to floating button) */

/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */
@media (max-width: 768px) {
    .header {
        padding: clamp(2rem, 6vw, 3rem) var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }
    
    .stats-grid,
    .feature-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    /* Floating menu toggle is now handled in tabs.css */
}

@media (prefers-reduced-motion: reduce) {
    .header::before {
        animation: none;
    }
    
    .stat-card,
    .feature-card {
        transition: none;
    }
}
