/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg-primary: #0F0F19;
    --color-bg-secondary: #1A1A2E;
    --color-bg-card: #16213E;
    --color-primary: #8B5CF6;
    --color-secondary: #06B6D4;
    --color-accent: #F59E0B;
    --color-success: #10B981;
    --color-danger: #EF4444;
    --color-text-primary: #FFFFFF;
    --color-text-secondary: #9CA3AF;
    --color-text-tertiary: #6B7280;

    --gradient-primary: linear-gradient(135deg, #8B5CF6 0%, #06B6D4 100%);
    --gradient-card: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.4);

    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    min-height: 100vh;
    padding-bottom: 80px;
    padding-top: 40px;
    /* Space for support banner */
}

/* ===== CUSTOMER SUPPORT BANNER ===== */
.support-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.support-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.support-banner-text {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.support-banner a {
    color: white;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    transition: var(--transition-base);
}

.support-banner a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.support-banner svg {
    width: 14px;
    height: 14px;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 40px;
    /* Below support banner */
    left: 0;
    right: 0;
    background: var(--color-bg-primary);
    padding: var(--spacing-md);
    z-index: 999;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.logo {
    height: 36px;
    width: auto;
}

.header-icons {
    display: flex;
    gap: var(--spacing-sm);
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    background: var(--color-bg-card);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: var(--transition-base);
}

.icon-btn:active {
    transform: scale(0.95);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== SEARCH ===== */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-container svg {
    position: absolute;
    left: var(--spacing-md);
    color: var(--color-text-tertiary);
}

.search-input {
    width: 100%;
    padding: 0.875rem 0.875rem 0.875rem 3rem;
    background: var(--color-bg-card);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-lg);
    color: var(--color-text-primary);
    font-size: 0.95rem;
}

.search-input::placeholder {
    color: var(--color-text-tertiary);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: var(--spacing-md);
    padding-top: calc(150px + var(--spacing-md));
    /* Account for support banner (40px) + header (~110px) */
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

/* ===== FEATURED SECTION ===== */
.featured-carousel {
    display: flex;
    gap: var(--spacing-md);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: var(--spacing-lg);
}

.featured-carousel::-webkit-scrollbar {
    display: none;
}

.featured-card {
    flex: 0 0 85%;
    scroll-snap-align: start;
    background: var(--gradient-card);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.featured-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.featured-badge {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    background: var(--color-danger);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.featured-prize {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: rgba(245, 158, 11, 0.9);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
}

.featured-info {
    padding: var(--spacing-md);
}

.featured-game {
    color: var(--color-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.featured-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.featured-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
}

.featured-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.featured-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.btn-live {
    flex: 1;
    padding: 0.75rem;
    background: var(--color-danger);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-paint {
    flex: 1;
    padding: 0.75rem;
    background: var(--color-bg-secondary);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

/* ===== EARN BANNER ===== */
.earn-banner {
    background: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.earn-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.earn-content p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.earn-image {
    width: 100px;
    height: 80px;
}

/* ===== TOURNAMENTS SECTION ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.filter-btn {
    width: 40px;
    height: 40px;
    background: var(--color-bg-card);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    cursor: pointer;
}

.tournament-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
    scrollbar-width: none;
}

.tournament-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0.625rem 1.25rem;
    background: var(--color-bg-card);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-lg);
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-base);
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

/* ===== TOURNAMENT CARD ===== */
.tournament-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.tournament-card {
    background: var(--color-bg-secondary);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    display: flex;
    gap: var(--spacing-md);
}

.tournament-image {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.tournament-details {
    flex: 1;
}

.tournament-game {
    color: var(--color-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.tournament-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.tournament-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
}

.tournament-prize {
    color: var(--color-accent);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: var(--spacing-xs);
}

.tournament-date {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-bg-secondary);
    border-top: 1px solid rgba(139, 92, 246, 0.2);
    display: flex;
    justify-content: space-around;
    padding: var(--spacing-sm) 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-text-tertiary);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    padding: var(--spacing-xs);
    transition: var(--transition-base);
}

.nav-item.active {
    color: var(--color-primary);
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

/* ===== SKELETON LOADERS \u0026 SMOOTH TRANSITIONS ===== */

/* Skeleton shimmer animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 25%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* Skeleton for tournament cards */
.skeleton-tournament-card {
    background: var(--color-bg-secondary);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    display: flex;
    gap: var(--spacing-md);
    opacity: 0.7;
}

.skeleton-image {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.skeleton-text {
    height: 14px;
    border-radius: 4px;
}

.skeleton-text.title {
    height: 20px;
    width: 70%;
}

.skeleton-text.subtitle {
    width: 40%;
}

.skeleton-text.meta {
    width: 60%;
}

/* Skeleton for featured cards */
.skeleton-featured-card {
    flex: 0 0 85%;
    scroll-snap-align: start;
    background: var(--color-bg-secondary);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.skeleton-featured-image {
    width: 100%;
    height: 180px;
}

.skeleton-featured-content {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Fade-in animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Apply fade-in to tournament cards */
.tournament-card,
.featured-card {
    animation: fadeIn 0.4s ease-out;
    will-change: opacity, transform;
}

/* Stagger animation for lists */
.tournament-card:nth-child(1) {
    animation-delay: 0.05s;
}

.tournament-card:nth-child(2) {
    animation-delay: 0.1s;
}

.tournament-card:nth-child(3) {
    animation-delay: 0.15s;
}

.tournament-card:nth-child(4) {
    animation-delay: 0.2s;
}

.tournament-card:nth-child(5) {
    animation-delay: 0.25s;
}

/* Smooth page transitions */
body {
    animation: fadeInScale 0.3s ease-out;
}

/* Loading state */
.loading-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
}

/* Smooth transitions for content changes */
.tournament-list,
.featured-carousel {
    transition: opacity 0.3s ease;
}

.tournament-list.loading,
.featured-carousel.loading {
    opacity: 0.5;
}

/* Image loading transition */
img {
    transition: opacity 0.3s ease;
}

img.loading {
    opacity: 0;
}

img.loaded {
    opacity: 1;
}

/* Smooth hover effects */
.tournament-card,
.featured-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tournament-card:hover,
.featured-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Ensure smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading spinner animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}

/* ===== IMAGE LOADING OPTIMIZATIONS ===== */

/* Blur-up effect for image loading */
img.lazy-loading {
    filter: blur(10px);
    transform: scale(1.1);
}

img.lazy-loaded {
    filter: blur(0);
    transform: scale(1);
    transition: filter 0.3s ease, transform 0.3s ease;
}

/* Optimize rendering for off-screen content */
.tournament-card,
.featured-card {
    content-visibility: auto;
    contain-intrinsic-size: 120px;
}

/* Prevent layout shift during image loading */
.tournament-image,
.featured-image {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
}

.featured-image {
    aspect-ratio: 16 / 9;
}

/* Image fade-in when loaded */
@keyframes imageFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

img[loading="lazy"] {
    opacity: 0;
}

img.image-loaded {
    opacity: 1;
    animation: imageFadeIn 0.3s ease;
}