/* =====================================================
   CUL MASTER CHEATS - PERFORMANCE OPTIMIZATIONS
   Bu dosyayı style.css'den sonra ekleyin
   ===================================================== */

/* ===== CRITICAL CSS OPTIMIZATIONS ===== */

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* GPU Acceleration */
.btn,
.tab-btn,
.pricing-card,
.feature-card,
.package-panel,
.nav-link {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    will-change: transform;
}

/* Image Optimization */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Lazy Loading Placeholder */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Reduce Motion for Accessibility */
@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;
    }
}

/* ===== FONT OPTIMIZATION ===== */

/* Font Display Swap */
@font-face {
    font-family: 'Orbitron';
    font-display: swap;
}

@font-face {
    font-family: 'Roboto';
    font-display: swap;
}

/* ===== LAYOUT SHIFT PREVENTION ===== */

/* Aspect Ratio Boxes */
.aspect-ratio-16-9 {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.aspect-ratio-16-9 > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ===== MOBILE OPTIMIZATIONS ===== */

/* Touch Action */
.btn,
.tab-btn,
.nav-link,
a {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 107, 107, 0.3);
}

/* Prevent Text Selection on Buttons */
.btn,
.tab-btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ===== SCROLL OPTIMIZATIONS ===== */

/* Smooth Scrolling Container */
.scroll-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Hide Scrollbar but Keep Functionality */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ===== LOADING STATES ===== */

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== PRINT STYLES ===== */

@media print {
    /* Hide unnecessary elements */
    nav,
    footer,
    .promo-overlay,
    .social-links,
    .btn,
    .tab-btn {
        display: none !important;
    }
    
    /* Optimize for print */
    body {
        background: white !important;
        color: black !important;
    }
    
    a {
        text-decoration: underline;
        color: black !important;
    }
    
    /* Show URLs after links */
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) {
    /* Already dark, but ensure consistency */
    :root {
        color-scheme: dark;
    }
}

/* ===== HIGH CONTRAST MODE ===== */

@media (prefers-contrast: high) {
    .btn,
    .tab-btn,
    .pricing-card,
    .feature-card {
        border: 2px solid currentColor !important;
    }
}

/* ===== FOCUS VISIBLE (Accessibility) ===== */

*:focus-visible {
    outline: 3px solid #ff6b6b;
    outline-offset: 2px;
}

/* Remove outline for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* ===== PERFORMANCE HINTS ===== */

/* Contain Layout */
.pricing-card,
.feature-card,
.package-panel {
    contain: layout style paint;
}

/* Content Visibility */
.lazy-section {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

/* ===== ANIMATION OPTIMIZATIONS ===== */

/* Use transform instead of position */
@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* ===== RESPONSIVE IMAGES ===== */

/* Responsive Image Container */
.responsive-img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== CRITICAL RENDERING PATH ===== */

/* Above the fold content */
.above-fold {
    min-height: 100vh;
}

/* Below the fold - lazy load */
.below-fold {
    content-visibility: auto;
}

/* ===== NETWORK HINTS ===== */

/* Prefetch next page */
link[rel="prefetch"] {
    /* Browser will prefetch in idle time */
}

/* Preload critical resources */
link[rel="preload"] {
    /* Browser will load immediately */
}

/* ===== INTERSECTION OBSERVER SUPPORT ===== */

/* Fade in when visible */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== LOADING SPINNER ===== */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 107, 107, 0.3);
    border-top-color: #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== UTILITY CLASSES ===== */

/* Visually Hidden (Accessibility) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #ff6b6b;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* ===== PERFORMANCE MONITORING ===== */

/* Mark elements for performance tracking */
[data-performance-mark] {
    /* Used for performance.mark() */
}

/* ===== BROWSER COMPATIBILITY ===== */

/* Flexbox Fallbacks */
@supports not (display: grid) {
    .pricing-grid,
    .features-grid {
        display: flex;
        flex-wrap: wrap;
    }
}

/* Grid Fallbacks */
@supports not (display: flex) {
    .pricing-grid,
    .features-grid {
        display: block;
    }
}
