/**
 * Mobile-First Optimizations for ShowdownMaster
 * Focus on performance, usability, and accessibility
 */

/* Critical performance optimizations */
* {
    box-sizing: border-box;
}

/* Optimize font loading */
body {
    font-display: swap;
}

/* Mobile-first container improvements */
.container {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Enhanced mobile hero section */
@media (max-width: 767px) {
    .hero-mobile-optimized {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    .hero-title-mobile {
        font-size: 2.25rem !important;
        line-height: 1.1 !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-subtitle-mobile {
        font-size: 1rem !important;
        line-height: 1.4 !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Larger touch targets */
    .cta-mobile {
        min-height: 48px;
        font-size: 1rem;
        padding: 12px 16px;
    }
    
    /* Better spacing on mobile */
    .trust-indicator {
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
    }
    
    /* Sample battle mobile optimizations */
    .sample-battle-mobile {
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    .sample-battle {
        padding: 1rem !important;
    }
    
    /* Hide decorative elements on mobile */
    .mobile-hidden {
        display: none !important;
    }
    
    /* Stack battle preview cards vertically */
    .battle-preview-mobile {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .battle-preview-card {
        transform: none !important;
        margin-bottom: 1rem;
    }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
    .hero-title-tablet {
        font-size: 3.5rem;
        line-height: 1.1;
    }
    
    .hero-subtitle-tablet {
        font-size: 1.25rem;
        line-height: 1.4;
    }
    
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Performance improvements */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Reduce motion for users who prefer it */
@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;
    }
    
    .typing-demo {
        animation: none !important;
        border-right: none !important;
        white-space: normal !important;
        width: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hero-gradient {
        background: #000 !important;
    }
    
    .sample-battle {
        border: 2px solid #fff !important;
        background: #000 !important;
    }
    
    .battle-preview-card {
        border: 2px solid #fff !important;
    }
}

/* Focus improvements for accessibility */
button:focus,
a:focus,
input:focus {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

/* Better button styles for touch */
button,
.btn {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* Optimize text for reading */
@media (max-width: 767px) {
    p {
        line-height: 1.6;
        font-size: 1rem;
    }
    
    h1 {
        line-height: 1.1;
    }
    
    h2 {
        line-height: 1.2;
        font-size: 1.875rem;
    }
    
    h3 {
        line-height: 1.3;
        font-size: 1.25rem;
    }
}

/* Loading states */
.skeleton {
    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;
    }
}

/* Sticky header improvements */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
}

/* Mobile navigation improvements */
@media (max-width: 767px) {
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        padding: 0.5rem;
        z-index: 50;
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.5rem;
        font-size: 0.75rem;
        color: #6b7280;
        text-decoration: none;
    }
    
    .mobile-nav-item.active {
        color: #ef4444;
    }
    
    .mobile-nav-icon {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
}

/* Improve form inputs on mobile */
@media (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
        border-radius: 8px;
        border: 2px solid #e5e7eb;
        width: 100%;
    }
    
    input:focus,
    textarea:focus {
        border-color: #ef4444;
        outline: none;
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    }
}

/* Optimize animations for performance */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Better scroll behavior */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .hero-gradient {
        background: white !important;
        color: black !important;
    }
}