/* ==========================================
   LuckVerse Casino — Global Styles
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Core palette */
    --bg-darkest: #0a0b0f;
    --bg-dark: #0f1117;
    --bg-card: #151720;
    --bg-card-hover: #1a1d2a;
    --bg-surface: #1e2030;
    --bg-input: #12141e;

    /* Accent — electric indigo / violet */
    --accent: #6c5ce7;
    --accent-hover: #7e6ff0;
    --accent-glow: rgba(108, 92, 231, 0.25);
    --accent-subtle: rgba(108, 92, 231, 0.08);

    /* Secondary accent — emerald for wins */
    --green: #00d68f;
    --green-glow: rgba(0, 214, 143, 0.2);

    /* Loss / danger */
    --red: #ff4757;
    --red-glow: rgba(255, 71, 87, 0.2);

    /* Gold — jackpot / VIP */
    --gold: #ffc048;
    --gold-glow: rgba(255, 192, 72, 0.2);

    /* Text */
    --text-primary: #e8eaf0;
    --text-secondary: #8a8fa8;
    --text-muted: #4e5370;

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-card: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 30px var(--accent-glow);

    /* Sidebar */
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-darkest);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

/* ==========================================
   Layout
   ========================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width 0.3s ease;
}

.sidebar-logo {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-hover), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    padding: 8px 12px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.92rem;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-subtle);
    color: var(--accent);
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top bar */
.topbar {
    height: 60px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-search {
    position: relative;
}

.topbar-search input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    padding: 8px 16px 8px 36px;
    font-size: 0.85rem;
    width: 260px;
    outline: none;
    transition: border-color 0.2s;
}

.topbar-search input:focus {
    border-color: var(--accent);
}

.topbar-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Balance display */
.balance-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 6px 6px 6px 14px;
}

.balance-amount {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.balance-currency {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 2px;
}

.btn-deposit {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-deposit:hover { background: var(--accent-hover); }

/* User avatar */
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    cursor: pointer;
    overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Notification bell */
.notif-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
}

.notif-btn .notif-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 7px; height: 7px;
    background: var(--red);
    border-radius: 50%;
}

/* ==========================================
   Page content area
   ========================================== */
.page-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
}

/* ==========================================
   Hero Banner
   ========================================== */
.hero-banner {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(108, 92, 231, 0.12) 50%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
}

.hero-banner h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
    position: relative;
}

.hero-banner p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
    position: relative;
}

.hero-actions {
    display: flex;
    gap: 10px;
    position: relative;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-glow); }

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }

.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-gold { background: var(--gold); color: #0a0b0f; }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-block { width: 100%; }

/* ==========================================
   Game Cards Grid
   ========================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
}

.section-header .view-all {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 600;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
}

.section-header .view-all:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.game-grid {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding-bottom: 12px;
    margin-bottom: 32px;
    -webkit-overflow-scrolling: touch;
}

.game-grid::-webkit-scrollbar { height: 4px; }
.game-grid::-webkit-scrollbar-track { background: transparent; }
.game-grid::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 2px; }

.game-card {
    min-width: 160px;
    max-width: 160px;
    background: var(--bg-card);
    border: none;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    scroll-snap-align: start;
    flex-shrink: 0;
}

.game-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}

.game-card-img {
    width: 100%;
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    position: relative;
    overflow: hidden;
}

.game-card-img .game-emoji {
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.4));
    transition: transform 0.3s;
    z-index: 1;
}

.game-card:hover .game-emoji {
    transform: scale(1.15) rotate(-3deg);
}

.game-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 12px 12px;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
}

.game-card-info h4 {
    font-size: 0.88rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 6px rgba(0,0,0,0.6);
    margin-bottom: 0;
    line-height: 1.2;
}

.game-card-info .game-meta {
    display: none;
}

.game-card-info .edge-badge {
    display: inline-block;
    background: rgba(0, 214, 143, 0.2);
    color: var(--green);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.6rem;
    margin-top: 4px;
}

.game-card .live-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--red);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    animation: none;
    box-shadow: 0 2px 8px rgba(255,71,87,0.4);
}

.game-card .live-badge.new-badge { background: var(--green); box-shadow: 0 2px 8px rgba(0,214,143,0.4); }
.game-card .live-badge.hot-badge { background: var(--gold); color: #000; box-shadow: 0 2px 8px rgba(255,192,72,0.4); }
.game-card .live-badge.top-badge { background: var(--accent); box-shadow: 0 2px 8px rgba(108,92,231,0.4); }

.game-card-info .edge-badge {
    background: var(--green-glow);
    color: var(--green);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.game-card .live-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: var(--red);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==========================================
   Live Bets Feed
   ========================================== */
.live-bets {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 28px;
}

.live-bets-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.live-bets-header .live-dot {
    width: 8px; height: 8px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.live-bets-table {
    width: 100%;
    border-collapse: collapse;
}

.live-bets-table th {
    text-align: left;
    padding: 10px 18px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.live-bets-table td {
    padding: 10px 18px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border);
}

.live-bets-table tr:hover {
    background: var(--accent-subtle);
}

.bet-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bet-user .mini-avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--bg-surface);
}

.bet-multiplier.win { color: var(--green); font-weight: 600; }
.bet-multiplier.lose { color: var(--red); font-weight: 600; }

.bet-profit.positive { color: var(--green); }
.bet-profit.negative { color: var(--red); }

/* ==========================================
   Stats Row
   ========================================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.3rem;
    font-weight: 700;
}

.stat-card .stat-change {
    font-size: 0.72rem;
    margin-top: 4px;
}

.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ==========================================
   Forms (Auth)
   ========================================== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-darkest);
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px;
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-card .auth-sub {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-group .error-msg {
    color: var(--red);
    font-size: 0.72rem;
    margin-top: 4px;
}

.form-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* ==========================================
   Toast / Alerts
   ========================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-size: 0.85rem;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==========================================
   Responsive
   ========================================== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0; }

    .sidebar-toggle { display: block; }

    .topbar-search input { width: 160px; }

    .game-grid {
        gap: 10px;
    }

    .game-card { min-width: 130px; max-width: 130px; }
    .game-card-img { font-size: 2.8rem; }
    .game-card-info h4 { font-size: 0.78rem; }

    .hero-banner { padding: 24px; }
    .hero-banner h2 { font-size: 1.3rem; }

    .page-content { padding: 16px; }
}

@media (max-width: 480px) {
    .game-grid {
        gap: 8px;
    }

    .game-card { min-width: 115px; max-width: 115px; }
    .game-card-img { font-size: 2.2rem; }
    .game-card-info h4 { font-size: 0.72rem; }

    .balance-display { display: none; }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================
   Scrollbar
   ========================================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-darkest); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ==========================================
   Utility
   ========================================== */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none; }
