/* Mobile Optimizations for Tarazism */

/* ===================================== */
/* MOBILE FIRST - CORE OPTIMIZATIONS */
/* ===================================== */

/* Touch-friendly buttons and links */
@media (max-width: 768px) {
    /* Minimum touch target size */
    button, a, input[type="button"], input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Improved tap targets */
    .nav-link, .btn, .card-link {
        padding: 12px 16px;
        margin: 4px;
    }

    /* Better spacing for mobile */
    .container, .max-w-screen-xl, .max-w-7xl, .max-w-4xl {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Reduce vertical spacing */
    .py-16 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .py-12 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .mb-12 {
        margin-bottom: 1.5rem !important;
    }

    .mb-8 {
        margin-bottom: 1rem !important;
    }

    /* Mobile-first typography - smaller sizes */
    h1 { 
        font-size: 1.75rem !important; 
        line-height: 1.2 !important;
        margin-bottom: 0.75rem !important;
    }
    
    h2 { 
        font-size: 1.5rem !important; 
        line-height: 1.3 !important;
        margin-bottom: 0.75rem !important;
    }
    
    h3 { 
        font-size: 1.25rem !important; 
        line-height: 1.4 !important;
        margin-bottom: 0.5rem !important;
    }

    h4 {
        font-size: 1.125rem !important;
        line-height: 1.4 !important;
    }
    
    /* Readable text size */
    body, p, div, span {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    /* Smaller text for descriptions */
    .text-lg {
        font-size: 15px !important;
    }

    .text-xl {
        font-size: 16px !important;
    }

    .text-2xl {
        font-size: 18px !important;
    }

    .text-3xl {
        font-size: 20px !important;
    }

    .text-4xl {
        font-size: 24px !important;
    }

    /* ===================================== */
    /* GRID & LAYOUT OPTIMIZATIONS */
    /* ===================================== */

    /* Force 2-column grid for character cards */
    .grid-cols-1.md\:grid-cols-2,
    .grid-cols-1.md\:grid-cols-3,
    .grid-cols-1.lg\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* Single column for news/content lists */
    .space-y-4 {
        gap: 0.75rem !important;
    }

    /* Compact cards */
    .rounded-2xl, .rounded-3xl {
        border-radius: 0.75rem !important;
    }

    .rounded-xl {
        border-radius: 0.5rem !important;
    }

    /* Smaller padding for cards */
    .p-8 {
        padding: 1rem !important;
    }

    .p-6 {
        padding: 0.75rem !important;
    }

    .p-4 {
        padding: 0.5rem !important;
    }

    /* ===================================== */
    /* HERO SECTION OPTIMIZATIONS */
    /* ===================================== */

    /* Smaller hero height */
    .min-h-\[70vh\] {
        min-height: 50vh !important;
    }

    /* Hero content */
    .relative.h-96 {
        height: 200px !important;
    }

    /* ===================================== */
    /* IMAGE OPTIMIZATIONS */
    /* ===================================== */

    /* Smaller images in news/content cards */
    .w-24.h-24 {
        width: 60px !important;
        height: 60px !important;
    }

    .w-16.h-16 {
        width: 48px !important;
        height: 48px !important;
    }

    /* Character card images - 2 column friendly */
    .w-12.h-12 {
        width: 40px !important;
        height: 40px !important;
    }

    /* ===================================== */
    /* BUTTON & TAB OPTIMIZATIONS */
    /* ===================================== */

    /* Smaller buttons */
    .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .px-6 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .py-4 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    .py-3 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    /* Tab buttons - stack on very small screens */
    @media (max-width: 480px) {
        .flex.gap-4 {
            flex-direction: column !important;
            gap: 0.5rem !important;
        }

        .content-tab {
            width: 100% !important;
            text-align: center !important;
        }
    }

    /* ===================================== */
    /* FORM IMPROVEMENTS */
    /* ===================================== */

    input, textarea, select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 10px 12px !important;
        border-radius: 8px !important;
    }

    /* Search improvements */
    .search-input {
        width: 100% !important;
        font-size: 16px !important;
        padding: 12px 16px !important;
        border-radius: 20px !important;
    }

    /* ===================================== */
    /* NAVIGATION OPTIMIZATIONS */
    /* ===================================== */

    /* Mobile navigation improvements */
    .mobile-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }

    .mobile-menu.open {
        right: 0;
    }

    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-menu-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    /* ===================================== */
    /* REVIEW PAGE OPTIMIZATIONS */
    /* ===================================== */

    /* Smaller review sections */
    article.max-w-4xl {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Compact stat grids */
    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    /* Smaller badges/tags */
    .px-4.py-2 {
        padding: 0.375rem 0.75rem !important;
        font-size: 12px !important;
    }

    .px-3.py-1 {
        padding: 0.25rem 0.5rem !important;
        font-size: 11px !important;
    }

    /* ===================================== */
    /* HOYOVERSE HUB OPTIMIZATIONS */
    /* ===================================== */

    /* Character list - 2 columns */
    .space-y-3 > a {
        margin-bottom: 0.5rem !important;
    }

    /* Smaller character cards */
    .space-y-3 .p-3 {
        padding: 0.5rem !important;
    }

    /* ===================================== */
    /* UTILITY CLASSES */
    /* ===================================== */

    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }

    /* Show mobile-only elements */
    .mobile-only {
        display: block !important;
    }

    /* Compact spacing */
    .gap-6 {
        gap: 0.75rem !important;
    }

    .gap-8 {
        gap: 1rem !important;
    }

    /* Smaller shadows */
    .shadow-2xl {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
    }

    .shadow-xl {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08) !important;
    }

    .shadow-lg {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06) !important;
    }
}

/* ===================================== */
/* TABLET OPTIMIZATIONS */
/* ===================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .container, .max-w-screen-xl {
        padding-left: 24px;
        padding-right: 24px;
    }

    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================================== */
/* PERFORMANCE OPTIMIZATIONS */
/* ===================================== */

* {
    -webkit-tap-highlight-color: transparent;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================== */
/* DARK MODE MOBILE OPTIMIZATIONS */
/* ===================================== */

@media (max-width: 768px) {
    .dark .mobile-menu {
        background: #1f2937;
        color: white;
    }

    .dark input, .dark textarea, .dark select {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
}

/* ===================================== */
/* LOADING & INTERACTION STATES */
/* ===================================== */

.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Swipe gestures support */
.swipeable {
    touch-action: pan-x;
}

/* Better focus states for accessibility */
button:focus, a:focus, input:focus, textarea:focus, select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ===================================== */
/* IMPROVED CONTRAST FOR READABILITY */
/* ===================================== */

@media (max-width: 768px) {
    .text-gray-500 {
        color: #6b7280;
    }
    
    .dark .text-gray-400 {
        color: #9ca3af;
    }

    /* Better line height for mobile reading */
    .prose {
        line-height: 1.6 !important;
    }

    .leading-relaxed {
        line-height: 1.5 !important;
    }
}

/* ===================================== */
/* VERY SMALL SCREENS (< 375px) */
/* ===================================== */

@media (max-width: 374px) {
    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.25rem !important;
    }

    .text-4xl {
        font-size: 20px !important;
    }

    /* Even more compact spacing */
    .p-6 {
        padding: 0.5rem !important;
    }

    .px-4 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}