/**
 * JavaESPORTS - Mobile & Tablet Enhancements
 * Specific optimizations for mobile and tablet devices
 * Complements responsive.css with device-specific improvements
 * 
 * @version 1.0
 * @date 2025
 */

/* ============================================================================
   MOBILE-SPECIFIC IMPROVEMENTS (< 768px)
   ============================================================================ */

@media (max-width: 767px) {
    /* ========== HERO SECTION - PREMIUM MOBILE DESIGN ========== */
    
    .hero {
        padding: 2rem 1.25rem;
        gap: 2.5rem;
        min-height: auto;
    }
    
    .hero__text {
        padding: 2rem 1.5rem;
        gap: 1.5rem;
        background: rgba(30, 27, 75, 0.6);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-radius: 20px;
        border: 1px solid rgba(139, 92, 246, 0.2);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                    0 4px 16px rgba(139, 92, 246, 0.2);
    }
    
    .hero__text h1 {
        font-size: 2.125rem;
        line-height: 1.15;
        letter-spacing: -0.03em;
        font-weight: 800;
        background: linear-gradient(135deg, #fff 0%, #e0d4ff 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .hero__text p {
        font-size: 1rem;
        line-height: 1.65;
        color: rgba(255, 255, 255, 0.9);
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .hero__actions {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
    }
    
    .hero__actions .btn {
        width: 100%;
        padding: 1.125rem 1.5rem;
        font-size: 1.0625rem;
        font-weight: 600;
        border-radius: 14px;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    }
    
    .hero__actions .btn:active {
        transform: scale(0.97);
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    }
    
    .hero__stats {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 1.25rem;
        width: 100%;
    }
    
    .stat {
        padding: 1.125rem 1rem;
        text-align: center;
        background: rgba(139, 92, 246, 0.15);
        border-radius: 16px;
        border: 1px solid rgba(139, 92, 246, 0.25);
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    .stat:active {
        transform: scale(0.96);
    }
    
    .stat__value {
        font-size: 1.75rem;
        font-weight: 700;
        display: block;
        margin-bottom: 0.375rem;
        background: linear-gradient(135deg, #8b5cf6, #a78bfa);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .stat__label {
        font-size: 0.8125rem;
        display: block;
        color: rgba(255, 255, 255, 0.8);
        font-weight: 500;
    }
    
    /* ========== NEWS SLIDER - PREMIUM MOBILE DESIGN ========== */
    
    .hero__highlights {
        min-height: 450px;
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                    0 4px 16px rgba(139, 92, 246, 0.2);
        border: 1px solid rgba(139, 92, 246, 0.2);
    }
    
    .news-slide {
        min-height: 450px;
    }
    
    .news-slide__overlay {
        padding: 2rem 1.5rem;
        background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.85) 0%,
            rgba(0, 0, 0, 0.6) 50%,
            rgba(0, 0, 0, 0.3) 100%
        );
    }
    
    .news-slide__headline {
        font-size: 1.625rem;
        line-height: 1.25;
        margin-bottom: 1rem;
        font-weight: 700;
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }
    
    .news-slide__summary {
        font-size: 0.9375rem;
        line-height: 1.6;
        margin-bottom: 1.25rem;
        color: rgba(255, 255, 255, 0.95);
        text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
        /* Limit lines on mobile */
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .news-slide__meta {
        font-size: 0.8125rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .news-slide__cta {
        padding: 1rem 1.75rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    }
    
    .news-slide__cta:active {
        transform: scale(0.97);
    }
    
    .news-slider__pagination {
        bottom: 1.5rem;
        gap: 0.625rem;
    }
    
    .news-slider__dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .news-slider__dot.is-active {
        width: 28px;
        border-radius: 12px;
        background: linear-gradient(135deg, #8b5cf6, #a78bfa);
        box-shadow: 0 2px 12px rgba(139, 92, 246, 0.6);
    }
    
    /* ========== SECTIONS - PREMIUM MOBILE SPACING ========== */
    
    .section {
        padding: 3rem 1.25rem;
    }
    
    .section--alt {
        padding: 3rem 1.25rem;
    }
    
    .section__header {
        margin-bottom: 2rem;
        text-align: center;
    }
    
    .section__header h2 {
        font-size: 1.875rem;
        line-height: 1.2;
        margin-bottom: 1rem;
        font-weight: 800;
        background: linear-gradient(135deg, #fff 0%, #e0d4ff 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .section__header p {
        font-size: 1rem;
        line-height: 1.65;
        margin-bottom: 1.25rem;
        color: rgba(255, 255, 255, 0.9);
    }
    
    .link-arrow {
        font-size: 1rem;
        padding: 0.75rem 1.25rem;
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    .link-arrow:active {
        transform: scale(0.97);
    }
    
    /* ========== CARDS - PREMIUM MOBILE DESIGN ========== */
    
    .card {
        padding: 1.5rem;
        border-radius: 18px;
        gap: 1.25rem;
        background: rgba(30, 27, 75, 0.6);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(139, 92, 246, 0.2);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2),
                    0 2px 8px rgba(139, 92, 246, 0.1);
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    .card:active {
        transform: translateY(-2px) scale(0.99);
        box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3);
    }
    
    .card h3 {
        font-size: 1.1875rem;
        line-height: 1.3;
        margin-bottom: 0.625rem;
        font-weight: 700;
    }
    
    .card p {
        font-size: 0.9375rem;
        line-height: 1.65;
        color: rgba(255, 255, 255, 0.9);
    }
    
    .card__image {
        border-radius: 14px;
        aspect-ratio: 16 / 9;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s ease;
    }
    
    .card:active .card__image {
        transform: scale(0.98);
    }
    
    .card__meta {
        font-size: 0.875rem;
        gap: 0.875rem;
        flex-wrap: wrap;
    }
    
    .card .btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    }
    
    .card .btn:active {
        transform: scale(0.97);
    }
    
    /* ========== CARDS GRIDS ========== */
    
    .cards-grid,
    .cards-grid--news,
    .cards-grid--accounts,
    .cards-grid--admins {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    /* ========== PROGRESSION CARDS ========== */
    
    .progression-grid,
    .progression-grid--home {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .progression-card {
        padding: 1rem;
    }
    
    .progression-card__media {
        aspect-ratio: 3 / 4;
        border-radius: 12px;
        overflow: hidden;
    }
    
    .progression-card h3 {
        font-size: 1rem;
        margin-top: 0.75rem;
    }
    
    /* ========== SKILL TRAINING ========== */
    
    .skill-grid,
    .skill-grid--home {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .skill-card {
        border-radius: 12px;
        overflow: hidden;
    }
    
    .skill-card img {
        border-radius: 12px;
    }
    
    /* ========== COINS SECTION ========== */
    
    .coins-grid,
    .coins-grid--home {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .coin-card {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .coin-card h3 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .coin-card__price {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .coin-card__description {
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    .coin-card__badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* ========== FOOTER ========== */
    
    .footer {
        padding: 2rem 1rem;
    }
    
    .footer__inner {
        gap: 2rem;
        text-align: center;
    }
    
    .footer__social {
        order: 1;
    }
    
    .footer__brand {
        order: 2;
    }
    
    .footer__social-links {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .footer__social-link {
        padding: 1rem;
        justify-content: center;
    }
    
    .footer__title {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .footer__copyright,
    .footer__credits {
        font-size: 0.8125rem;
        line-height: 1.6;
    }
    
    .logo {
        justify-content: center;
        margin-bottom: 1rem;
    }
    
    /* ========== ADMIN CARDS ========== */
    
    .admin-card__role {
        font-size: 0.875rem;
    }
    
    .admin-card__bio {
        font-size: 0.875rem;
        line-height: 1.6;
    }
    
    .admin-card__contact {
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
    }
    
    .admin-card__contact-secondary {
        font-size: 0.8125rem;
    }
    
    /* ========== BETTER TAP TARGETS ========== */
    
    a, button, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on mobile */
    .card:hover,
    .btn:hover {
        transform: none;
    }
    
    /* Add active states for touch feedback */
    .card:active {
        transform: scale(0.98);
        opacity: 0.95;
    }
    
    .btn:active {
        transform: scale(0.97);
    }
    
    /* ========== OPTIMIZE IMAGES FOR MOBILE ========== */
    
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* ========== PREVENT HORIZONTAL SCROLL ========== */
    
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    * {
        max-width: 100%;
    }
    
    /* ========== IMPROVED TYPOGRAPHY ========== */
    
    h1 {
        font-size: 2rem;
        line-height: 1.15;
        letter-spacing: -0.02em;
        word-break: break-word;
    }
    
    h2 {
        font-size: 1.75rem;
        line-height: 1.2;
        word-break: break-word;
    }
    
    h3 {
        font-size: 1.25rem;
        line-height: 1.3;
        word-break: break-word;
    }
    
    p {
        font-size: 0.9375rem;
        line-height: 1.6;
        word-break: break-word;
    }
}

/* ============================================================================
   SMALL MOBILE DEVICES (< 480px)
   ============================================================================ */

@media (max-width: 479px) {
    .hero__text h1 {
        font-size: 1.75rem;
    }
    
    .section__header h2 {
        font-size: 1.5rem;
    }
    
    .hero__stats {
        grid-template-columns: 1fr;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .card {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
}

/* ============================================================================
   TABLET SPECIFIC IMPROVEMENTS (768px - 1023px)
   Hamburger menu visible, optimized layout
   ============================================================================ */

@media (min-width: 768px) and (max-width: 1023px) {
    /* ========== NAVIGATION ========== */
    
    /* Mobile menu should still be visible on tablets */
    .mobile-toggle {
        display: flex !important;
    }
    
    .nav {
        /* Will be positioned fixed when closed, shown on toggle */
        background: rgba(30, 27, 75, 0.98);
    }
    
    [data-theme="light"] .nav {
        background: rgba(255, 255, 255, 0.98);
    }
    /* ========== HERO SECTION ========== */
    
    .hero {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        padding: 2rem 1.5rem;
    }
    
    .hero__text {
        padding: 2rem;
    }
    
    .hero__text h1 {
        font-size: 2.25rem;
    }
    
    .hero__text p {
        font-size: 1rem;
    }
    
    .hero__actions {
        flex-direction: column;
    }
    
    .hero__actions .btn {
        width: 100%;
    }
    
    .hero__stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    /* ========== NEWS & CARDS ========== */
    
    .cards-grid,
    .cards-grid--news,
    .cards-grid--accounts {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .cards-grid--admins {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* ========== PROGRESSION & SKILLS ========== */
    
    .progression-grid,
    .progression-grid--home {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .skill-grid,
    .skill-grid--home {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* ========== COINS ========== */
    
    .coins-grid,
    .coins-grid--home {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* ========== SECTIONS ========== */
    
    .section {
        padding: 3rem 1.5rem;
    }
    
    .section__header h2 {
        font-size: 2rem;
    }
    
    /* ========== FOOTER ========== */
    
    .footer__inner {
        grid-template-columns: 1fr 1fr;
        text-align: left;
    }
    
    .footer__social-links {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================================
   LANDSCAPE MOBILE OPTIMIZATION
   ============================================================================ */

@media (max-width: 767px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 2rem 1rem;
    }
    
    .hero__highlights {
        min-height: 350px;
    }
    
    .section {
        padding: 2rem 1rem;
    }
    
    /* Optimize navbar for landscape */
    .topbar__inner {
        height: 56px;
    }
    
    body {
        padding-top: 56px !important;
    }
}

/* ============================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================================================ */

@media (hover: none) and (pointer: coarse) {
    /* All interactive elements should have larger touch targets */
    .nav__link,
    .btn,
    .card,
    .footer__social-link,
    .lang-selector__button,
    .theme-toggle {
        min-height: 48px;
        min-width: 48px;
    }
    
    /* Remove hover animations */
    *:hover {
        animation-duration: 0s !important;
    }
    
    /* Add active states for better touch feedback */
    .nav__link:active,
    .btn:active,
    .card:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
    
    /* Improve scroll behavior on touch devices */
    body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: none;
    }
    
    /* Better tap highlight color */
    * {
        -webkit-tap-highlight-color: rgba(139, 92, 246, 0.2);
    }
    
    /* Ensure proper spacing between all interactive elements */
    .btn + .btn,
    a + a,
    button + button {
        margin-left: 0.75rem;
    }
    
    /* Better vertical rhythm for mobile */
    section + section {
        margin-top: 2rem;
    }
}

/* ============================================================================
   HIGH DPI SCREENS (RETINA)
   ============================================================================ */

@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Sharper borders on high DPI screens */
    .card,
    .btn,
    .hero__text,
    .section {
        border-width: 0.5px;
    }
    
    /* Better shadows on retina */
    .card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
                    0 8px 16px rgba(139, 92, 246, 0.1);
    }
}

/* ============================================================================
   SAFE AREA INSETS (iPhone X and newer)
   ============================================================================ */

@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .topbar {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .footer {
        padding-bottom: max(2rem, calc(2rem + env(safe-area-inset-bottom)));
    }
}

/* ============================================================================
   PERFORMANCE OPTIMIZATIONS FOR MOBILE
   ============================================================================ */

@media (max-width: 767px) {
    /* Reduce animation complexity on mobile */
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Optimize images */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
    
    /* Use GPU acceleration */
    .card,
    .btn,
    .hero__text {
        transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
}

/* ============================================================================
   ACCESSIBILITY ENHANCEMENTS FOR MOBILE
   ============================================================================ */

@media (max-width: 767px) {
    /* Larger focus outlines for easier visibility */
    :focus-visible {
        outline-width: 3px;
        outline-offset: 3px;
    }
    
    /* Better skip link */
    .skip-link:focus {
        padding: 1rem;
        font-size: 1rem;
    }
}

/* ============================================================================
   LIGHT MODE PREMIUM MOBILE DESIGN
   ============================================================================ */

@media (max-width: 767px) {
    [data-theme="light"] .hero__text {
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(139, 92, 246, 0.25);
        box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15),
                    0 4px 16px rgba(0, 0, 0, 0.1);
    }
    
    [data-theme="light"] .hero__text h1 {
        background: linear-gradient(135deg, #1e1b4b 0%, #7c3aed 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    [data-theme="light"] .hero__text p {
        color: rgba(30, 27, 75, 0.85);
        text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    }
    
    [data-theme="light"] .stat {
        background: rgba(139, 92, 246, 0.1);
        border: 1px solid rgba(139, 92, 246, 0.3);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.12);
    }
    
    [data-theme="light"] .stat__label {
        color: rgba(30, 27, 75, 0.75);
    }
    
    [data-theme="light"] .card {
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(139, 92, 246, 0.25);
        box-shadow: 0 4px 16px rgba(139, 92, 246, 0.12),
                    0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    [data-theme="light"] .card:active {
        box-shadow: 0 6px 20px rgba(139, 92, 246, 0.2);
    }
    
    [data-theme="light"] .card h3 {
        color: #1e1b4b;
    }
    
    [data-theme="light"] .card p {
        color: rgba(30, 27, 75, 0.8);
    }
    
    [data-theme="light"] .section__header h2 {
        background: linear-gradient(135deg, #1e1b4b 0%, #7c3aed 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    [data-theme="light"] .section__header p {
        color: rgba(30, 27, 75, 0.8);
    }
    
    [data-theme="light"] .hero__highlights {
        border: 1px solid rgba(139, 92, 246, 0.25);
        box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15),
                    0 4px 16px rgba(0, 0, 0, 0.1);
    }
}

/* ============================================================================
   PREMIUM SCROLL BEHAVIOR FOR MOBILE
   ============================================================================ */

@media (max-width: 767px) {
    /* Smooth momentum scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Pull-to-refresh optimization */
    body {
        overscroll-behavior-y: contain;
    }
    
    /* Smooth scroll snap for sections */
    .section {
        scroll-snap-align: start;
        scroll-snap-stop: normal;
    }
    
    /* Better touch scrolling for cards grid */
    .cards-grid {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* ============================================================================
   END OF MOBILE ENHANCEMENTS
   ============================================================================ */

