/**
 * x777dd Theme Styles
 * Mobile-first responsive design for x777dd.click
 * All classes use w51fd- prefix for namespace isolation
 */

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables - Color Palette */
:root {
    /* Primary Colors */
    --w51fd-primary: #DEB887;
    --w51fd-secondary: #A0522D;
    --w51fd-accent: #BDC3C7;
    --w51fd-dark: #0C0C0C;

    /* Text Colors */
    --w51fd-text-primary: #FFFFFF;
    --w51fd-text-secondary: #BDC3C7;
    --w51fd-text-muted: #888888;

    /* Background Colors */
    --w51fd-bg-primary: #0C0C0C;
    --w51fd-bg-secondary: #1A1A1A;
    --w51fd-bg-card: #222222;

    /* Status Colors */
    --w51fd-success: #28A745;
    --w51fd-warning: #FFC107;
    --w51fd-danger: #DC3545;

    /* Typography */
    --w51fd-font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --w51fd-font-size-base: 1.6rem;
    --w51fd-line-height: 1.5;

    /* Spacing */
    --w51fd-spacing-xs: 0.5rem;
    --w51fd-spacing-sm: 1rem;
    --w51fd-spacing-md: 1.5rem;
    --w51fd-spacing-lg: 2rem;
    --w51fd-spacing-xl: 3rem;

    /* Border Radius */
    --w51fd-radius-sm: 0.4rem;
    --w51fd-radius-md: 0.8rem;
    --w51fd-radius-lg: 1.2rem;

    /* Shadows */
    --w51fd-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --w51fd-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --w51fd-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Base Typography */
html {
    font-size: 62.5%; /* 1rem = 10px */
    scroll-behavior: smooth;
}

body {
    font-family: var(--w51fd-font-primary);
    font-size: var(--w51fd-font-size-base);
    line-height: var(--w51fd-line-height);
    color: var(--w51fd-text-primary);
    background-color: var(--w51fd-bg-primary);
    overflow-x: hidden;
}

/* Utility Classes */
.w51fd-container {
    max-width: 430px;
    margin: 0 auto;
    padding: 0 var(--w51fd-spacing-sm);
}

.w51fd-wrapper {
    min-height: 100vh;
    padding-bottom: 80px; /* Space for mobile nav */
}

.w51fd-text-center { text-align: center; }
.w51fd-text-left { text-align: left; }
.w51fd-text-right { text-align: right; }

.w51fd-mb-xs { margin-bottom: var(--w51fd-spacing-xs); }
.w51fd-mb-sm { margin-bottom: var(--w51fd-spacing-sm); }
.w51fd-mb-md { margin-bottom: var(--w51fd-spacing-md); }
.w51fd-mb-lg { margin-bottom: var(--w51fd-spacing-lg); }
.w51fd-mb-xl { margin-bottom: var(--w51fd-spacing-xl); }

/* Header Navigation */
.w51fd-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, var(--w51fd-dark) 0%, var(--w51fd-bg-secondary) 100%);
    border-bottom: 1px solid var(--w51fd-secondary);
    box-shadow: var(--w51fd-shadow-md);
}

.w51fd-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--w51fd-spacing-sm);
    max-width: 430px;
    margin: 0 auto;
}

.w51fd-logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: var(--w51fd-primary);
    font-weight: bold;
    font-size: 2rem;
}

.w51fd-logo img {
    width: 32px;
    height: 32px;
    border-radius: var(--w51fd-radius-sm);
}

.w51fd-nav-actions {
    display: flex;
    align-items: center;
    gap: var(--w51fd-spacing-sm);
}

.w51fd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.6rem;
    border: none;
    border-radius: var(--w51fd-radius-md);
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 44px; /* Touch-friendly */
}

.w51fd-btn-primary {
    background: linear-gradient(135deg, var(--w51fd-primary) 0%, var(--w51fd-secondary) 100%);
    color: var(--w51fd-dark);
}

.w51fd-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--w51fd-shadow-lg);
}

.w51fd-btn-outline {
    background: transparent;
    color: var(--w51fd-primary);
    border: 2px solid var(--w51fd-primary);
}

.w51fd-btn-outline:hover {
    background: var(--w51fd-primary);
    color: var(--w51fd-dark);
}

.w51fd-menu-toggle {
    background: none;
    border: none;
    color: var(--w51fd-primary);
    font-size: 2.4rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

/* Mobile Menu */
.w51fd-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: var(--w51fd-bg-secondary);
    z-index: 9999;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: var(--w51fd-spacing-lg);
}

.w51fd-mobile-menu.active {
    right: 0;
}

.w51fd-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.w51fd-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.w51fd-menu-list {
    list-style: none;
    margin-top: var(--w51fd-spacing-lg);
}

.w51fd-menu-item {
    margin-bottom: var(--w51fd-spacing-sm);
}

.w51fd-menu-link {
    display: block;
    padding: var(--w51fd-spacing-sm);
    color: var(--w51fd-text-primary);
    text-decoration: none;
    font-size: 1.6rem;
    border-radius: var(--w51fd-radius-sm);
    transition: all 0.3s ease;
}

.w51fd-menu-link:hover,
.w51fd-menu-link.active {
    background: var(--w51fd-primary);
    color: var(--w51fd-dark);
}

/* Main Content */
.w51fd-main {
    padding-top: 70px; /* Account for fixed header */
}

.w51fd-section {
    padding: var(--w51fd-spacing-lg) 0;
}

.w51fd-section-title {
    font-size: 2.4rem;
    font-weight: bold;
    color: var(--w51fd-primary);
    margin-bottom: var(--w51fd-spacing-md);
    text-align: center;
}

.w51fd-card {
    background: var(--w51fd-bg-card);
    border-radius: var(--w51fd-radius-lg);
    padding: var(--w51fd-spacing-md);
    margin-bottom: var(--w51fd-spacing-md);
    box-shadow: var(--w51fd-shadow-sm);
    border: 1px solid rgba(222, 184, 135, 0.1);
}

/* Carousel */
.w51fd-carousel {
    position: relative;
    overflow: hidden;
    border-radius: var(--w51fd-radius-lg);
    margin-bottom: var(--w51fd-spacing-lg);
}

.w51fd-carousel-inner {
    display: flex;
    transition: transform 0.5s ease;
}

.w51fd-carousel-item {
    min-width: 100%;
    position: relative;
}

.w51fd-carousel-item img {
    width: 100%;
    height: auto;
    display: block;
}

.w51fd-carousel-indicators {
    position: absolute;
    bottom: var(--w51fd-spacing-sm);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--w51fd-spacing-xs);
}

.w51fd-carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.w51fd-carousel-indicator.active {
    background: var(--w51fd-primary);
    transform: scale(1.2);
}

/* Game Grid */
.w51fd-game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--w51fd-spacing-sm);
    margin-bottom: var(--w51fd-spacing-lg);
}

.w51fd-game-item {
    background: var(--w51fd-bg-card);
    border-radius: var(--w51fd-radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(222, 184, 135, 0.1);
}

.w51fd-game-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--w51fd-shadow-md);
    border-color: var(--w51fd-primary);
}

.w51fd-game-image {
    width: 100%;
    height: 80px;
    object-fit: cover;
}

.w51fd-game-title {
    font-size: 1rem;
    text-align: center;
    padding: 0.4rem;
    color: var(--w51fd-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer */
.w51fd-footer {
    background: var(--w51fd-bg-secondary);
    padding: var(--w51fd-spacing-lg) 0 var(--w51fd-spacing-xl);
    margin-top: var(--w51fd-spacing-xl);
    border-top: 1px solid var(--w51fd-secondary);
}

.w51fd-partners {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--w51fd-spacing-sm);
    margin-bottom: var(--w51fd-spacing-md);
}

.w51fd-partner-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: grayscale(100%) brightness(150%);
    transition: all 0.3s ease;
}

.w51fd-partner-icon:hover {
    filter: grayscale(0%) brightness(100%);
}

.w51fd-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--w51fd-spacing-md);
    margin-bottom: var(--w51fd-spacing-md);
}

.w51fd-footer-link {
    color: var(--w51fd-text-secondary);
    text-decoration: none;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.w51fd-footer-link:hover {
    color: var(--w51fd-primary);
}

.w51fd-copyright {
    text-align: center;
    color: var(--w51fd-text-muted);
    font-size: 1.2rem;
}

/* Mobile Bottom Navigation */
.w51fd-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: linear-gradient(135deg, var(--w51fd-dark) 0%, var(--w51fd-bg-secondary) 100%);
    border-top: 1px solid var(--w51fd-secondary);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--w51fd-spacing-sm);
}

.w51fd-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    min-height: 60px;
    color: var(--w51fd-text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.w51fd-mobile-nav-item:hover,
.w51fd-mobile-nav-item.active {
    color: var(--w51fd-primary);
    transform: scale(1.1);
}

.w51fd-mobile-nav-icon {
    font-size: 2.4rem;
    margin-bottom: 0.2rem;
}

.w51fd-mobile-nav-label {
    font-size: 1rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .w51fd-wrapper {
        padding-bottom: 80px; /* Space for mobile nav */
    }

    .w51fd-game-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .w51fd-section-title {
        font-size: 2rem;
    }
}

@media (min-width: 769px) {
    .w51fd-mobile-nav {
        display: none;
    }

    .w51fd-wrapper {
        padding-bottom: 0;
    }
}

/* Animations */
@keyframes w51fd-fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.w51fd-fade-in {
    animation: w51fd-fadeIn 0.6s ease forwards;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
.w51fd-btn:focus,
.w51fd-menu-link:focus,
.w51fd-footer-link:focus,
.w51fd-mobile-nav-item:focus {
    outline: 2px solid var(--w51fd-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --w51fd-bg-primary: #000000;
        --w51fd-text-primary: #FFFFFF;
        --w51fd-primary: #FFFFFF;
        --w51fd-secondary: #FFFFFF;
    }
}