/* ==========================================================
   ESports Platform — Dashboard Design System
   ========================================================== */

.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 72px);
    background: var(--bg-primary);
}

.dashboard-layout-with-sidebar {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    min-height: calc(100vh - 72px);
    background: var(--bg-primary);
}

/* Sidebar */
.dashboard-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
}

.sidebar-user-info h4 {
    font-size: 1rem;
    color: var(--text-primary);
}

.sidebar-user-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 12px 4px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.sidebar-nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sidebar-nav-link.active {
    background: linear-gradient(90deg, rgba(229, 57, 69, 0.15) 0%, rgba(229, 57, 69, 0) 100%);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-primary);
}

.sidebar-nav-link i, .sidebar-nav-link svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.sidebar-nav-link.active i, .sidebar-nav-link.active svg {
    color: var(--accent-primary);
}

/* Dashboard Content Area */
.dashboard-content {
    padding: 32px 36px;
    overflow-y: auto;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.dashboard-header h1 {
    font-size: 2rem;
    letter-spacing: 0.5px;
}

/* Metrics Row */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--border-color);
}

.metric-card.accent-red::after { background: var(--accent-primary); }
.metric-card.accent-gold::after { background: var(--accent-secondary); }
.metric-card.accent-green::after { background: var(--success); }

.metric-icon {
    align-self: flex-end;
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

.metric-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Right Sidebar (Global Leaderboard Preview on Desktop) */
.dashboard-right-sidebar {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 24px 20px;
}

.leaderboard-preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 20px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.rank-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.rank-badge.top-1 { background: #FFD700; color: #000; }
.rank-badge.top-2 { background: #C0C0C0; color: #000; }
.rank-badge.top-3 { background: #CD7F32; color: #fff; }

/* Match Room Box */
.room-box {
    background: var(--bg-elevated);
    border: 1px dashed var(--accent-primary);
    border-radius: var(--radius-sm);
    padding: 18px;
    margin: 16px 0;
}

.room-credential-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.room-credential-value {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    letter-spacing: 1px;
}

/* Mobile & Tablet Adjustments */
@media (max-width: 1200px) {
    .dashboard-layout-with-sidebar {
        grid-template-columns: 240px 1fr;
    }
    .dashboard-right-sidebar {
        grid-column: 2;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

@media (max-width: 900px) {
    .dashboard-layout, .dashboard-layout-with-sidebar {
        grid-template-columns: 1fr;
    }
    .dashboard-sidebar {
        display: none; /* Accessible via mobile drawer */
    }
    .dashboard-content {
        padding: 20px 16px;
    }
}
