/**
 * JavaESPORTS - Background Consistency Styles
 * Ensures consistent backgrounds across all pages and sections
 * Optimized for mobile and desktop
 * @version 1.0
 * @date 2025
 */

/* ============================================================================
   BASE BACKGROUND SYSTEM
   ============================================================================ */

/* Main page background - consistent across all pages */
body {
    background: linear-gradient(
        180deg,
        rgba(10, 12, 25, 1) 0%,
        rgba(15, 17, 35, 1) 50%,
        rgba(10, 12, 25, 1) 100%
    );
    background-attachment: fixed;
    background-size: cover;
    min-height: 100vh;
    position: relative;
}

/* Add subtle pattern overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Light mode backgrounds */
[data-theme="light"] body {
    background: linear-gradient(
        180deg,
        rgba(248, 249, 255, 1) 0%,
        rgba(240, 242, 255, 1) 50%,
        rgba(248, 249, 255, 1) 100%
    );
}

[data-theme="light"] body::before {
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.08) 0%, transparent 50%);
}

/* ============================================================================
   PAGE CONTAINER CONSISTENCY
   ============================================================================ */

.page {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 70px);
    background: transparent;
}

/* ============================================================================
   SECTION BACKGROUNDS - CONSISTENT ACROSS ALL PAGES
   ============================================================================ */

.section {
    background: transparent;
    position: relative;
}

/* Alternating section backgrounds for visual hierarchy */
.section--alt {
    background: rgba(15, 17, 35, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="light"] .section--alt {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ============================================================================
   HERO SECTION BACKGROUND
   ============================================================================ */

.hero {
    background: transparent;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at top, rgba(139, 92, 246, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at bottom, rgba(124, 58, 237, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

[data-theme="light"] .hero::before {
    background: 
        radial-gradient(ellipse at top, rgba(139, 92, 246, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at bottom, rgba(124, 58, 237, 0.1) 0%, transparent 60%);
}

/* ============================================================================
   CARD BACKGROUNDS - GLASS MORPHISM CONSISTENCY
   ============================================================================ */

.card {
    background: rgba(30, 27, 75, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(139, 92, 246, 0.15);
}

[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* ============================================================================
   NEWS SECTION BACKGROUNDS
   ============================================================================ */

.news-slide {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.4) 100%
    );
}

.news-slide__overlay {
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.6) 50%,
        rgba(0, 0, 0, 0.2) 100%
    );
}

/* ============================================================================
   ACCOUNTS SECTION BACKGROUND
   ============================================================================ */

.accounts-section {
    background: radial-gradient(
        120% 120% at 0% 0%,
        rgba(89, 86, 255, 0.15) 0%,
        rgba(12, 16, 40, 0.85) 45%,
        rgba(8, 10, 24, 0.9) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.15);
}

[data-theme="light"] .accounts-section {
    background: linear-gradient(
        160deg,
        rgba(255, 255, 255, 0.95),
        rgba(141, 131, 255, 0.2)
    );
    border: 1px solid rgba(139, 92, 246, 0.15);
}

/* ============================================================================
   MODAL BACKGROUNDS
   ============================================================================ */

.modal {
    background: rgba(10, 12, 25, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.modal__content {
    background: rgba(30, 27, 75, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

[data-theme="light"] .modal {
    background: rgba(248, 249, 255, 0.95);
}

[data-theme="light"] .modal__content {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.15);
}

/* ============================================================================
   PROGRESSION & SKILL CARDS BACKGROUNDS
   ============================================================================ */

.progression-card,
.skill-card,
.coin-card,
.admin-card {
    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);
}

[data-theme="light"] .progression-card,
[data-theme="light"] .skill-card,
[data-theme="light"] .coin-card,
[data-theme="light"] .admin-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(139, 92, 246, 0.25);
}

/* ============================================================================
   TACTICS SECTION BACKGROUND
   ============================================================================ */

.tactics-card {
    background: rgba(30, 27, 75, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(139, 92, 246, 0.18);
}

[data-theme="light"] .tactics-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.22);
}

/* ============================================================================
   MOBILE SPECIFIC BACKGROUNDS (< 768px)
   ============================================================================ */

@media (max-width: 767px) {
    /* Optimize background rendering on mobile */
    body {
        background-attachment: scroll;
    }

    /* Simplify backgrounds for better performance */
    body::before {
        background-image: 
            radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
    }

    [data-theme="light"] body::before {
        background-image: 
            radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
    }

    /* Enhanced card backgrounds on mobile */
    .card,
    .progression-card,
    .skill-card,
    .coin-card,
    .admin-card,
    .tactics-card {
        background: rgba(30, 27, 75, 0.65);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    [data-theme="light"] .card,
    [data-theme="light"] .progression-card,
    [data-theme="light"] .skill-card,
    [data-theme="light"] .coin-card,
    [data-theme="light"] .admin-card,
    [data-theme="light"] .tactics-card {
        background: rgba(255, 255, 255, 0.9);
    }

    /* Hero text background enhancement for mobile */
    .hero__text {
        background: rgba(30, 27, 75, 0.7);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    [data-theme="light"] .hero__text {
        background: rgba(255, 255, 255, 0.9);
    }
}

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

@media (max-width: 479px) {
    /* Further simplify backgrounds for performance */
    body::before {
        opacity: 0.7;
    }

    /* Stronger card backgrounds for better readability */
    .card {
        background: rgba(30, 27, 75, 0.75);
    }

    [data-theme="light"] .card {
        background: rgba(255, 255, 255, 0.95);
    }
}

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

@media (max-width: 767px) and (orientation: landscape) {
    body {
        background-size: cover;
        background-position: center;
    }
}

/* ============================================================================
   HIGH DPI SCREENS - ENHANCED BACKGROUNDS
   ============================================================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body::before {
        background-size: 100% 100%;
    }
}

/* ============================================================================
   REDUCED MOTION - DISABLE FIXED BACKGROUNDS
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    body {
        background-attachment: scroll !important;
    }

    body::before {
        animation: none !important;
    }
}

/* ============================================================================
   PRINT STYLES - CLEAN BACKGROUNDS
   ============================================================================ */

@media print {
    body,
    .page,
    .section,
    .card {
        background: white !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body::before,
    .hero::before {
        display: none !important;
    }
}

/* ============================================================================
   FALLBACK FOR OLDER BROWSERS
   ============================================================================ */

@supports not (backdrop-filter: blur(10px)) {
    .card,
    .section--alt,
    .modal__content {
        background: rgba(30, 27, 75, 0.95);
    }

    [data-theme="light"] .card,
    [data-theme="light"] .section--alt,
    [data-theme="light"] .modal__content {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* ============================================================================
   END OF BACKGROUND CONSISTENCY STYLES
   ============================================================================ */

