/* BlackBox Forensics - Performance Optimized CSS */

/* Critical CSS - Above the fold styles */
:root {
    --primary-color: #0d6efd;
    --warning-color: #ffc107;
    --success-color: #198754;
    --danger-color: #dc3545;
    --dark-bg: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-light: #e9ecef;
    --border-color: #495057;
}

/* Performance optimizations */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-display: swap; /* Optimize font loading */
}

body {
    background: var(--dark-bg);
    color: var(--text-light);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Lazy loading optimization */
img {
    height: auto;
    max-width: 100%;
}

/* Critical above-the-fold styles */
.navbar {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.hero-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

/* Performance-optimized animations */
@media (prefers-reduced-motion: no-preference) {
    .fade-in-up {
        animation: fadeInUp 0.6s ease forwards;
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #4dabf7;
        --text-light: #ffffff;
        --dark-bg: #000000;
    }
}

/* Focus management for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 9999;
}

.skip-link:focus {
    top: 6px;
}

/* Loading states */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Error states */
.error-state {
    color: var(--danger-color);
    padding: 1rem;
    border: 1px solid var(--danger-color);
    border-radius: 4px;
    background: rgba(220, 53, 69, 0.1);
}

/* Success states */
.success-state {
    color: var(--success-color);
    padding: 1rem;
    border: 1px solid var(--success-color);
    border-radius: 4px;
    background: rgba(25, 135, 84, 0.1);
}

/* Optimized button styles */
.btn-optimized {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 44px; /* Touch target size */
    position: relative;
    overflow: hidden;
}

.btn-optimized:hover {
    /* transform: translateY(-2px); */
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

.btn-optimized:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Card optimizations */
.card-optimized {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.card-optimized:hover {
    /* transform: translateY(-4px); */
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* Responsive typography */
.display-1 { font-size: clamp(2.5rem, 5vw, 5rem); }
.display-4 { font-size: clamp(2rem, 4vw, 3.5rem); }
.lead { font-size: clamp(1.1rem, 2vw, 1.25rem); }

/* Print styles */
@media print {
    .navbar, .modal, .btn { display: none !important; }
    body { background: white !important; color: black !important; }
}

/* Critical performance metrics */
.performance-metric {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    z-index: 9999;
    display: none;
}

/* Development mode only */
body[data-env="development"] .performance-metric {
    display: block;
}
