@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --accent-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    --warm-gradient: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);

    --bg-main: #f0f2f5;
    --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    --sidebar-item-hover: rgba(255, 255, 255, 0.08);
    --sidebar-item-active: rgba(99, 102, 241, 0.15);

    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-soft: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-card: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-premium: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 13.5px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════ */
/* APP LAYOUT                             */
/* ═══════════════════════════════════════ */
.app-container {
    display: grid;
    grid-template-columns: 230px 1fr;
    height: 100vh;
}

/* ═══════════════════════════════════════ */
/* SIDEBAR                                */
/* ═══════════════════════════════════════ */
.sidebar {
    background: var(--sidebar-bg);
    color: #94a3b8;
    padding: 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.sidebar::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(99,102,241,0.3), transparent);
}

.sidebar-header { padding: 0 0.5rem; }

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 2rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.25rem;
}

.logo i {
    font-size: 1.6rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo small {
    font-size: 0.65rem;
    background: var(--primary-gradient);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    -webkit-text-fill-color: white;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 500;
    font-size: 0.85rem;
    position: relative;
}

.nav-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    opacity: 0.6;
    transition: var(--transition-fast);
}

.nav-item:hover {
    background: var(--sidebar-item-hover);
    color: #e2e8f0;
    transform: translateX(3px);
}

.nav-item:hover i { opacity: 1; }

.nav-item.active {
    background: var(--primary-gradient);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.nav-item.active i { opacity: 1; }

/* ═══════════════════════════════════════ */
/* MAIN CONTENT                           */
/* ═══════════════════════════════════════ */
.main-content {
    overflow-y: auto;
    padding: 1.75rem 2rem;
    position: relative;
    scroll-behavior: smooth;
}

/* ═══════════════════════════════════════ */
/* SYNC PROGRESS BAR                      */
/* ═══════════════════════════════════════ */
.sync-progress-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 9999;
    background: transparent;
}

.sync-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-gradient);
    transition: width 0.4s ease;
    border-radius: 0 2px 2px 0;
}

/* ═══════════════════════════════════════ */
/* TYPOGRAPHY & TITLES                    */
/* ═══════════════════════════════════════ */
.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    position: relative;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 40px; height: 3px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ═══════════════════════════════════════ */
/* CARDS                                  */
/* ═══════════════════════════════════════ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    margin-bottom: 1.25rem;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-premium); }

/* ═══════════════════════════════════════ */
/* DASHBOARD STATS                        */
/* ═══════════════════════════════════════ */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
}

.stat-card:nth-child(1)::before { background: var(--primary-gradient); }
.stat-card:nth-child(2)::before { background: var(--accent-gradient); }
.stat-card:nth-child(3)::before { background: var(--warm-gradient); }

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-premium); }

.stat-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.stat-card:nth-child(2) .stat-value {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card:nth-child(3) .stat-value {
    background: var(--warm-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-trend { font-size: 0.75rem; color: var(--text-muted); }
.stat-trend.trend-up { color: #10b981; }

/* ═══════════════════════════════════════ */
/* DASHBOARD GRID                         */
/* ═══════════════════════════════════════ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.chart-container {
    position: relative;
    min-height: 300px;
}

.chart-container canvas { max-height: 280px; }

/* ═══════════════════════════════════════ */
/* GRID CARDS (Curriculum, Courses)       */
/* ═══════════════════════════════════════ */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.course-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.course-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition);
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-premium);
    border-color: var(--primary-light);
}

.course-card:hover::before { opacity: 1; }

.course-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.15), var(--shadow-premium);
}

.course-card.active::before { opacity: 1; }

.course-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.course-card .sks {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ═══════════════════════════════════════ */
/* BUTTONS                                */
/* ═══════════════════════════════════════ */
.btn {
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: var(--primary-light);
    color: var(--primary);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: var(--transition-fast);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-icon:hover { background: #f1f5f9; color: var(--primary); }

/* ═══════════════════════════════════════ */
/* TABLES                                 */
/* ═══════════════════════════════════════ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); }

.complex-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.85rem;
}

.complex-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--text-muted);
    font-weight: 700;
    padding: 0.85rem 1rem;
    border: none;
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.complex-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.complex-table tr { transition: var(--transition-fast); }
.complex-table tbody tr:hover { background: rgba(99, 102, 241, 0.03); }

.alert-text { color: #ef4444; font-weight: 600; font-size: 0.8rem; }

/* ═══════════════════════════════════════ */
/* FORMS                                  */
/* ═══════════════════════════════════════ */
input, select, textarea {
    background: #f8fafc;
    border: 1.5px solid var(--border);
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    transition: var(--transition);
    color: var(--text-main);
}

input:focus, select:focus, textarea:focus {
    background: white;
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input::placeholder, textarea::placeholder { color: var(--text-light); }

/* ═══════════════════════════════════════ */
/* ANIMATIONS                             */
/* ═══════════════════════════════════════ */
.fade-in { animation: fadeIn 0.4s ease-out; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════ */
/* MODALS                                 */
/* ═══════════════════════════════════════ */
.modal {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    background: white;
}

@keyframes modalPop { to { transform: scale(1); } }

/* ═══════════════════════════════════════ */
/* ICON GRADIENT                          */
/* ═══════════════════════════════════════ */
i.icon-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ═══════════════════════════════════════ */
/* FILTER BAR                             */
/* ═══════════════════════════════════════ */
.filter-bar {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    border: 1px solid var(--border);
}

.filter-bar span { font-weight: 700; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.filter-bar select { min-width: 160px; }

/* ═══════════════════════════════════════ */
/* WEIGHT TABLE INPUTS                    */
/* ═══════════════════════════════════════ */
.w-input {
    width: 100%;
    padding: 0.45rem 0.5rem;
    font-size: 0.8rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

.w-input:focus {
    background: white;
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.w-input::placeholder {
    color: var(--text-light);
    font-size: 0.75rem;
}

/* Ensure table cells in weights section hold inputs snugly */
#weights-container td {
    padding: 0.4rem 0.35rem;
    vertical-align: middle;
}

/* Score input in grades table */
.score-input {
    width: 65px;
    padding: 0.4rem 0.3rem;
    text-align: center;
    font-size: 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    transition: var(--transition-fast);
}

.score-input:focus {
    background: white;
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* ═══════════════════════════════════════ */
/* RESPONSIVE                             */
/* ═══════════════════════════════════════ */
@media (max-width: 768px) {
    .app-container { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .dashboard-stats-grid { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
}
