/* assets/css/dashboard.css */

/* =========================================
   Variables & Themes
   ========================================= */
:root {
    --bg-color: #f8fafc;
    --sidebar-bg: #ffffff;
    --sidebar-text: #64748b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;

    /* Default Accent (Student Blue) */
    --accent-color: #2563eb;
    --accent-light: #eff6ff;
    --accent-hover: #1d4ed8;
}

/* Teacher Theme (Green) */
body.theme-teacher {
    --accent-color: #10b981;
    --accent-light: #ecfdf5;
    --accent-hover: #059669;
}

/* Moderator Theme (Amber) */
body.theme-moderator {
    --accent-color: #f59e0b;
    --accent-light: #fffbeb;
    --accent-hover: #d97706;
}

/* Admin Theme (Red/Slate) */
body.theme-admin {
    --accent-color: #ef4444;
    --accent-light: #fef2f2;
    --accent-hover: #dc2626;
}

/* =========================================
   Base Layout
   ========================================= */
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

button {
    font-family: inherit;
}

/* =========================================
   Sidebar
   ========================================= */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 100;
}

.brand {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand span {
    color: var(--accent-color);
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--sidebar-text);
    margin-bottom: 0.25rem;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: var(--accent-light);
    color: var(--accent-color);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-light);
    color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-info div {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =========================================
   Main Content
   ========================================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Header */
.top-header {
    background: #fff;
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
}

.header-left h2 {
    margin: 0;
    font-size: 1.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

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

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
}

.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: red;
    border-radius: 50%;
}

/* Dashboard Grid */
.dashboard-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Cards & Panels */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

/* Quick Actions Grid (Admin/Mod) */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.action-card {
    background: white;
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.action-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.action-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
    color: var(--accent-color);
}

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

.stat-item {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-val {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Progress Bar (Student) */
.progress-container {
    margin-bottom: 2rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.progress-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
    width: 65%;
}

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.status-pill {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
}

.status-success {
    background: #dcfce7;
    color: #15803d;
}

.status-warning {
    background: #fef9c3;
    color: #a16207;
}

.status-danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

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

    .top-header {
        padding: 0 1rem;
    }

    .menu-toggle {
        display: block !important;
        margin-right: 1rem;
    }
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}


/* =========================================
   NEW FEATURES (Chart, Kanban, Feed) - Added in update
   ========================================= */

/* Charts */
.chart-container {
    height: 200px;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding-top: 2rem;
    padding-bottom: 1rem;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    background: var(--accent-color);
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease-out;
    min-height: 2px;
}

.chart-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chart-pie-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

/* Kanban (Teacher Assignments) */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    overflow-x: auto;
}

.kanban-col {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    min-width: 200px;
}

.kanban-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
}

.kanban-item {
    background: white;
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 0.75rem;
    border: 1px solid ease;
    cursor: pointer;
}

.kanban-item:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Feed (Moderator/Announcements) */
.feed-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.feed-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.feed-content h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
}

.feed-content p {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
}

.feed-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}

/* Alert Box (At-Risk) */
.alert-box {
    background: #fff1f2;
    border: 1px solid #fda4af;
    color: #9f1239;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =========================================
   SPA Sections (Added for Dashboard Merging)
   ========================================= */
.dashboard-section {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dashboard-section.active {
    display: block;
    opacity: 1;
}