/* Base Default Theme (Sleek Dark Mode - Black & White) */
:root {
    --bg-dark: #0a0a0a;
    --bg-panel: rgba(20, 20, 20, 0.7);
    --bg-card: rgba(30, 30, 30, 0.8);
    --primary: #ffffff;
    --primary-hover: #cccccc;
    --accent: #444444;
    --success: #1dd1a1;
    --danger: #ff6b6b;
    --warning: #feca57;
    --text-main: #f5f5f5;
    --text-muted: #888888;
    --border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(20px);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --transition: all 0.3s ease;
}

/* Light Theme (Oq fon) */
body.theme-light {
    --bg-dark: #f0f2f5;
    --bg-panel: rgba(255, 255, 255, 0.7);
    --bg-card: rgba(255, 255, 255, 0.9);
    --primary: #111111;
    --primary-hover: #333333;
    --accent: #888888;
    --success: #10ac84;
    --danger: #ee5253;
    --warning: #f39c12;
    --text-main: #111111;
    --text-muted: #666666;
    --border: rgba(0, 0, 0, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

/* Midnight Theme (Tungi Ko'k) */
body.theme-midnight {
    --bg-dark: #090e17;
    --bg-panel: rgba(15, 23, 42, 0.7);
    --bg-card: rgba(30, 41, 59, 0.8);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* Nature Theme (Tabiat) */
body.theme-nature {
    --bg-dark: #141f17;
    --bg-panel: rgba(24, 38, 29, 0.7);
    --bg-card: rgba(36, 54, 42, 0.8);
    --primary: #22c55e;
    --primary-hover: #16a34a;
    --accent: #eab308;
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;
    --text-main: #ecfdf5;
    --text-muted: #a7f3d0;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: none;
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

body.theme-light {
    background-image: none;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    transition: background 0.5s ease, border-color 0.5s ease;
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: background 0.5s ease, border-color 0.5s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

/* Typography */
h1, h2, h3, h4 { color: var(--text-main); font-weight: 600; }
p { color: var(--text-muted); line-height: 1.6; }

/* Views Management */
.view-container {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.view-container.active-view {
    display: flex;
    opacity: 1;
}

/* Auth View Premium Redesign */
#auth-view {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top right, #1e3a8a, #0f172a 60%, #020617);
    position: relative;
    overflow: hidden;
}

#auth-view::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    border-radius: 50%;
    z-index: 0;
}
#auth-view::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    bottom: -100px;
    right: -100px;
    border-radius: 50%;
    z-index: 0;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 45px 40px;
    text-align: center;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    position: relative;
    z-index: 1;
}

.auth-card .logo {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.auth-card .logo i { 
    color: #38bdf8; 
    font-size: 2.2rem; 
    filter: drop-shadow(0 0 12px rgba(56,189,248,0.6));
}
.auth-card .logo h1 { 
    color: #ffffff; 
    font-size: 2rem; 
    font-weight: 700;
    letter-spacing: -0.5px;
}
.auth-card .subtitle { 
    margin-bottom: 35px; 
    color: #94a3b8; 
    font-size: 0.95rem; 
    font-weight: 400;
}

/* Premium Auth Inputs & Buttons */
.auth-card .input-group label {
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.auth-card .input-group input {
    background: rgba(15, 23, 42, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    border-radius: 14px !important;
    padding: 15px 18px !important;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
}

.auth-card .input-group input:focus {
    border-color: #38bdf8 !important;
    background: rgba(15, 23, 42, 0.8) !important;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15), inset 0 2px 4px rgba(0,0,0,0.2) !important;
    outline: none !important;
}

.auth-card input::placeholder {
    color: #475569 !important;
}

.auth-card .btn-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6) !important;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    font-size: 1.05rem !important;
    padding: 16px !important;
    border-radius: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin-top: 15px !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

.auth-card .btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.5) !important;
    background: linear-gradient(135deg, #1d4ed8, #2563eb) !important;
}

.auth-card .btn-primary:active {
    transform: translateY(1px) !important;
}

.auth-card .demo-credentials {
    background: rgba(0,0,0,0.25) !important;
    border: 1px dashed rgba(255,255,255,0.1) !important;
    color: #94a3b8 !important;
    border-radius: 14px !important;
    margin-top: 30px !important;
    padding: 15px !important;
    font-size: 0.85rem !important;
    text-align: left;
}
.auth-card .demo-credentials p {
    margin-bottom: 5px;
}
.auth-card .demo-credentials p:last-child {
    margin-bottom: 0;
}

/* Forms */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}
.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.input-group input, .input-group select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}
body:not(.theme-light) .input-group input, 
body:not(.theme-light) .input-group select {
    background: rgba(0,0,0,0.2);
}

.input-group input:focus, .input-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2);
}

/* Buttons */
button {
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0, 0.2);
}
.btn-sm { padding: 8px 16px; font-size: 0.9rem; border-radius: 6px; }

/* Soft button styles for better visibility */
.btn-success { background: rgba(29, 209, 161, 0.15); color: var(--success); border: 1px solid rgba(29, 209, 161, 0.4); }
.btn-success:hover { background: rgba(29, 209, 161, 0.3); }
.btn-danger { background: rgba(255, 107, 107, 0.15); color: var(--danger); border: 1px solid rgba(255, 107, 107, 0.4); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.3); }
.btn-warning { background: rgba(254, 202, 87, 0.15); color: var(--warning); border: 1px solid rgba(254, 202, 87, 0.4); }
.btn-warning:hover { background: rgba(254, 202, 87, 0.3); }
.btn-info { background: rgba(0, 210, 211, 0.15); color: var(--accent); border: 1px solid rgba(0, 210, 211, 0.4); }
.btn-info:hover { background: rgba(0, 210, 211, 0.3); }

.btn-text {
    background: transparent;
    color: var(--text-muted);
    padding: 8px;
}
.btn-text:hover { color: var(--primary); }
.btn-action {
    background: rgba(0,0,0,0.05);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
body:not(.theme-light) .btn-action { background: rgba(255,255,255,0.1); }
.btn-action:hover { background: rgba(0,0,0,0.1); }
body:not(.theme-light) .btn-action:hover { background: rgba(255,255,255,0.2); }

.demo-credentials {
    margin-top: 30px;
    font-size: 0.85rem;
    background: rgba(0,0,0,0.05);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}
body:not(.theme-light) .demo-credentials { background: rgba(0,0,0,0.2); }

/* Main App Layout */
#app-view {
    height: 100vh;
    display: flex;
}

.sidebar {
    width: 260px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    border-right: 1px solid var(--border);
    z-index: 10;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    margin-bottom: 30px;
    color: var(--primary);
}
.sidebar .logo h2 { color: var(--text-main); font-size: 1.5rem; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 24px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
}
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}
.user-info h3 { font-size: 1rem; margin-bottom: 2px; }
.badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(0,0,0,0.05);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
body:not(.theme-light) .badge { background: rgba(255,255,255,0.1); }

.nav-links { list-style: none; flex-grow: 1; padding: 0 12px; }
.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: var(--transition);
}
.nav-links li a i { font-size: 1.2rem; width: 24px; text-align: center; }
.nav-links li a:hover, .nav-links li a.active {
    background: rgba(0,0,0, 0.05);
    color: var(--primary);
}
body:not(.theme-light) .nav-links li a:hover,
body:not(.theme-light) .nav-links li a.active {
    background: rgba(255,255,255, 0.05);
}
.nav-links li a.active {
    background: linear-gradient(90deg, rgba(0,0,0,0.05), transparent);
    border-left: 3px solid var(--primary);
}
body:not(.theme-light) .nav-links li a.active {
    background: linear-gradient(90deg, rgba(255,255,255,0.05), transparent);
}

.nav-footer { padding: 0 24px; }

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.topbar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--border);
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Real-time Clock */
.clock-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 1px;
}
body:not(.theme-light) .clock-display {
    background: rgba(255, 255, 255, 0.05);
}
.clock-display i {
    color: var(--primary);
    font-size: 1.1rem;
}

/* Theme Dropdown */
.theme-dropdown {
    background: rgba(0,0,0,0.1);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    appearance: none;
    -webkit-appearance: none;
}
.theme-dropdown option {
    background: var(--bg-card);
    color: var(--text-main);
}
body:not(.theme-light) .theme-dropdown { background: rgba(255,255,255,0.1); }
.theme-dropdown:hover { background: rgba(0,0,0,0.15); }
body:not(.theme-light) .theme-dropdown:hover { background: rgba(255,255,255,0.2); }

.balance-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(254, 202, 87, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(254, 202, 87, 0.3);
}
.balance-display i { color: var(--warning); font-size: 1.2rem; }
.balance-display span { font-weight: 700; color: var(--text-main); font-size: 1.1rem; }

.content-wrapper {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}
.dashboard-charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}
@media (max-width: 1200px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
}
.chart-card {
    padding: 20px;
    height: 350px;
    display: flex;
    flex-direction: column;
}
.chart-card h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--text-muted);
}
.chart-container {
    position: relative;
    flex-grow: 1;
    width: 100%;
    height: 100%;
}

.stat-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: rgba(0,0,0, 0.05);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border: 1px solid var(--border);
}
body:not(.theme-light) .stat-icon { background: rgba(255,255,255, 0.05); }

.stat-card:nth-child(2) .stat-icon { color: var(--accent); }
.stat-card:nth-child(3) .stat-icon { color: var(--success); }
.stat-card:nth-child(4) .stat-icon { color: var(--warning); }
.stat-card:nth-child(5) .stat-icon { color: var(--danger); }
.stat-info h4 { color: var(--text-muted); font-weight: 400; font-size: 0.9rem; margin-bottom: 5px; }
.stat-info p { font-size: 1.8rem; font-weight: 700; color: var(--text-main); }

/* Data Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th { color: var(--text-muted); font-weight: 500; font-size: 0.9rem; text-transform: uppercase; }
tr:hover { background: rgba(0,0,0,0.02); }
body:not(.theme-light) tr:hover { background: rgba(255,255,255,0.02); }
.action-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* Grid Layouts for User Cards & Shop */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Leaderboard Styles */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: transform 0.3s ease, background 0.3s ease;
}
body:not(.theme-light) .leaderboard-item { background: rgba(255,255,255,0.03); }
.leaderboard-item:hover {
    transform: translateX(5px);
    background: rgba(0,0,0,0.08);
}
body:not(.theme-light) .leaderboard-item:hover { background: rgba(255,255,255,0.08); }

.lb-rank {
    font-size: 1.5rem;
    font-weight: bold;
    width: 40px;
    text-align: center;
    color: var(--text-muted);
}
.leaderboard-item.rank-1 .lb-rank { font-size: 2rem; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.leaderboard-item.rank-2 .lb-rank { font-size: 1.8rem; text-shadow: 0 0 10px rgba(192, 192, 192, 0.5); }
.leaderboard-item.rank-3 .lb-rank { font-size: 1.6rem; text-shadow: 0 0 10px rgba(205, 127, 50, 0.5); }

.lb-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}
.leaderboard-item.rank-1 .lb-avatar { background: linear-gradient(135deg, #f1c40f, #e67e22); box-shadow: 0 0 15px rgba(241, 196, 15, 0.4); }
.leaderboard-item.rank-2 .lb-avatar { background: linear-gradient(135deg, #bdc3c7, #95a5a6); box-shadow: 0 0 15px rgba(189, 195, 199, 0.4); }
.leaderboard-item.rank-3 .lb-avatar { background: linear-gradient(135deg, #e67e22, #d35400); box-shadow: 0 0 15px rgba(230, 126, 34, 0.4); }

.lb-details {
    flex-grow: 1;
}
.lb-details h4 { font-size: 1.1rem; margin-bottom: 2px; color: var(--text-main); }
.lb-details p { font-size: 0.85rem; color: var(--text-muted); }

.lb-score {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.lb-score strong {
    font-size: 1.4rem;
    color: var(--warning);
}
.lb-score span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* User Card Styles */
.user-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.group-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.group-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
body.theme-light .group-card:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}
.user-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}
body:not(.theme-light) .user-card:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.4); }

.user-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}
.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}
.user-avatar.student-avatar {
    background: linear-gradient(135deg, var(--success), var(--warning));
}
.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
}
.user-details h3 { font-size: 1.1rem; margin-bottom: 3px; }
.user-details p { font-size: 0.85rem; color: var(--text-muted); }
.user-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}
.user-stat {
    text-align: center;
}
.user-stat span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.user-stat strong {
    font-size: 1.2rem;
    color: var(--warning);
}
.user-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: auto;
}
.user-card-actions .full-width {
    grid-column: 1 / -1;
}

/* Item Card */
.item-card {
    padding: 20px;
    text-align: center;
    position: relative;
    transition: transform 0.3s ease;
}
.item-card:hover { transform: translateY(-5px); }
.item-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 15px;
    background: rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--accent);
    overflow: hidden;
}
body:not(.theme-light) .item-image { background: rgba(0,0,0,0.3); }
.item-image img { width: 100%; height: 100%; object-fit: cover; }
.item-price {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(254, 202, 87, 0.1);
    color: var(--warning);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    margin: 10px 0 15px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
body:not(.theme-light) .modal-overlay { background: rgba(0,0,0,0.6); }

.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
    width: 90%;
    max-width: 500px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.close-modal { background: none; color: var(--text-muted); font-size: 1.2rem; }
.close-modal:hover { color: var(--danger); }
.modal-body { padding: 20px; }

/* Page Header Controls */
.page-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}
.search-bar {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 15px;
    flex-grow: 1;
    max-width: 400px;
}
body:not(.theme-light) .search-bar { background: rgba(0,0,0,0.2); }
.search-bar i { color: var(--text-muted); }
.search-bar input {
    background: none; border: none; padding: 10px; color: var(--text-main); width: 100%; outline: none;
}

/* Toast Notification */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 15px 25px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}
.toast.show { transform: translateX(0); }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast i { font-size: 1.2rem; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: slideUp 0.4s ease; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 4px; }
body:not(.theme-light) ::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
body:not(.theme-light) ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }
body:not(.theme-light) ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: end;
}
.form-grid .full-width {
    grid-column: 1 / -1;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 15;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
    }
    
    /* Sidebar - Hidden off-screen, slides in on toggle */
    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 260px;
        height: 100vh;
        z-index: 20;
        background: var(--bg-card);
        transition: transform 0.3s ease;
        padding-top: 20px;
    }
    
    .sidebar.active {
        transform: translateX(260px);
    }
    
    .sidebar .logo h2 {
        font-size: 1.2rem;
    }
    
    .sidebar .user-profile {
        display: flex;
    }
    
    .nav-links {
        display: block;
        overflow-y: auto;
        white-space: normal;
    }
    
    .nav-links li {
        display: block;
    }
    
    .nav-links li a {
        padding: 12px 16px;
    }
    
    /* Topbar - Compact for mobile */
    .topbar {
        padding: 0 12px;
        height: 56px;
    }

    .topbar h2 {
        font-size: 1.1rem;
    }
    
    /* Hide clock on mobile to save space */
    .clock-display {
        display: none !important;
    }
    
    /* Topbar actions - only show essential items */
    .topbar-actions {
        gap: 8px;
    }
    
    .balance-display {
        padding: 5px 10px;
        font-size: 0.85rem;
    }
    
    .balance-display span {
        font-size: 0.95rem;
    }
    
    /* Content area - tighter padding */
    .content-wrapper {
        padding: 15px;
    }
    
    /* Page controls - stack vertically */
    .page-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .search-bar {
        max-width: 100%;
    }
    
    /* Form grid - single column on mobile */
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    /* Dashboard stat cards - 2 columns on mobile */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.3rem;
    }
    
    .stat-info h4 {
        font-size: 0.75rem;
    }
    
    .stat-info p {
        font-size: 1.3rem;
    }
    
    /* Dashboard charts - single column, shorter */
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .chart-card {
        height: 260px;
        padding: 12px;
    }
    
    /* Card grids - single column on small devices */
    .card-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* User cards - compact */
    .user-card {
        padding: 15px;
        gap: 10px;
    }
    
    .user-card-header {
        gap: 10px;
        padding-bottom: 10px;
    }
    
    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .user-details h3 {
        font-size: 1rem;
    }
    
    .user-card-actions {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .user-card-actions button {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    
    /* Tables - compact for mobile */
    th, td {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    th {
        font-size: 0.75rem;
    }
    
    .action-btns {
        gap: 6px;
    }
    
    .action-btns button {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    /* Item cards - compact for shop */
    .item-card {
        padding: 15px;
    }
    
    .item-image {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    .item-card h3 {
        font-size: 1rem;
    }
    
    /* Leaderboard - compact */
    .leaderboard-item {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .lb-rank {
        font-size: 1.2rem;
        width: 30px;
    }
    
    .lb-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .lb-details h4 {
        font-size: 0.95rem;
    }
    
    .lb-score strong {
        font-size: 1.1rem;
    }
    
    /* Modal - full width on mobile */
    .modal {
        width: 95%;
        max-width: none;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* Auth card - tighter padding on mobile */
    .auth-card {
        padding: 30px 20px;
    }
    
    .auth-card .logo h1 {
        font-size: 1.5rem;
    }
    
    /* Toast - full width on mobile */
    #toast-container {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    
    .toast {
        padding: 12px 15px;
    }
}

/* Extra small devices (below 480px) */
@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .stat-card {
        flex-direction: row;
        text-align: left;
    }
    
    .topbar h2 {
        font-size: 0.95rem;
    }
    
    .content-wrapper {
        padding: 10px;
    }
    
    .chart-card {
        height: 220px;
    }
    
    .user-card-actions {
        grid-template-columns: 1fr;
    }
    
    th, td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
}

