/**
 * Multi-Game Platform - Responsive Styles
 * Domain: gamez.toolboxgalaxy.com
 * Developer: Mohd Aziz Shaikh
 * Company: Aadi Tech Solutions (www.aaditechs.in)
 */

/* Mobile First Approach - Base styles are for mobile */

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    /* Typography adjustments */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Container padding */
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    /* Header adjustments */
    .header-content {
        flex-direction: column;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm) 0;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .user-section {
        order: 2;
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .auth-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .auth-buttons .btn {
        width: 100%;
    }
    
    /* Hero section */
    .hero {
        padding: var(--spacing-lg) 0;
    }
    
    .hero-title {
        font-size: 1.75rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .hero-description {
        font-size: 1rem;
        margin-bottom: var(--spacing-lg);
    }
    
    .hero-stats {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    /* Games section */
    .games-section {
        padding: var(--spacing-lg) 0;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .game-card {
        padding: var(--spacing-lg);
    }
    
    .game-icon {
        font-size: 3rem;
    }
    
    /* .game-info responsive styles moved to chess-theme.css */
    
    .game-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .game-actions .btn {
        width: 100%;
    }
    
    /* Features section */
    .features-section {
        padding: var(--spacing-lg) 0;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .feature-card {
        padding: var(--spacing-lg);
    }
    
    .feature-icon {
        font-size: 2.5rem;
    }
    
    /* Footer */
    .footer {
        padding: var(--spacing-lg) 0;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        margin: var(--spacing-sm);
    }
    
    .modal-header {
        padding: var(--spacing-md);
    }
    
    .modal-body {
        padding: var(--spacing-md);
    }
    
    .game-modes {
        gap: var(--spacing-md);
    }
    
    .mode-option {
        padding: var(--spacing-md);
    }
}

/* Medium Mobile Devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    
    /* Header */
    .header-content {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    
    .user-section {
        order: 2;
    }
    
    /* Hero */
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-stats {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-lg);
    }
    
    /* Games grid */
    .games-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: var(--spacing-lg);
    }
    
    /* Features grid */
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--spacing-lg);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
}

/* Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Header */
    .header-content {
        flex-direction: row;
    }
    
    .nav {
        order: 2;
        width: auto;
    }
    
    .user-section {
        order: 3;
    }
    
    /* Hero */
    .hero-title {
        font-size: 2.5rem;
    }
    
    /* Games grid */
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xl);
    }
    
    /* Features grid */
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-xl);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Desktop (1025px - 1440px) */
@media (min-width: 1025px) and (max-width: 1440px) {
    .container {
        max-width: 1200px;
    }
    
    /* Games grid */
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Features grid */
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large Desktop (1441px+) */
@media (min-width: 1441px) {
    .container {
        max-width: 1400px;
    }
    
    /* Games grid */
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Features grid */
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Landscape Orientation Adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .hero {
        padding: var(--spacing-lg) 0;
    }
    
    .hero-title {
        font-size: 2rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .hero-description {
        margin-bottom: var(--spacing-md);
    }
    
    .hero-stats {
        margin-top: var(--spacing-md);
    }
    
    .games-section,
    .features-section {
        padding: var(--spacing-lg) 0;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp rendering on high DPI displays */
    .game-icon,
    .feature-icon {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        padding: var(--spacing-md) var(--spacing-lg);
    }
    
    .nav-link {
        padding: var(--spacing-sm) var(--spacing-md);
        display: block;
    }
    
    .theme-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .game-card:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
    
    .btn-primary:hover {
        transform: none;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
    
    .game-card:hover {
        transform: none;
    }
    
    .btn-primary:hover {
        transform: none;
    }
}

/* Dark Mode Media Query Support */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary-color: #60a5fa;
        --primary-hover: #3b82f6;
        --secondary-color: #94a3b8;
        --accent-color: #fbbf24;
        
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --bg-card: #1e293b;
        --bg-overlay: rgba(0, 0, 0, 0.7);
        
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        
        --border-color: #334155;
        --border-hover: #475569;
    }
}

/* Print Styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .header,
    .footer,
    .modal,
    .btn,
    .theme-toggle {
        display: none !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .hero {
        background: none !important;
        color: black !important;
        padding: 1rem 0;
    }
    
    .games-section,
    .features-section {
        padding: 1rem 0;
    }
    
    .game-card,
    .feature-card {
        border: 1px solid #ccc;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
    }
}

/* Accessibility Improvements */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
        --text-muted: #333333;
    }
    
    [data-theme="dark"] {
        --border-color: #ffffff;
        --text-secondary: #ffffff;
        --text-muted: #cccccc;
    }
}

/* Focus Visible for Better Accessibility */
@media (prefers-reduced-motion: no-preference) {
    *:focus-visible {
        outline: 3px solid var(--primary-color);
        outline-offset: 2px;
    }
}

/* Container Queries (Future-proofing) */
@container (min-width: 300px) {
    .game-card {
        padding: var(--spacing-xl);
    }
}

@container (max-width: 299px) {
    .game-card {
        padding: var(--spacing-md);
    }
    
    .game-icon {
        font-size: 2rem;
    }
}
