/**
 * NustarGame CSS Framework
 * All classes use prefix w9f59- to avoid conflicts
 * Mobile-first responsive design with max-width 430px
 */

/* CSS Variables for consistent theming */
:root {
    /* Primary Colors - Teal/Cyan palette */
    --w9f59-primary: #00695C;
    --w9f59-secondary: #AFEEEE;
    --w9f59-accent: #00B8D4;
    --w9f59-highlight: #FFC0CB;

    /* Neutral Colors */
    --w9f59-bg: #FAFAFA;
    --w9f59-bg-dark: #141414;
    --w9f59-text: #2D2D2D;
    --w9f59-text-light: #FFFFFF;
    --w9f59-text-muted: #666666;

    /* Semantic Colors */
    --w9f59-success: #4CAF50;
    --w9f59-warning: #FF9800;
    --w9f59-error: #F44336;
    --w9f59-info: #2196F3;

    /* Spacing Scale */
    --w9f59-space-xs: 0.4rem;
    --w9f59-space-sm: 0.8rem;
    --w9f59-space-md: 1.6rem;
    --w9f59-space-lg: 2.4rem;
    --w9f59-space-xl: 3.2rem;

    /* Typography */
    --w9f59-font-base: 1.6rem;
    --w9f59-font-sm: 1.4rem;
    --w9f59-font-lg: 1.8rem;
    --w9f59-font-xl: 2.2rem;
    --w9f59-font-xxl: 2.8rem;

    /* Border Radius */
    --w9f59-radius-sm: 0.4rem;
    --w9f59-radius-md: 0.8rem;
    --w9f59-radius-lg: 1.2rem;

    /* Shadows */
    --w9f59-shadow-sm: 0 0.2rem 0.4rem rgba(0,0,0,0.1);
    --w9f59-shadow-md: 0 0.4rem 0.8rem rgba(0,0,0,0.15);
    --w9f59-shadow-lg: 0 0.8rem 1.6rem rgba(0,0,0,0.2);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 62.5%; /* Makes 1rem = 10px */
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: var(--w9f59-font-base);
    line-height: 1.5;
    color: var(--w9f59-text);
    background-color: var(--w9f59-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Mobile-first responsive container */
.w9f59-container {
    max-width: 430px;
    margin: 0 auto;
    padding: 0 var(--w9f59-space-sm);
}

.w9f59-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header and Navigation */
.w9f59-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, var(--w9f59-primary) 0%, var(--w9f59-accent) 100%);
    box-shadow: var(--w9f59-shadow-md);
    backdrop-filter: blur(1rem);
}

.w9f59-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--w9f59-space-sm) var(--w9f59-space-md);
    max-width: 430px;
    margin: 0 auto;
}

.w9f59-logo {
    display: flex;
    align-items: center;
    gap: var(--w9f59-space-xs);
    text-decoration: none;
    color: var(--w9f59-text-light);
    font-weight: 700;
    font-size: var(--w9f59-font-lg);
}

.w9f59-logo img {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: var(--w9f59-radius-sm);
}

.w9f59-header-actions {
    display: flex;
    align-items: center;
    gap: var(--w9f59-space-xs);
}

.w9f59-btn {
    padding: var(--w9f59-space-xs) var(--w9f59-space-sm);
    border: none;
    border-radius: var(--w9f59-radius-md);
    font-size: var(--w9f59-font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 4.4rem; /* Touch-friendly minimum */
    min-width: 6rem;
}

.w9f59-btn-primary {
    background: var(--w9f59-highlight);
    color: var(--w9f59-text);
    box-shadow: var(--w9f59-shadow-sm);
}

.w9f59-btn-primary:hover {
    background: #FFB6C1;
    transform: translateY(-0.2rem);
    box-shadow: var(--w9f59-shadow-md);
}

.w9f59-btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: var(--w9f59-text-light);
    border: 0.1rem solid rgba(255, 255, 255, 0.3);
}

.w9f59-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-0.2rem);
}

.w9f59-menu-toggle {
    background: none;
    border: none;
    color: var(--w9f59-text-light);
    font-size: 2.4rem;
    cursor: pointer;
    padding: var(--w9f59-space-xs);
    border-radius: var(--w9f59-radius-sm);
    transition: background 0.3s ease;
}

.w9f59-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile Menu */
.w9f59-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--w9f59-bg-dark);
    z-index: 9999;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.w9f59-mobile-menu.active {
    right: 0;
}

.w9f59-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.w9f59-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.w9f59-menu-header {
    padding: var(--w9f59-space-md);
    background: var(--w9f59-primary);
    color: var(--w9f59-text-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.w9f59-menu-close {
    background: none;
    border: none;
    color: var(--w9f59-text-light);
    font-size: 2.4rem;
    cursor: pointer;
    padding: var(--w9f59-space-xs);
}

.w9f59-menu-nav {
    padding: var(--w9f59-space-md) 0;
}

.w9f59-menu-item {
    display: block;
    padding: var(--w9f59-space-sm) var(--w9f59-space-md);
    color: var(--w9f59-text-light);
    text-decoration: none;
    border-bottom: 0.1rem solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s ease;
}

.w9f59-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Main Content */
.w9f59-main {
    flex: 1;
    padding-top: 6rem; /* Account for fixed header */
    padding-bottom: 8rem; /* Account for fixed bottom nav */
}

.w9f59-section {
    margin-bottom: var(--w9f59-space-lg);
}

.w9f59-container {
    max-width: 430px;
    margin: 0 auto;
    padding: 0 var(--w9f59-space-sm);
}

/* Hero Section */
.w9f59-hero {
    text-align: center;
    padding: var(--w9f59-space-xl) 0;
    background: linear-gradient(135deg, var(--w9f59-secondary) 0%, var(--w9f59-bg) 100%);
}

.w9f59-hero h1 {
    font-size: var(--w9f59-font-xxl);
    color: var(--w9f59-primary);
    margin-bottom: var(--w9f59-space-md);
    line-height: 1.2;
}

.w9f59-hero p {
    font-size: var(--w9f59-font-lg);
    color: var(--w9f59-text-muted);
    margin-bottom: var(--w9f59-space-lg);
}

/* Carousel */
.w9f59-carousel {
    position: relative;
    margin-bottom: var(--w9f59-space-lg);
    border-radius: var(--w9f59-radius-lg);
    overflow: hidden;
    box-shadow: var(--w9f59-shadow-lg);
}

.w9f59-carousel-slide {
    display: none;
    position: relative;
    cursor: pointer;
}

.w9f59-carousel-slide.active {
    display: block;
}

.w9f59-carousel-slide img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.w9f59-carousel-indicators {
    position: absolute;
    bottom: var(--w9f59-space-sm);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--w9f59-space-xs);
}

.w9f59-carousel-indicator {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.w9f59-carousel-indicator.active {
    background: var(--w9f59-highlight);
}

/* Game Grid */
.w9f59-game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--w9f59-space-xs);
    margin-bottom: var(--w9f59-space-lg);
}

.w9f59-game-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.w9f59-game-item:hover {
    transform: scale(1.05);
}

.w9f59-game-icon {
    width: 6rem;
    height: 6rem;
    border-radius: var(--w9f59-radius-md);
    margin-bottom: var(--w9f59-space-xs);
    box-shadow: var(--w9f59-shadow-sm);
    transition: box-shadow 0.3s ease;
}

.w9f59-game-item:hover .w9f59-game-icon {
    box-shadow: var(--w9f59-shadow-md);
}

.w9f59-game-name {
    font-size: var(--w9f59-font-sm);
    color: var(--w9f59-text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Content Cards */
.w9f59-card {
    background: var(--w9f59-text-light);
    border-radius: var(--w9f59-radius-lg);
    padding: var(--w9f59-space-md);
    margin-bottom: var(--w9f59-space-md);
    box-shadow: var(--w9f59-shadow-sm);
    border: 0.1rem solid rgba(0, 0, 0, 0.05);
}

.w9f59-card-title {
    font-size: var(--w9f59-font-lg);
    color: var(--w9f59-primary);
    margin-bottom: var(--w9f59-space-sm);
    font-weight: 700;
}

.w9f59-card-content {
    color: var(--w9f59-text-muted);
    line-height: 1.6;
}

/* Bottom Navigation */
.w9f59-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--w9f59-bg-dark);
    border-top: 0.1rem solid rgba(255, 255, 255, 0.1);
    padding: var(--w9f59-space-xs) 0;
    display: none; /* Hidden by default, shown on mobile */
}

.w9f59-bottom-nav-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 430px;
    margin: 0 auto;
}

.w9f59-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--w9f59-text-muted);
    padding: var(--w9f59-space-xs);
    min-width: 6rem;
    min-height: 6rem;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.w9f59-bottom-nav-item:hover,
.w9f59-bottom-nav-item.active {
    color: var(--w9f59-highlight);
    transform: scale(1.1);
}

.w9f59-bottom-nav-icon {
    font-size: 2.4rem;
    margin-bottom: 0.2rem;
}

.w9f59-bottom-nav-label {
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
}

/* Footer */
.w9f59-footer {
    background: var(--w9f59-bg-dark);
    color: var(--w9f59-text-light);
    padding: var(--w9f59-space-lg) 0;
    margin-top: auto;
}

.w9f59-footer-content {
    text-align: center;
}

.w9f59-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--w9f59-space-md);
    margin-bottom: var(--w9f59-space-md);
}

.w9f59-footer-link {
    color: var(--w9f59-secondary);
    text-decoration: none;
    font-size: var(--w9f59-font-sm);
    transition: color 0.3s ease;
}

.w9f59-footer-link:hover {
    color: var(--w9f59-highlight);
}

.w9f59-partners {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--w9f59-space-md);
    margin: var(--w9f59-space-lg) 0;
    flex-wrap: wrap;
}

.w9f59-partner {
    width: 4rem;
    height: 4rem;
    object-fit: contain;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.w9f59-partner:hover {
    opacity: 1;
}

.w9f59-copyright {
    font-size: var(--w9f59-font-sm);
    color: var(--w9f59-text-muted);
    margin-top: var(--w9f59-space-md);
}

/* Utility Classes */
.w9f59-text-center { text-align: center; }
.w9f59-text-left { text-align: left; }
.w9f59-text-right { text-align: right; }

.w9f59-mb-sm { margin-bottom: var(--w9f59-space-sm); }
.w9f59-mb-md { margin-bottom: var(--w9f59-space-md); }
.w9f59-mb-lg { margin-bottom: var(--w9f59-space-lg); }

.w9f59-mt-sm { margin-top: var(--w9f59-space-sm); }
.w9f59-mt-md { margin-top: var(--w9f59-space-md); }
.w9f59-mt-lg { margin-top: var(--w9f59-space-lg); }

.w9f59-p-sm { padding: var(--w9f59-space-sm); }
.w9f59-p-md { padding: var(--w9f59-space-md); }
.w9f59-p-lg { padding: var(--w9f59-space-lg); }

/* Responsive Design */
@media (max-width: 768px) {
    .w9f59-bottom-nav {
        display: block;
    }

    .w9f59-main {
        padding-bottom: 8rem;
    }

    .w9f59-game-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--w9f59-space-xs);
    }

    .w9f59-game-icon {
        width: 5rem;
        height: 5rem;
    }

    .w9f59-hero h1 {
        font-size: 2.4rem;
    }

    .w9f59-hero p {
        font-size: 1.6rem;
    }
}

@media (min-width: 769px) {
    .w9f59-container {
        max-width: 1200px;
    }

    .w9f59-header-content {
        max-width: 1200px;
    }

    .w9f59-bottom-nav {
        display: none !important;
    }

    .w9f59-main {
        padding-bottom: 0;
    }
}

/* Animations */
@keyframes w9f59-fadeIn {
    from { opacity: 0; transform: translateY(2rem); }
    to { opacity: 1; transform: translateY(0); }
}

.w9f59-fade-in {
    animation: w9f59-fadeIn 0.6s ease-out;
}

@keyframes w9f59-slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.w9f59-slide-in {
    animation: w9f59-slideIn 0.3s ease-out;
}

/* Loading States */
.w9f59-loading {
    position: relative;
    overflow: hidden;
}

.w9f59-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: w9f59-loading 1.5s infinite;
}

@keyframes w9f59-loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --w9f59-text: #000000;
        --w9f59-bg: #ffffff;
        --w9f59-primary: #00695C;
        --w9f59-text-light: #000000;
    }
}

/* Print styles */
@media print {
    .w9f59-header,
    .w9f59-bottom-nav,
    .w9f59-mobile-menu,
    .w9f59-menu-overlay {
        display: none !important;
    }

    .w9f59-main {
        padding-top: 0;
        padding-bottom: 0;
    }
}