/**
 * Optimized Base Template CSS
 * Performance-focused styles for base.html
 */

/* Critical CSS for immediate rendering */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: #f9fafb;
    line-height: 1.6;
}

/* Loading indicator */
.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #fecaca;
    z-index: 9999;
}

.loading-progress {
    height: 100%;
    background: #dc2626;
    transition: width 0.3s ease;
}

/* Navigation styles */
.nav-link {
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
}

.nav-link:hover {
    color: #fff;
    background: #991b1b;
}

.nav-link:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

/* Authentication buttons */
.auth-button-login {
    position: relative;
    overflow: hidden;
}

.auth-button-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.auth-button-login:hover::before {
    left: 100%;
}

.auth-button-signup {
    position: relative;
    overflow: hidden;
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.auth-button-signup:hover {
    animation-duration: 1s;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #7c1212;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .header {
        position: sticky;
        top: 0;
    }
    
    .nav-link {
        min-height: 48px;
        min-width: 48px;
    }
    
    .auth-button-signup,
    .auth-button-login {
        min-height: 44px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .auth-button-signup {
        animation: none;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    .nav-link {
        border: 1px solid #fff;
    }
    
    .nav-link:hover {
        background: #000;
        color: #fff;
    }
}

/* Focus states for accessibility */
.auth-button-login:focus-visible,
.auth-button-signup:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

/* Performance optimization */
.nav-link,
.auth-button-login,
.auth-button-signup {
    transform: translateZ(0);
    will-change: transform;
}

/* Online/Offline status */
#online-status {
    position: fixed;
    top: 4rem;
    right: 1rem;
    z-index: 40;
    padding: 0.75rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: none;
}

#online-status .fas {
    font-size: 0.75rem;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: #111827;
        color: #f9fafb;
    }
    
    .nav-link {
        color: #d1d5db;
    }
    
    .nav-link:hover {
        background: #374151;
    }
}
