
/* --- CSS Variables & Design System --- */
:root {
    --primary: 262, 83%, 58%;       /* Purple/Violet: #7c3aed */
    --primary-light: 262, 83%, 68%;
    --secondary: 0, 0%, 100%;       /* White */
    --accent: 262, 70%, 15%;        /* Deep Space Violet */
    --accent-glow: 262, 70%, 25%;
    
    --bg-base: 240, 25%, 4%;        /* Midnight black backdrop */
    --bg-surface: 240, 20%, 8%;     /* Surface dark slate card */
    --bg-card: rgba(13, 13, 21, 0.65);
    --border-glass: rgba(255, 255, 255, 0.05);
    --border-active: rgba(124, 58, 237, 0.4);
    
    --text-primary: 210, 40%, 98%;
    --text-muted: 215, 20%, 65%;
    --text-purple: 262, 83%, 68%;
    
    --shadow-purple: 0 0 30px rgba(124, 58, 237, 0.25);
    --shadow-neon: 0 0 20px rgba(124, 58, 237, 0.35), inset 0 0 15px rgba(124, 58, 237, 0.15);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* VIP metal colors */
    --vip-bronze: linear-gradient(135deg, #cd7f32, #a05a2c);
    --vip-silver: linear-gradient(135deg, #c0c0c0, #7a7a7a);
    --vip-gold: linear-gradient(135deg, #ffd700, #b8860b);
    --vip-diamond: linear-gradient(135deg, #b9f2ff, #2b6cb0);
}

/* --- Base Resets --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: #07070c !important; /* Seamless dark backdrop matching body */
    min-height: 100vh;
    height: 100%;
}

body {
    background-color: #07070c;
    color: hsl(var(--text-primary));
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    background-image: 
        radial-gradient(at 0% 0%, hsla(262, 83%, 58%, 0.12) 0px, transparent 40%),
        radial-gradient(at 100% 100%, hsla(262, 83%, 58%, 0.08) 0px, transparent 55%),
        radial-gradient(at 50% 50%, rgba(13, 13, 21, 0.95) 0px, transparent 100%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6, .font-display {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #07070c;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--primary));
}

/* Hide scrollbar helper classes for sliders */
.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.no-scrollbar::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* --- Glassmorphism Framework --- */
.glass-panel {
    background: rgba(18, 18, 28, 0.95); /* Replaced heavy blur with solid fallback for performance */
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.45);
}

.glass-panel-hover {
    transition: var(--transition);
}
.glass-panel-hover:hover {
    border-color: var(--border-active);
    transform: translateY(-4px);
    box-shadow: var(--shadow-purple);
}

/* --- Interactive Elements --- */
.btn-primary {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-light)));
    color: white;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 4px 15px 0 rgba(124, 58, 237, 0.35);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px 0 rgba(124, 58, 237, 0.5), var(--shadow-neon);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* --- Forms & Inputs --- */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-size: 0.85rem;
    color: hsl(var(--text-muted));
    margin-bottom: 8px;
    font-weight: 500;
}
.form-input {
    width: 100%;
    background: rgba(13, 13, 21, 0.7);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px 18px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}
.form-input:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

/* --- Layouts & Containers --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navbar */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    padding: 16px 0;
}
.nav-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    text-transform: uppercase;
    text-decoration: none;
    background: linear-gradient(135deg, #fff 40%, hsl(var(--primary)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo span {
    color: hsl(var(--primary));
    -webkit-text-fill-color: initial;
}
.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
    list-style: none;
}
body:not(.admin-body) .nav-links {
    display: none !important;
}
.nav-link {
    color: hsl(var(--text-muted));
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    color: hsl(var(--primary));
}

/* --- Main Layout Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    padding: 40px 0;
}

/* Side Navigation Drawer for Dashboard */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 12px;
    color: hsl(var(--text-muted));
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}
.sidebar-link:hover, .sidebar-link.active {
    background: rgba(124, 58, 237, 0.1);
    color: hsl(var(--primary));
    border-left: 4px solid hsl(var(--primary));
}

/* --- Wallet System Styles --- */
.wallet-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.wallet-badge {
    padding: 24px;
    text-align: center;
}
.wallet-val {
    font-size: 2rem;
    font-weight: 800;
    margin-top: 8px;
    color: white;
}

/* --- VIP Badges --- */
.vip-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #111;
    display: inline-block;
    vertical-align: middle;
}
.vip-Bronze { background: var(--vip-bronze); color: white; }
.vip-Silver { background: var(--vip-silver); color: #111; }
.vip-Gold { background: var(--vip-gold); color: #111; }
.vip-Diamond { background: var(--vip-diamond); color: #111; text-shadow: 0 1px 2px rgba(255,255,255,0.4); }

/* --- Spin Wheel Game --- */
.wheel-container {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 40px auto;
}
.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 10px solid #130a21;
    position: relative;
    overflow: hidden;
    transition: transform 5s cubic-bezier(0.15, 0.85, 0.35, 1);
    box-shadow: 
        0 0 0 4px #7c3aed, 
        0 0 40px rgba(124, 58, 237, 0.6), 
        inset 0 0 25px rgba(0,0,0,0.9);
}
.wheel-pointer {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 45px;
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 50%, #b45309 100%);
    clip-path: polygon(50% 100%, 15% 0, 85% 0);
    z-index: 10;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
}

/* --- Scratch Card Game --- */
.scratch-card-container {
    position: relative;
    width: 280px;
    height: 180px;
    margin: 20px auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-purple);
    border: 2px solid var(--border-glass);
}
.scratch-content {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}
.scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    cursor: crosshair;
}

/* --- Responsive Layout & Mobile Footer --- */
@media (max-width: 991px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px;
        scrollbar-width: none; /* Firefox */
    }
    .sidebar-nav::-webkit-scrollbar {
        display: none; /* Chrome */
    }
    .sidebar-link {
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none; /* We can use a mobile drawer or clean simplified buttons */
    }
    .nav-flex {
        justify-content: space-between;
    }
    .mobile-header-actions {
        display: flex;
        gap: 8px;
        align-items: center;
    }
    .container {
        padding: 0 10px;
    }
}

/* Mobile-first bottom action bar (MPL Style) */
.mobile-bottom-bar {
    display: none;
}
@media (max-width: 600px) {
    body {
        padding-bottom: 70px; /* Spacer for fixed bottom bar */
    }
    .mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--border-glass);
        z-index: 999;
        justify-content: space-around;
        align-items: center;
    }
    .mobile-bottom-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: hsl(var(--text-muted));
        font-size: 0.75rem;
        font-weight: 500;
    }
    .mobile-bottom-item.active {
        color: hsl(var(--primary));
    }
    .mobile-bottom-item svg {
        width: 20px;
        height: 20px;
        margin-bottom: 2px;
    }
}

/* Admin Dashboard CSS Specific Grid */
.admin-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.kpi-card {
    padding: 20px;
    border-radius: 12px;
}
.kpi-title {
    font-size: 0.85rem;
    color: hsl(var(--text-muted));
    text-transform: uppercase;
}
.kpi-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    margin-top: 6px;
}

/* Table styling for transactions, deposits etc */
.responsive-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
}
.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
    background: rgba(15, 23, 42, 0.3);
}
.table-custom th {
    background: rgba(30, 41, 59, 0.6);
    padding: 14px 18px;
    color: hsl(var(--text-muted));
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}
.table-custom td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-glass);
}
.table-custom tr:last-child td {
    border-bottom: none;
}
.table-custom tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.status-pill {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-pending { background: rgba(234, 179, 8, 0.15); color: #fbbf24; }
.status-approved { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.status-rejected { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.status-completed { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.status-cancelled { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }

/* Grid of Games */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}
.game-card {
    text-align: center;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}
.game-card:hover {
    transform: scale(1.05);
    border-color: hsl(var(--primary));
    box-shadow: var(--shadow-purple);
}
.game-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    transition: var(--transition);
}

/* Game Category Icon Glows (Reference Match) */
.cat-glow-all { background: rgba(124, 58, 237, 0.15); color: #a78bfa; border: 1px solid rgba(124, 58, 237, 0.25); box-shadow: 0 0 15px rgba(124, 58, 237, 0.15); }
.cat-glow-ff { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.25); box-shadow: 0 0 15px rgba(249, 115, 22, 0.15); }
.cat-glow-pubg { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.25); box-shadow: 0 0 15px rgba(59, 130, 246, 0.15); }
.cat-glow-other { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.25); box-shadow: 0 0 15px rgba(34, 197, 94, 0.15); }
.cat-glow-rewards { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.25); box-shadow: 0 0 15px rgba(236, 72, 153, 0.15); }


/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    width: 100%;
    max-width: 480px;
    padding: 30px;
    border-radius: 20px;
    position: relative;
    transform: translateY(20px);
    transition: var(--transition);
}
.modal-overlay.active .modal-content {
    transform: translateY(0);
}
.modal-close {
    position: absolute;
    top: 15px; right: 15px;
    background: none; border: none;
    color: hsl(var(--text-muted));
    cursor: pointer;
    font-size: 1.5rem;
}
.modal-close:hover { color: white; }

/* Grid of Tournaments */
.tournaments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.tournament-card {
    overflow: hidden;
}
.tournament-banner {
    width: 100%;
    height: 160px;
    object-fit: cover;
}
.tournament-details {
    padding: 20px;
}
.tournament-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.85rem;
}
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 16px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: hsl(var(--primary));
    border-radius: 3px;
}
.tournament-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-glass);
    padding-top: 16px;
    margin-top: 10px;
}

/* --- FORCED MOBILE-FIRST VIEWPORT FRAME (APK SIMULATOR MODE) --- */
body:not(.admin-body) {
    width: 100% !important;
    max-width: 450px !important;
    margin: 0 auto !important;
    position: relative !important;
    padding-bottom: 85px !important; /* Space for the floating bottom bar */
    overflow-x: hidden !important; /* Forces all overflowing elements (banners, cards) to clip inside the phone size */
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.85), 0 0 25px rgba(124, 58, 237, 0.2) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    background-attachment: fixed !important;
}

/* Hide bulky desktop components globally */
body:not(.admin-body) aside, 
body:not(.admin-body) footer {
    display: none !important;
}

/* Force layout grids to collapse to fit mobile viewport */
body:not(.admin-body) .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 15px 0 !important;
    gap: 0 !important;
}

/* Auto-constrain sticky header to the mobile viewport */
body:not(.admin-body) .site-header {
    max-width: 450px !important;
    width: 100% !important;
    left: auto !important;
    transform: none !important;
}

/* Fixed Mobile Navigation bottom bar style */
.mobile-bottom-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100% !important;
    max-width: 450px !important;
    height: 65px !important;
    background: rgba(13, 13, 21, 0.96) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    z-index: 999 !important;
    justify-content: space-around !important;
    align-items: center !important;
}

.mobile-bottom-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-decoration: none !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    transition: var(--transition) !important;
    position: relative !important;
}

/* Active tab top line accent highlight matching mockup */
.mobile-bottom-item.active::before {
    content: '' !important;
    position: absolute !important;
    top: -12px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 25px !important;
    height: 3px !important;
    background: #7c3aed !important;
    border-radius: 2px !important;
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.6) !important;
}

/* --- FLOATING SHORTCUTS (MATCHING YAARWIN MOCKUP) --- */
.desktop-shortcuts {
    position: fixed !important;
    top: 60% !important;
    left: calc(50% + 225px + 15px) !important; /* 50% from left plus half the app width plus margin */
    transform: translateY(-50%) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    z-index: 1000 !important;
}

.floating-shortcut-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.3rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    transition: var(--transition);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.floating-shortcut-btn:hover {
    transform: scale(1.1) !important;
}

/* Telegram Button (Blue) */
.shortcut-tg {
    background: linear-gradient(135deg, #0088cc, #24a1de);
    color: white;
    box-shadow: 0 0 15px rgba(36, 161, 222, 0.4);
}

/* Spin Wheel Button (Rainbow/Orange) */
.shortcut-wheel {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.shortcut-wheel .spin-icon {
    animation: spin-slow 6s linear infinite;
}

/* Support Chat Button (Green) */
.shortcut-chat {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

/* Gift Button (Purple) */
.shortcut-gift {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: white;
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
}

@keyframes spin-slow {
    100% {
        transform: rotate(360deg);
    }
}

/* Position floating buttons inside viewport on mobile screen sizes */
@media (max-width: 600px) {
    .desktop-shortcuts {
        top: auto !important;
        bottom: 80px !important;
        left: auto !important;
        right: 15px !important;
        transform: none !important;
        gap: 10px !important;
    }
    .floating-shortcut-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}
