/* ============================================================
   BlackBox Learning - Student Dashboard
   Dark theme · Glassmorphism · Peach accent · Retractable Sidebar
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
    --peach: #ff6e3b;
    --peach-glow: rgba(255, 110, 59, 0.35);
    --peach-soft: rgba(255, 110, 59, 0.12);
    --grey: #414042;
    --bg-dark: #0a0a0c;
    --bg-surface: #111114;
    --bg-card: rgba(22, 22, 28, 0.65);
    --border-glass: rgba(255, 255, 255, 0.06);
    --text-primary: #f0f0f2;
    --text-secondary: rgba(240, 240, 242, 0.55);
    --text-muted: rgba(240, 240, 242, 0.3);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0px;
    --header-height: 64px;
}

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

html,
body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg-dark);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

/* ---------- Sidebar ---------- */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-glass);
    transform: translateX(0);
    transition: transform var(--transition), box-shadow var(--transition);
    will-change: transform;
    overflow: hidden;
}

body.sidebar-collapsed .admin-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    box-shadow: none;
}

/* -- Sidebar Brand -- */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.2rem 0.25rem 0rem;
    border-bottom: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.sidebar-brand img {
    height: 60px;
    width: auto;
    object-fit: cover;
}

/* -- Navigation -- */
.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-section-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 1rem 0.75rem 0.4rem;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--peach);
    color: #ffffff;
    border-radius: var(--radius-md);
    transform: translateY(-2px) scale(1.02);
    animation: activeItemPuff 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nav-item.active .nav-icon {
    color: #ffffff;
}

@keyframes activeItemPuff {
    0% {
        transform: translateY(10px) scale(0.95);
        opacity: 0.5;
    }

    100% {
        transform: translateY(-2px) scale(1.02);
        opacity: 1;
    }
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition);
}

.nav-item:hover .nav-icon {
    color: var(--text-secondary);
}

.nav-badge {
    margin-left: auto;
    padding: 0.15rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 100px;
    background: var(--peach);
    color: #fff;
    line-height: 1.3;
}

/* -- Sidebar Footer -- */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.sidebar-footer .nav-item {
    color: var(--text-secondary);
}

.sidebar-footer .nav-item:hover {
    color: var(--peach);
    background: var(--peach-soft);
}

.sidebar-footer .nav-icon {
    color: var(--text-muted);
}

.sidebar-footer .nav-item:hover .nav-icon {
    color: var(--peach);
}

/* -- Topbar Profile Dropdown -- */
.topbar-user {
    position: relative;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.topbar-user:hover {
    background: rgba(255, 255, 255, 0.04);
}

.topbar-chevron {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform var(--transition), color var(--transition);
    flex-shrink: 0;
}

.topbar-user.dropdown-open .topbar-chevron {
    transform: rotate(180deg);
    color: var(--peach);
}

/* -- Dropdown Panel -- */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: rgba(22, 22, 28, 0.95);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 20px 50px -10px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 200;
    overflow: hidden;
}

.topbar-user.dropdown-open .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* -- Dropdown Header -- */
.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.dropdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--peach), #e85a2a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.dropdown-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dropdown-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-email {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -- Dropdown Divider -- */
.profile-dropdown-divider {
    height: 1px;
    background: var(--border-glass);
    margin: 0;
}

/* -- Dropdown Items -- */
.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.profile-dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition);
}

.profile-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.profile-dropdown-item:hover svg {
    color: var(--text-secondary);
}

/* -- Logout Item -- */
.dropdown-logout {
    color: rgba(255, 107, 107, 0.75);
}

.dropdown-logout svg {
    color: rgba(255, 107, 107, 0.5);
}

.dropdown-logout:hover {
    background: rgba(255, 107, 107, 0.08);
    color: #ff6b6b;
}

.dropdown-logout:hover svg {
    color: #ff6b6b;
}

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

body.sidebar-collapsed .admin-main {
    margin-left: 0;
}

/* -- Top Bar -- */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: var(--header-height);
    padding: 0 1.5rem;
    background: rgba(10, 10, 12, 0.85);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--peach-soft);
    border-color: rgba(255, 110, 59, 0.2);
    color: var(--peach);
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition);
}

body.sidebar-collapsed .sidebar-toggle svg {
    transform: scaleX(-1);
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.topbar-spacer {
    flex: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--peach), #e85a2a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* -- Page Content -- */
.admin-content {
    flex: 1;
    padding: 2rem 1.5rem;
}

/* -- Welcome Card -- */
.welcome-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2rem 2.5rem;
    backdrop-filter: blur(30px) saturate(120%);
    -webkit-backdrop-filter: blur(30px) saturate(120%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 16px 40px -12px rgba(0, 0, 0, 0.4);
    animation: fadeUp 0.6s ease forwards;
}

.welcome-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.welcome-card h2 span {
    color: var(--peach);
}

.welcome-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* -- Stats Grid -- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: border-color var(--transition), box-shadow var(--transition);
    animation: fadeUp 0.6s ease forwards;
    animation-fill-mode: both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card:hover {
    border-color: rgba(255, 110, 59, 0.15);
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.stat-value .stat-accent {
    color: var(--peach);
}

/* ---------- Mobile Overlay ---------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity var(--transition);
    cursor: pointer;
}

.sidebar-overlay.visible {
    opacity: 1;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .admin-sidebar {
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.4);
    }

    body.sidebar-collapsed .admin-sidebar {
        box-shadow: none;
    }

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

    body:not(.sidebar-collapsed) .sidebar-overlay {
        display: block;
    }

    .welcome-card {
        padding: 1.5rem;
    }

    .admin-content {
        padding: 1.25rem 1rem;
    }

    .topbar-title {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .admin-topbar {
        padding: 0 1rem;
    }

    .topbar-user span {
        display: none;
    }
}

/* =========================================
   Dashboard – Dynamic Content
   ========================================= */

/* ── Welcome ── */
.db-welcome { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.db-welcome-left h2 { margin-bottom: 0.3rem; }
.db-welcome-left p { font-size: 0.82rem; color: var(--text-secondary); }
.db-welcome-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; flex-shrink: 0; }
.db-badge { padding: 0.25rem 0.75rem; border-radius: 100px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; }
.db-badge-green  { background: rgba(34,197,94,0.15);  color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.db-badge-orange { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.db-badge-red    { background: rgba(239,68,68,0.15);  color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.db-badge-blue   { background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); }

/* ── Quick stats ── */
.db-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}
.db-stat-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: border-color var(--transition), box-shadow var(--transition);
    animation: fadeUp 0.6s ease both;
}
.db-stat-card:hover { border-color: rgba(255,110,59,0.18); box-shadow: 0 8px 24px -8px rgba(0,0,0,0.3); }
.db-stat-card-warn { border-color: rgba(239,68,68,0.2) !important; }
.db-stat-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.db-stat-icon svg { width: 20px; height: 20px; }
.db-icon-purple { background: rgba(99,102,241,0.12); color: #818cf8; }
.db-icon-green  { background: rgba(34,197,94,0.12);  color: #22c55e; }
.db-icon-peach  { background: rgba(255,110,59,0.12); color: var(--peach); }
.db-icon-red    { background: rgba(239,68,68,0.12);  color: #ef4444; }
.db-icon-blue   { background: rgba(14,165,233,0.12); color: #38bdf8; }
.db-stat-body { flex: 1; min-width: 0; }
.db-stat-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); line-height: 1; }
.db-stat-unit  { font-size: 1rem; font-weight: 500; color: var(--text-secondary); }
.db-stat-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-top: 0.3rem; }
.db-stat-sub   { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ── Generic card ── */
.db-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: fadeUp 0.6s ease both;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.db-card-full { margin-top: 1.25rem; }
.db-card-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.db-card-title  { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.db-card-icon   { width: 16px; height: 16px; color: var(--peach); flex-shrink: 0; }
.db-card-link   { font-size: 0.75rem; color: var(--peach); text-decoration: none; font-weight: 500; white-space: nowrap; transition: opacity var(--transition); }
.db-card-link:hover { opacity: 0.75; }
.db-card-tip    { font-size: 0.75rem; color: var(--text-muted); background: rgba(255,255,255,0.02); border: 1px solid var(--border-glass); border-radius: var(--radius-sm); padding: 0.55rem 0.75rem; }

/* ── Charts row (3 equal cols) ── */
.db-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

/* ── Chart wrappers ── */
.db-chart-wrap { position: relative; width: 100%; height: 150px; }
.db-chart-task  { height: 110px; }
.db-chart-donut-wrap { display: flex; align-items: center; justify-content: center; }
.db-chart-donut-wrap canvas { max-width: 150px; max-height: 150px; }
.db-donut-center { position: absolute; text-align: center; pointer-events: none; }
.db-donut-big   { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.db-donut-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ── Legend ── */
.db-legend { display: flex; gap: 1rem; flex-wrap: wrap; }
.db-legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--text-secondary); }
.db-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.db-legend-item strong { color: var(--text-primary); font-weight: 600; margin-left: 0.15rem; }

/* ── Overdue list ── */
.db-overdue-list { display: flex; flex-direction: column; gap: 0.4rem; }
.db-overdue-heading { font-size: 0.67rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.1rem; }
.db-overdue-item {
    display: flex; align-items: flex-start; gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.12);
    border-radius: var(--radius-sm);
}
.db-overdue-dot { width: 6px; height: 6px; border-radius: 50%; background: #ef4444; flex-shrink: 0; margin-top: 0.35rem; }
.db-overdue-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.db-overdue-name { font-size: 0.78rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-overdue-meta { font-size: 0.68rem; color: var(--text-muted); }

/* ── Upcoming classes ── */
.db-upcoming-list { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.db-upcoming-item {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition);
}
.db-upcoming-item:hover { border-color: rgba(255,110,59,0.2); }
.db-upcoming-date-block {
    display: flex; flex-direction: column; align-items: center;
    min-width: 36px; text-align: center;
    background: rgba(255,110,59,0.1);
    border: 1px solid rgba(255,110,59,0.2);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.4rem;
}
.db-upcoming-day { font-size: 1rem; font-weight: 700; color: var(--peach); line-height: 1; }
.db-upcoming-mon { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; color: rgba(255,110,59,0.7); letter-spacing: 0.06em; margin-top: 1px; }
.db-upcoming-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.db-upcoming-title  { font-size: 0.8rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-upcoming-course { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-upcoming-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.5rem; flex: 1; padding: 1rem 0;
    color: var(--text-muted); font-size: 0.8rem; text-align: center;
}
.db-upcoming-empty svg { width: 32px; height: 32px; opacity: 0.3; }

/* ── Course progress (full-width card) ── */
.db-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem 2rem;
}
.db-progress-row { display: flex; flex-direction: column; gap: 0.35rem; }
.db-progress-info { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.db-progress-name { font-size: 0.82rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80%; }
.db-progress-pct  { font-size: 0.75rem; font-weight: 600; color: var(--peach); flex-shrink: 0; }
.db-progress-bar-bg { width: 100%; height: 6px; background: rgba(255,255,255,0.07); border-radius: 100px; overflow: hidden; }
.db-progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--peach), #e85a2a); border-radius: 100px; transition: width 1s cubic-bezier(0.4,0,0.2,1); }
.db-progress-count { font-size: 0.68rem; color: var(--text-muted); }

/* ── Empty state ── */
.db-empty-state { font-size: 0.82rem; color: var(--text-muted); text-align: center; padding: 1.5rem 0; }
.db-empty-link  { color: var(--peach); text-decoration: none; margin-left: 0.4rem; font-weight: 500; }
.db-empty-link:hover { text-decoration: underline; }

/* ── Section heading ── */
.db-section-heading {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-muted); margin-top: 2rem; margin-bottom: 0.75rem;
}
.db-section-heading svg { width: 14px; height: 14px; color: var(--peach); }

/* ── Typing grid ── */
.db-typing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.db-typing-body {
    display: flex;
    align-items: stretch;
    gap: 1.25rem;
}
.db-typing-body .db-chart-wrap {
    flex: 0 0 140px;
    height: 140px;
}
.db-typing-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
}
.db-typing-stat-row { display: flex; gap: 1rem; }
.db-typing-stat { display: flex; flex-direction: column; gap: 0.15rem; }
.db-typing-stat-val { font-size: 1.3rem; font-weight: 700; color: var(--peach); letter-spacing: -0.02em; line-height: 1; }
.db-typing-stat-lbl { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.db-roadmap-bar-bg  { width: 100%; height: 5px; background: rgba(255,255,255,0.07); border-radius: 100px; overflow: hidden; }
.db-roadmap-bar-fill { height: 100%; background: linear-gradient(90deg, var(--peach), #e85a2a); border-radius: 100px; transition: width 1.2s cubic-bezier(0.4,0,0.2,1); }
.db-roadmap-label { font-size: 0.7rem; color: var(--text-muted); }
.db-typing-cta {
    font-size: 0.75rem; color: var(--peach); text-decoration: none; font-weight: 500;
    display: inline-flex; align-items: center; gap: 0.3rem; margin-top: auto;
}
.db-typing-cta:hover { text-decoration: underline; }

/* Practice breakdown */
.db-practice-breakdown { display: flex; flex-direction: column; gap: 0.6rem; }
.db-prac-item { display: flex; align-items: center; gap: 0.6rem; }
.db-prac-dot  { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex-shrink: 0; }
.db-prac-info { display: flex; align-items: center; gap: 0.5rem; min-width: 90px; }
.db-prac-lbl  { font-size: 0.75rem; color: var(--text-secondary); min-width: 48px; }
.db-prac-val  { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); min-width: 28px; text-align: right; }
.db-prac-bar-wrap { flex: 1; height: 5px; background: rgba(255,255,255,0.07); border-radius: 100px; overflow: hidden; }
.db-prac-bar  { height: 100%; width: var(--prac-pct, 0%); background: var(--prac-clr, #22c55e); border-radius: 100px; transition: width 1s cubic-bezier(0.4,0,0.2,1); }
.db-typing-total {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.78rem; color: var(--text-muted);
    padding-top: 0.5rem; border-top: 1px solid var(--border-glass);
}
.db-typing-total strong { color: var(--text-primary); font-weight: 600; }

/* ── CareerOS grid ── */
.db-careeros-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }

.db-co-stats-row {
    display: flex; border: 1px solid var(--border-glass); border-radius: var(--radius-sm); overflow: hidden;
}
.db-co-stat { flex: 1; padding: 0.75rem 0.85rem; text-align: center; border-right: 1px solid var(--border-glass); }
.db-co-stat:last-child { border-right: none; }
.db-co-stat-wide { flex: 2; }
.db-co-stat-val  { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-co-stat-name { font-size: 0.82rem !important; }
.db-co-mode      { font-size: 0.7rem !important; letter-spacing: 0.05em; color: var(--peach) !important; }
.db-co-stat-lbl  { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.15rem; }

.db-co-checklist { display: flex; flex-direction: column; gap: 0.4rem; }
.db-co-check {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.77rem; color: var(--text-muted);
}
.db-co-check svg { width: 14px; height: 14px; flex-shrink: 0; color: rgba(255,255,255,0.15); }
.db-co-check-done { color: var(--text-secondary); }
.db-co-check-done svg { color: #22c55e; }

.db-co-url {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.77rem;
    padding: 0.45rem 0.7rem;
    background: rgba(255,110,59,0.06); border: 1px solid rgba(255,110,59,0.15);
    border-radius: var(--radius-sm);
}
.db-co-url svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--peach); }
.db-co-url-link { color: var(--peach); text-decoration: none; font-weight: 500; }
.db-co-url-link:hover { text-decoration: underline; }

.db-co-cta {
    display: block; margin-top: auto;
    font-size: 0.77rem; color: var(--peach); text-decoration: none; font-weight: 500;
    padding: 0.5rem 0; border-top: 1px solid var(--border-glass);
}
.db-co-cta:hover { text-decoration: underline; }

.db-co-meta { font-size: 0.7rem; color: var(--text-muted); }

.db-co-start {
    display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
    text-align: center; flex: 1; justify-content: center; padding: 0.5rem 0;
}
.db-co-start svg { width: 36px; height: 36px; color: var(--text-muted); opacity: 0.4; }
.db-co-start p   { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.db-co-start .db-co-cta { border-top: none; padding: 0; }

/* Online presence card */
.db-co-presence-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.db-co-pitem {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.025); border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition);
}
.db-co-pitem:hover { border-color: rgba(255,110,59,0.2); }
.db-co-picon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700; flex-shrink: 0;
}
.db-co-picon-li { background: rgba(10,102,194,0.15); color: #0a66c2; border: 1px solid rgba(10,102,194,0.2); }
.db-co-picon-gh { background: rgba(255,255,255,0.06); color: var(--text-secondary); border: 1px solid var(--border-glass); }
.db-co-picon-gh svg { width: 16px; height: 16px; }
.db-co-pinfo { display: flex; flex-direction: column; gap: 0.1rem; flex: 1; min-width: 0; }
.db-co-ptitle { font-size: 0.8rem; font-weight: 500; color: var(--text-primary); }
.db-co-psub   { font-size: 0.68rem; color: var(--text-muted); }
.db-co-parrow { font-size: 0.8rem; color: var(--text-muted); text-decoration: none; transition: color var(--transition); flex-shrink: 0; }
.db-co-parrow:hover { color: var(--peach); }

/* ── Responsive ── */
@media (max-width: 1200px) {
    .db-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
    .db-stats-grid   { grid-template-columns: repeat(3, 1fr); }
    .db-charts-row   { grid-template-columns: 1fr 1fr; }
    .db-careeros-grid { grid-template-columns: 1fr 1fr; }
    .db-progress-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .db-stats-grid    { grid-template-columns: repeat(2, 1fr); }
    .db-charts-row    { grid-template-columns: 1fr; }
    .db-typing-grid   { grid-template-columns: 1fr; }
    .db-typing-body   { flex-direction: column; }
    .db-careeros-grid { grid-template-columns: 1fr; }
    .db-welcome       { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
    .db-stats-grid { grid-template-columns: 1fr 1fr; }
}

/* =========================================
   Course Detail Specific Styles
   ========================================= */
.course-detail-header {
    display: flex;
    gap: 2rem;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    align-items: flex-start;
}

.cd-header-content {
    flex: 1;
    /* width constraint to prevent pushing image out */
    min-width: 0; 
}

.cd-category-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    background: rgba(142, 115, 255, 0.1);
    color: var(--primary);
    border: 1px solid rgba(142, 115, 255, 0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.cd-title {
    font-size: 1.6rem;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.cd-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.cd-meta-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.cd-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cd-meta-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.cd-price-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.cd-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--peach);
}

.btn-buy-course {
    padding: 0.6rem 1.5rem;
    background: var(--peach);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: not-allowed;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: opacity 0.2s;
}

.cd-header-image {
    width: 380px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    aspect-ratio: 16/9;
    background: var(--bg-deep);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Hero dynamic thumbnail (course detail page) ── */
.cd-dyn-fill {
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.cd-dyn-fill .course-dyn {
    padding: 1rem 1.25rem 1rem;
}

.cd-dyn-fill .course-dyn-icon {
    width: 56px;
    height: 56px;
    top: 20px;
    right: 20px;
    opacity: 0.32;
}

.cd-dyn-fill .course-dyn-title {
    font-size: 1.05rem;
    font-weight: 700;
    max-width: calc(100% - 60px);
    margin-bottom: 0.5rem;
    -webkit-line-clamp: 3;
}

.cd-dyn-fill .course-dyn-chip {
    font-size: 0.65rem;
    padding: 0.18rem 0.55rem;
}

.cd-dyn-fill .course-dyn-chip svg {
    width: 10px;
    height: 10px;
}

/* Category gradient backgrounds for hero fill */
.cd-dyn-fill {
    background: linear-gradient(135deg, rgba(255, 110, 59, 0.15), rgba(255, 110, 59, 0.03));
}

.cd-dyn-fill.course-thumb-digital-marketing,
.cd-dyn-fill.course-thumb-marketing           { background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.04)); }
.cd-dyn-fill.course-thumb-web-development     { background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.04)); }
.cd-dyn-fill.course-thumb-gen-ai,
.cd-dyn-fill.course-thumb-ai                  { background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(236, 72, 153, 0.04)); }
.cd-dyn-fill.course-thumb-business,
.cd-dyn-fill.course-thumb-entrepreneurship    { background: linear-gradient(135deg, rgba(255, 165, 0, 0.2), rgba(255, 165, 0, 0.04)); }
.cd-dyn-fill.course-thumb-finance-accounting,
.cd-dyn-fill.course-thumb-finance             { background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.04)); }
.cd-dyn-fill.course-thumb-it-software,
.cd-dyn-fill.course-thumb-software,
.cd-dyn-fill.course-thumb-programming         { background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.04)); }
.cd-dyn-fill.course-thumb-office-productivity { background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.04)); }
.cd-dyn-fill.course-thumb-personal-development{ background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(236, 72, 153, 0.04)); }
.cd-dyn-fill.course-thumb-design,
.cd-dyn-fill.course-thumb-ui-ux               { background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(244, 63, 94, 0.04)); }
.cd-dyn-fill.course-thumb-photography-video,
.cd-dyn-fill.course-thumb-photography         { background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0.04)); }
.cd-dyn-fill.course-thumb-teaching-academics,
.cd-dyn-fill.course-thumb-education           { background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.04)); }
.cd-dyn-fill.course-thumb-data-science,
.cd-dyn-fill.course-thumb-data                { background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.04)); }

/* Icon color for hero fill (inherits .course-dyn color rules from team_courses.css) */
.cd-dyn-fill.course-thumb-digital-marketing .course-dyn,
.cd-dyn-fill.course-thumb-marketing .course-dyn            { color: #fbbf24; }
.cd-dyn-fill.course-thumb-web-development .course-dyn      { color: #3b82f6; }
.cd-dyn-fill.course-thumb-gen-ai .course-dyn,
.cd-dyn-fill.course-thumb-ai .course-dyn                   { color: #ec4899; }
.cd-dyn-fill.course-thumb-business .course-dyn             { color: #f97316; }
.cd-dyn-fill.course-thumb-finance-accounting .course-dyn,
.cd-dyn-fill.course-thumb-finance .course-dyn              { color: #22c55e; }
.cd-dyn-fill.course-thumb-it-software .course-dyn,
.cd-dyn-fill.course-thumb-software .course-dyn,
.cd-dyn-fill.course-thumb-programming .course-dyn          { color: #3b82f6; }
.cd-dyn-fill.course-thumb-office-productivity .course-dyn  { color: #a855f7; }
.cd-dyn-fill.course-thumb-personal-development .course-dyn { color: #ec4899; }
.cd-dyn-fill.course-thumb-design .course-dyn,
.cd-dyn-fill.course-thumb-ui-ux .course-dyn                { color: #f43f5e; }
.cd-dyn-fill.course-thumb-photography-video .course-dyn,
.cd-dyn-fill.course-thumb-photography .course-dyn          { color: #0ea5e9; }
.cd-dyn-fill.course-thumb-teaching-academics .course-dyn,
.cd-dyn-fill.course-thumb-education .course-dyn            { color: #6366f1; }
.cd-dyn-fill.course-thumb-data-science .course-dyn,
.cd-dyn-fill.course-thumb-data .course-dyn                 { color: #06b6d4; }

.cd-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.cd-main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.cd-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

.cd-section h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cd-section-text {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.85rem;
    white-space: pre-line;
}

.cd-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cd-sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.cd-sidebar-card h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.85rem;
}

.cd-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.cd-tag {
    background: var(--bg-hover);
    color: var(--text-secondary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
}

/* Syllabus Styles */
.cd-syllabus-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.cd-syllabus-section-title {
    margin-top: 1.25rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.cd-syllabus-subsection-title {
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    padding-left: 0.75rem;
}

.cd-syllabus-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s, background 0.2s;
}

.cd-syllabus-item:hover {
    border-color: rgba(142, 115, 255, 0.3);
    background: var(--bg-hover);
}

.cd-item-icon {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-item-icon svg {
    width: 16px;
    height: 16px;
}

.cd-item-details {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cd-item-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.cd-item-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.cd-indent-1 { margin-left: 1rem; }
.cd-indent-2 { margin-left: 2.5rem; }

/* Responsive Layout */
@media (max-width: 1024px) {
    .course-detail-header {
        flex-direction: column;
    }
    .cd-header-image {
        width: 100%;
        max-width: 600px;
        order: -1; /* Move image to top */
    }
    .cd-body {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   All Courses – Category Tabs
   ========================================= */
.ac-category-tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    animation: fadeUp 0.4s ease forwards;
}

.ac-cat-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.14s;
    white-space: nowrap;
    user-select: none;
}

.ac-cat-tab:hover {
    background: rgba(255, 110, 59, 0.08);
    border-color: rgba(255, 110, 59, 0.3);
    color: var(--peach);
    transform: translateY(-1px);
}

.ac-cat-tab.active {
    background: rgba(255, 110, 59, 0.15);
    border-color: rgba(255, 110, 59, 0.5);
    color: var(--peach);
    box-shadow: 0 0 12px rgba(255, 110, 59, 0.18);
}

/* =========================================
   All Courses Badges and Layout
   ========================================= */
.ac-pagination-container {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: relative;
}

.ac-course-count {
    position: absolute;
    left: 0;
}

.ac-course-count-badge {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ac-course-count-badge b {
    color: var(--text-primary);
}

.ac-pagination-controls {
    display: flex;
    gap: 0.5rem;
    margin: 0 auto;
}

.courses-empty {
    margin-top: 2rem;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* -- Right Sidebar Tooltip -- */
.right-sidebar-tooltip-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.right-sidebar-tooltip {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: max-content;
    background: rgba(22, 22, 28, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--peach);
    color: var(--text-primary);
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    z-index: 1000;
}

.right-sidebar-tooltip.show-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.right-sidebar-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    right: 14px;
    width: 8px;
    height: 8px;
    background: rgba(22, 22, 28, 0.95);
    border-top: 1px solid var(--peach);
    border-left: 1px solid var(--peach);
    transform: rotate(45deg);
}
