/* Mobile First Responsive Design */

/* Extra Small Devices (phones, 576px and down) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 15px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        margin: 0 auto;
    }
    
    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    /* Header */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--white);
        box-shadow: var(--shadow);
    }
    
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }
    
    .nav-brand {
        flex-shrink: 0;
    }
    
    .nav-brand img {
        height: 40px;
        width: auto;
    }
    
    /* Navigation */
    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(10, 25, 47, 0.98);
        backdrop-filter: blur(10px);
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 9999;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    /* Hide nav-actions on mobile when menu is closed */
    .nav-actions {
        display: none;
    }
    
    .nav-menu.active {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 400px;
    }
    
    .nav-list li {
        width: 100%;
        text-align: center;
    }
    
    .nav-list a {
        display: block;
        padding: 1.5rem 2rem;
        color: var(--white);
        font-weight: 600;
        font-size: 1.2rem;
        text-decoration: none;
        transition: all 0.3s ease;
        position: relative;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-list a:hover {
        background: rgba(100, 255, 218, 0.1);
        color: var(--secondary-color);
        transform: translateX(10px);
    }
    
    .nav-list a::after {
        display: none;
    }
    
    .nav-list a::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: var(--secondary-color);
        transform: scaleY(0);
        transition: transform 0.3s ease;
    }
    
    .nav-list a:hover::before {
        transform: scaleY(1);
    }
    
    .nav-menu.active .nav-actions {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 2rem;
        margin-top: 2rem;
        width: 100%;
        max-width: 400px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .nav-menu.active .nav-actions .btn {
        width: 100%;
        padding: 1rem 2rem;
        font-size: 1.1rem;
        font-weight: 600;
        text-align: center;
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .nav-menu.active .nav-actions .btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .nav-toggle {
        display: flex !important;
        position: relative;
        z-index: 10000;
        background: linear-gradient(135deg, var(--primary-color), #1a365d);
        border-radius: 8px;
        padding: 8px;
        backdrop-filter: blur(10px);
        border: 2px solid var(--secondary-color);
        flex-shrink: 0;
        margin-left: 1rem;
        box-shadow: 0 4px 12px rgba(10, 25, 47, 0.3);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        cursor: pointer;
    }
    
    .nav-toggle:hover {
        background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(100, 255, 218, 0.4);
    }
    
    .nav-toggle span {
        background: var(--white) !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
    
    .nav-toggle.active {
        background: linear-gradient(135deg, var(--secondary-color), #00d4aa);
        border-color: var(--white);
        transform: scale(1.1);
        box-shadow: 0 8px 20px rgba(100, 255, 218, 0.5);
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
        background: var(--white) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: scale(0);
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
        background: var(--white) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    /* Hero Section */
    .hero-section {
        min-height: 100vh;
        padding: 2rem 0;
        display: flex;
        align-items: center;
    }
    
    .hero-content {
        padding: 0 1rem;
        max-width: 100%;
    }
    
    .hero-title {
        font-size: 2.2rem;
        margin-bottom: 1rem;
        line-height: 1.2;
        word-wrap: break-word;
    }
    
    .hero-title .highlight {
        display: block;
        margin-top: 0.5rem;
    }
    
    .hero-description {
        font-size: 1rem;
        margin-bottom: 2rem;
        line-height: 1.6;
        padding: 0 0.5rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        width: 100%;
    }
    
    .hero-actions .btn {
        width: 100%;
        max-width: 300px;
        padding: 14px 24px;
        font-size: 1rem;
        text-align: center;
    }
    
    .hero-background {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1;
    }
    
    .hero-bg-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0.3;
    }
    
    .hero-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, rgba(10, 25, 47, 0.8), rgba(26, 42, 74, 0.6));
        z-index: 1;
    }
    
    /* Additional mobile optimizations */
    .hero-title .highlight {
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        display: inline;
    }
    
    /* Sections */
    section {
        padding: 3rem 0;
    }
    
    .section-title {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
    
    /* About Section */
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-text h2 {
        text-align: center;
    }
    
    /* Games */
    .games-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .game-card {
        margin: 0 1rem;
    }
    
    .game-card-content {
        padding: 1rem;
    }
    
    .game-card h3 {
        font-size: 1.2rem;
    }
    
    .game-card-play-btn {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
    }
    
    /* Benefits */
    .benefits-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .benefit-item {
        padding: 1.5rem;
    }
    
    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .testimonial-card {
        padding: 1.5rem;
    }
    
    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .stat-item {
        padding: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    /* CTA */
    .cta-actions {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .cta-actions .btn {
        width: 100%;
        max-width: 280px;
    }
    
    .cta-title {
        font-size: 2.5rem;
    }
    
    .cta-description {
        font-size: 1.1rem;
    }
    
    .cta-features {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 3rem;
    }
    
    .cta-section {
        padding: 4rem 0;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    /* Back to Top */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* Very Small Devices (phones, up to 480px) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
        line-height: 1.1;
    }
    
    .hero-description {
        font-size: 0.9rem;
        padding: 0;
    }
    
    .hero-actions .btn {
        max-width: 280px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .hero-content {
        padding: 0 0.5rem;
    }
    
    /* Ensure nav-toggle is visible on very small screens */
    .nav-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        padding: 0 20px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        margin: 0 auto;
    }
    
    /* Hero */
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* About */
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Games */
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Benefits */
    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: 1fr;
    }
    
    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* CTA */
    .cta-actions {
        flex-direction: row;
        justify-content: center;
        gap: 1.5rem;
    }
    
    .cta-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .cta-title {
        font-size: 2.8rem;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Navigation */
    .nav-toggle {
        display: none;
    }
    
    .nav-menu {
        display: flex;
    }
    
    /* Hero */
    .hero-title {
        font-size: 3.5rem;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* About */
    .about-content {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
    
    /* Games */
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Benefits */
    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Features */
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Games */
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Benefits */
    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Games */
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Benefits */
    .benefits-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        min-height: 100vh;
        padding: 1rem 0;
    }
    
    .hero-title {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .hero-description {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    section {
        padding: 2rem 0;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-bg-image,
    .feature-icon img,
    .game-card img,
    .about-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .header,
    .nav-toggle,
    .back-to-top,
    .cta-section,
    .footer {
        display: none;
    }
    
    .hero-section {
        min-height: auto;
        background: none;
        color: black;
    }
    
    .hero-bg-image,
    .hero-overlay {
        display: none;
    }
    
    section {
        padding: 1rem 0;
        page-break-inside: avoid;
    }
    
    .btn {
        border: 1px solid black;
        background: white;
        color: black;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .hero-section,
    .feature-card,
    .game-card,
    .testimonial-card,
    .btn {
        transition: none;
    }
    
    .back-to-top {
        transition: opacity 0.3s ease;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #1a1a1a;
        --text-dark: #ffffff;
        --text-light: #cccccc;
        --highlight-color: #2a2a2a;
    }
    
    .header {
        background: #1a1a1a;
        border-bottom: 1px solid #333;
    }
    
    .feature-card,
    .game-card,
    .testimonial-card {
        background: #2a2a2a;
        border: 1px solid #333;
    }
    
    .nav-list a {
        color: #ffffff;
    }
    
    .nav-toggle span {
        background: #ffffff;
    }
}

/* Focus Management for Keyboard Navigation */
@media (any-hover: none) {
    .btn:hover,
    .feature-card:hover,
    .game-card:hover,
    .testimonial-card:hover {
        transform: none;
    }
    
    .btn:focus,
    .feature-card:focus,
    .game-card:focus,
    .testimonial-card:focus {
        transform: translateY(-2px);
    }
}

/* Container Queries (Future-proofing) */
@container (max-width: 400px) {
    .feature-card {
        padding: 1rem;
    }
    
    .game-card h3 {
        font-size: 1.25rem;
    }
}

/* Hover Effects Only on Devices That Support Hover */
@media (hover: hover) {
    .feature-card:hover,
    .game-card:hover,
    .testimonial-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-lg);
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
}

/* Touch Device Optimizations */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-list a {
        padding: 1rem;
    }
    
    .back-to-top {
        width: 56px;
        height: 56px;
    }
}

/* Page-specific responsive styles */
@media (max-width: 767.98px) {
    /* Header */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--white);
        box-shadow: var(--shadow);
    }
    
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }
    
    .nav-brand {
        flex-shrink: 0;
    }
    
    .nav-brand img {
        height: 40px;
        width: auto;
    }
    
    /* Ensure nav-toggle is visible on mobile */
    .navbar .nav-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Hide nav-actions in header on mobile */
    .navbar .nav-actions {
        display: none;
    }
    
    /* Add body padding for fixed header */
    body {
        padding-top: 70px;
    }
    
    /* Page header */
    .page-header {
        padding: 6rem 0 3rem;
        margin-top: 70px;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .page-header p {
        font-size: 1rem;
    }
    
    /* About page */
    .about-hero {
        text-align: center;
        margin: 2rem 1rem;
    }
    
    .about-hero-content h2 {
        text-align: center;
    }
    
    /* About section on homepage */
    .about-content {
        text-align: center;
        margin: 2rem 1rem;
    }
    
    .about-text h2 {
        text-align: center;
    }
    
    .about-text p {
        text-align: center;
    }
    
    .mission-vision {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .values-grid {
        grid-template-columns: 1fr;
    }
    
    .team-grid {
        grid-template-columns: 1fr;
    }
    
    .team-member img {
        width: 120px;
        height: 120px;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Contact page */
    .contact-methods {
        grid-template-columns: 1fr;
    }
    
    .contact-form-section {
        padding: 2rem;
    }
    
    .topics-grid {
        grid-template-columns: 1fr;
    }
    
    .response-grid {
        grid-template-columns: 1fr;
    }
    
    /* FAQ page */
    .faq-contact-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .faq-contact-actions .btn {
        width: 100%;
        max-width: 280px;
    }
    
    /* 404 page */
    .error-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .error-code {
        font-size: 6rem;
    }
    
    .error-title {
        font-size: 2rem;
    }
    
    .error-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .error-actions .btn {
        width: 100%;
        max-width: 280px;
    }
    
    .popular-pages-grid {
        grid-template-columns: 1fr;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-input-group input {
        border-radius: var(--border-radius) var(--border-radius) 0 0;
    }
    
    .search-input-group button {
        border-radius: 0 0 var(--border-radius) var(--border-radius);
    }
    
    /* Login section - Stack on mobile */
    .login-section .container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .login-section .section-content {
        text-align: center;
    }
    
    .login-section .section-content h2 {
        text-align: center;
    }
    
    .login-section .section-content p {
        text-align: center;
    }
    
    /* Register images - Stack on mobile */
    .register-images {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2rem;
        padding: 1rem 0;
    }
    
    .register-images img {
        height: 220px;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* About page */
    .about-hero {
        text-align: center;
        margin: 3rem auto;
    }
    
    .mission-vision {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Register images - 2 columns on tablet */
    .register-images {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Contact page */
    .contact-methods {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .topics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .response-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 404 page */
    .error-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .popular-pages-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    /* About page */
    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .achievements-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Contact page */
    .contact-methods {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .topics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .response-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 404 page */
    .popular-pages-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
