/* ===== CSS VARIABLES (LIGHT MODE DEFAULT) ===== */
:root {
    --bg-color: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    --accent-color: #06b6d4;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* ===== DARK MODE VARIABLES ===== */
[data-theme="dark"] {
    --bg-color: #0B0E14;
    --sidebar-bg: #111827;
    --card-bg: #172033;
    --card-border: #1f2937;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.2s, color 0.2s; /* Smooth theme switch */
}

.app-container {
    display: flex;
    width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

/* ===== FLAT CARD STYLES (Performance Optimized) ===== */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, border-color 0.2s;
}

.glass-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: background-color 0.2s, border-color 0.2s;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.logo h2 {
    font-size: 24px;
    letter-spacing: 0.5px;
}

.logo h2 span {
    color: var(--primary-color);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.nav-links li a i {
    font-size: 20px;
}

.nav-links li.active a, .nav-links li a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 0 32px 32px;
    width: calc(100% - 260px);
}

/* TOPBAR */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    position: sticky;
    top: 0;
    background: var(--bg-color);
    z-index: 50;
    transition: background-color 0.2s;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 10px 16px;
    border-radius: 12px;
    width: 350px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-bar i {
    color: var(--text-muted);
    font-size: 20px;
    margin-right: 10px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
    font-family: var(--font-body);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.icon-btn .dot {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

.profile-dropdown {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.profile-details {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.profile-details .name {
    font-weight: 600;
    font-size: 14px;
}

.profile-details .role {
    font-size: 12px;
    color: var(--text-muted);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    padding: 2px;
}

/* WELCOME BANNER */
.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.welcome-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.banner-content h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.banner-content p {
    color: var(--text-muted);
}

.banner-actions {
    position: relative;
    z-index: 2;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 14px;
}

a.btn-primary {
    color: white;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    color: white;
}

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.stat-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card:nth-child(1) .stat-icon { background: rgba(99, 102, 241, 0.15); color: var(--primary-color); }
.stat-card:nth-child(2) .stat-icon { background: rgba(236, 72, 153, 0.15); color: var(--secondary-color); }
.stat-card:nth-child(3) .stat-icon { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-card:nth-child(4) .stat-icon { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.stat-details h3 {
    font-size: 28px;
    margin-bottom: 4px;
}

.stat-details p {
    color: var(--text-muted);
    font-size: 14px;
}

.stat-trend {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
}

.stat-trend.positive { color: var(--success); }
.stat-trend.negative { color: var(--danger); }

/* MIDDLE GRID */
.middle-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

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

.card-header h2 {
    font-size: 18px;
}

.custom-select {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 8px;
    outline: none;
    font-family: var(--font-body);
}

.view-all {
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
}

.view-all:hover {
    text-decoration: underline;
}

.chart-container {
    padding: 24px;
}

.chart-wrapper {
    height: 300px;
    width: 100%;
}

/* COURSES LIST */
.courses-container {
    padding: 24px;
}

.course-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.course-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    transition: background 0.2s;
}

.course-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.course-img-wrapper {
    width: 100px;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
}

.course-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.course-item:hover .course-img-wrapper img {
    transform: scale(1.05);
}

.course-info .category {
    font-size: 11px;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
}

.course-info h4 {
    font-size: 14px;
    margin: 4px 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.course-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.course-meta i.star {
    color: #f59e0b;
}

.course-progress {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--card-border);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* PAGE HEADER */
.page-header {
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 28px;
    color: var(--text-main);
}
.page-header p {
    color: var(--text-muted);
    margin-top: 4px;
}

/* STUDENTS TABLE */
.table-container {
    padding: 24px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-info img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-badge.active { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-badge.inactive { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* SETTINGS */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

.settings-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.settings-menu a {
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
}
.settings-menu a.active {
    background: var(--primary-color);
    color: white;
}

.settings-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-main);
}

.form-group input {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-group textarea {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    resize: vertical;
    min-height: 100px;
}

.full-width { width: 100%; }

/* ===== CREATE COURSE PAGE ===== */
.create-course-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.create-form-section {
    padding: 24px;
}

.create-form-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.section-title {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--text-main);
}

.section-title i {
    font-size: 20px;
    color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Thumbnail Upload */
.thumbnail-upload {
    width: 100%;
    height: 200px;
    border: 2px dashed var(--card-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.thumbnail-upload:hover,
.thumbnail-upload.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.thumbnail-upload img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.upload-placeholder i {
    font-size: 40px;
    color: var(--primary-color);
}

.upload-placeholder p {
    font-weight: 500;
    font-size: 14px;
}

.upload-placeholder span {
    font-size: 12px;
}

/* Publish button */
.full-width-btn {
    width: 100%;
    justify-content: center;
    margin-top: 12px;
    padding: 14px;
    font-size: 15px;
}

/* Lesson Cards */
#lessonsContainer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.lesson-card {
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
}

.lesson-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.06);
    border-bottom: 1px solid var(--card-border);
}

.lesson-number {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-color);
}

.btn-remove-lesson {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-remove-lesson:hover {
    background: rgba(239, 68, 68, 0.1);
}

.lesson-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Video Upload Zone */
.video-upload-zone {
    width: 100%;
    min-height: 100px;
    border: 2px dashed var(--card-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.video-upload-zone:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.video-placeholder i {
    font-size: 32px;
}

.video-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: var(--success);
}

.video-selected i {
    font-size: 24px;
}

.video-filename {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    word-break: break-all;
}

.video-filesize {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

/* Alert Messages */
.alert-box {
    padding: 16px 20px;
    border-radius: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-box i {
    font-size: 22px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .middle-grid { grid-template-columns: 1fr; }
    .create-course-grid { grid-template-columns: 1fr; }
    .course-info h4 { max-width: none; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; width: 100%; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .search-bar { width: 180px; }
    .form-row { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}
