:root {
    --bg-main: #070b09;
    --bg-card: #0f1512;
    --bg-nav: #0b110e;
    --accent: #00ff88;
    --accent-hover: #00e67a;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1a231f;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --vip-gold: #fbbf24;

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0b110e 0%, #070b09 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    left: 0;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-label {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .logo-section {
    padding: 32px 20px;
}

.sidebar.collapsed .nav-menu {
    padding: 0 12px;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 14px 0;
    margin: 0;
}

.sidebar.collapsed .nav-item i {
    margin: 0;
    width: 100%;
}

.logo-section {
    padding: 32px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent) 0%, #00d16d 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-main);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
}

.nav-menu {
    flex: 1;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    scrollbar-width: none;
}

.nav-menu::-webkit-scrollbar {
    display: none;
}

.nav-label {
    padding: 24px 16px 8px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    font-weight: 800;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 600;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 255, 136, 0.1);
}

.nav-item i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    opacity: 0.8;
}

.nav-item.active i {
    opacity: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed+.main-content {
    margin-left: 80px;
}

/* Header */
.header {
    height: 64px; /* Reduced from 72px */
    background: rgba(7, 11, 9, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px; /* Tighter padding */
    position: sticky;
    top: 0;
    z-index: 990;
}

.mobile-menu-toggle {
    display: none;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--accent) !important;
}

.search-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 400px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.balance-display {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.2);
    padding: 6px 12px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--accent);
}

.header-action-btn {
    position: relative;
    cursor: pointer;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: var(--text-muted);
}

.header-action-btn.logout-btn {
    color: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 0.1);
}

.header-action-btn.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--border);
    overflow: hidden;
    transition: border-color 0.2s;
}

.user-profile:hover .avatar {
    border-color: var(--accent);
}

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

/* Bottom Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(11, 17, 14, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    gap: 4px;
}

.mobile-nav-item i {
    font-size: 18px;
}

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

/* Cards & Components */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-main);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Typography Extensions */
h1 { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }

.text-gradient {
    background: linear-gradient(135deg, #fff 0%, #00ff88 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-content {
    padding: 16px 24px; /* Reduced top/bottom from 32px */
}

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* Dashboard Grid */
.dash-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    padding: 0 32px 32px 32px; /* Removed top padding (32px -> 0) */
}

/* Shared Media Queries */
@media (max-width: 1024px) {
    .sidebar {
        left: -260px;
        width: 260px !important;
    }

    .sidebar.mobile-active {
        left: 0;
        box-shadow: 0 0 50px rgba(0,0,0,0.8);
    }

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

    .dash-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .header {
        padding: 0 16px;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .search-bar {
        display: none !important;
    }

    .mobile-nav {
        display: flex;
    }

    .main-content {
        padding-bottom: 80px;
    }

    .page-content {
        padding: 10px 16px; /* Even tighter on mobile */
    }
}

@media (max-width: 768px) {
    /* Base Overrides */
    .card {
        padding: 16px;
        border-radius: 12px;
    }

    h1 { font-size: 24px; }
    h2 { font-size: 20px; }

    .header-actions {
        gap: 8px;
    }

    .header-actions > *:not(.user-profile):not(.balance-display):not(form) {
        display: none !important;
    }

    /* Footer Responsive */
    footer {
        padding: 40px 16px !important;
    }
    .footer-main {
        flex-direction: column !important;
        gap: 40px !important;
    }
    footer .logo-section {
        padding: 0 !important;
        justify-content: center !important;
    }
    footer p {
        text-align: center !important;
        margin: 0 auto !important;
    }
    .footer-links {
        gap: 32px !important;
        width: 100% !important;
        justify-content: space-between !important;
    }
    .footer-bottom {
        flex-direction: column !important;
        gap: 20px !important;
        text-align: center !important;
        padding-bottom: 24px;
    }

    /* Dashboard Portfolio Card */
    .portfolio-card {
        padding: 20px !important;
    }
    .portfolio-card > div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 20px !important;
    }
    .portfolio-card .btn {
        width: 100% !important;
    }
    .portfolio-card [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Promo Flex Fix */
    div[style*="grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* Casino Lobby Fixes */
    .hero-classic {
        height: auto !important;
        min-height: 280px !important;
        padding: 40px 16px !important;
    }
    .hero-classic h1 {
        font-size: 38px !important;
    }
    .hero-classic img {
        right: -10% !important;
        height: 180px !important;
        opacity: 0.3 !important;
    }
    .hero-classic div[style*="linear-gradient"] {
        padding: 0 !important;
        position: relative !important;
        background: transparent !important;
    }
    
    .casino-lobby div[style*="display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px;"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 20px !important;
    }
    
    .casino-lobby div[style*="display: flex; gap: 12px;"] {
        width: calc(100% + 32px);
        margin: 0 -16px;
        padding: 0 16px 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .casino-lobby .card[style*="background: linear-gradient(90deg, rgba(251, 191, 36, 0.08)"] {
        flex-direction: column !important;
        padding: 24px !important;
        gap: 24px !important;
        text-align: center !important;
    }
    
    .casino-lobby .card[style*="background: linear-gradient(90deg, rgba(251, 191, 36, 0.08)"] div[style*="display: flex; gap: 32px;"] {
        flex-direction: column !important;
        gap: 16px !important;
        align-items: center !important;
    }
    .casino-lobby .card[style*="background: linear-gradient(90deg, rgba(251, 191, 36, 0.08)"] .btn {
        width: 100% !important;
    }
}

/* Utilities Helpers */
.flex-col-mobile { flex-direction: column; }
@media (max-width: 768px) {
    .flex-col-mobile { flex-direction: column !important; }
}

/* Table Containers */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 12px;
}
.table-container table {
    min-width: 600px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
}
.sidebar-overlay.active {
    display: block;
}