/* EduFlow LMS - Theme: #7141b1 / #3f9ec5 */
:root {
    --primary: #7141b1;
    --primary-rgb: 113,65,177;
    --primary-dark: #5a3290;
    --primary-light: #8d63c6;
    --secondary: #3f9ec5;
    --secondary-rgb: 63,158,197;
    --secondary-dark: #2f7a9a;
    --secondary-light: #6cb6d4;
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --gradient-soft: linear-gradient(135deg, rgba(113,65,177,.08) 0%, rgba(63,158,197,.08) 100%);
    --sidebar-width: 264px;
    --sidebar-collapsed: 76px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 12px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
    --border: #e8eaef;
    --muted: #6b7280;
    --bg: #f6f7fb;
    --bg-card: #ffffff;
    --text: #1f2937;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* ============ Bootstrap overrides ============ */
.btn-primary {
    background: var(--gradient);
    border: none;
    box-shadow: 0 2px 6px rgba(var(--primary-rgb), .25);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--gradient);
    filter: brightness(1.05);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), .35);
}
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-secondary {
    background: var(--secondary);
    border-color: var(--secondary);
}
.text-primary { color: var(--primary) !important; }
.bg-primary { background: var(--primary) !important; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 .2rem rgba(var(--primary-rgb), .15);
}
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.badge-primary { background: var(--gradient); color: #fff; }

/* ============ Brand ============ */
.brand-mark {
    width: 36px; height: 36px;
    background: var(--gradient);
    border-radius: 10px;
    color: white;
    font-weight: 800;
    font-size: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), .3);
}
.brand-text {
    font-weight: 800;
    font-size: 20px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ============ App shell ============ */
.app-shell { min-height: 100vh; display: flex; }
.app-sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1030;
    display: flex; flex-direction: column;
    transition: transform .25s ease, width .25s ease;
}
.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex; flex-direction: column;
    transition: margin-left .25s ease;
}
.sidebar-collapsed .app-sidebar { width: var(--sidebar-collapsed); }
.sidebar-collapsed .app-sidebar .nav-link span,
.sidebar-collapsed .app-sidebar .brand-text,
.sidebar-collapsed .app-sidebar .nav-section-title,
.sidebar-collapsed .app-sidebar .nav-sublink,
.sidebar-collapsed .app-sidebar .chev,
.sidebar-collapsed .app-sidebar .sidebar-footer { display: none; }
.sidebar-collapsed .app-main { margin-left: var(--sidebar-collapsed); }

.sidebar-brand {
    padding: 18px 18px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.sidebar-nav {
    flex: 1; overflow-y: auto;
    padding: 12px 10px 20px;
}
.nav-section { margin-bottom: 18px; }
.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    padding: 8px 12px;
    font-weight: 600;
}
.nav-link, .nav-toggle, .nav-sublink {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    margin: 2px 0;
    color: #4b5563;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    transition: all .15s ease;
    cursor: pointer;
}
.nav-link i, .nav-toggle i { font-size: 18px; width: 22px; text-align: center; }
.nav-link:hover, .nav-toggle:hover {
    background: var(--gradient-soft);
    color: var(--primary);
}
.nav-link.active, .nav-toggle.active {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), .25);
}
.nav-link.active i, .nav-toggle.active i { color: #fff; }
.nav-sublink {
    padding-left: 38px;
    font-size: 13.5px;
    color: #6b7280;
}
.nav-sublink.active { color: var(--primary); font-weight: 600; }
.nav-sublink:hover { background: rgba(var(--primary-rgb), .06); }
.nav-collapsible .collapse, .nav-collapsible .collapsing { margin-left: 4px; }
.nav-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.chev { transition: transform .2s ease; font-size: 12px !important; }
.sidebar-footer { padding: 12px 18px; border-top: 1px solid var(--border); }

/* ============ Topbar ============ */
.app-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 1020;
}
.btn-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    color: #4b5563;
    position: relative;
}
.btn-icon:hover { background: var(--gradient-soft); color: var(--primary); border-color: var(--primary-light); }
.dot-indicator {
    position: absolute; top: 8px; right: 8px;
    width: 8px; height: 8px; background: var(--secondary);
    border-radius: 50%; border: 2px solid #fff;
}
.topbar-search { position: relative; width: 360px; }
.topbar-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-search .form-control { padding-left: 40px; height: 40px; background: #f4f5f9; border-color: transparent; }
.user-chip {
    display: flex; align-items: center; gap: 10px;
    background: #f4f5f9;
    border: none;
    padding: 6px 14px 6px 6px;
    border-radius: 30px;
    cursor: pointer;
}
.user-chip:hover { background: var(--gradient-soft); }
.user-chip .avatar {
    width: 36px; height: 36px;
    background: var(--gradient);
    border-radius: 50%;
    color: white; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
}
.user-chip .name { font-weight: 600; font-size: 13px; line-height: 1; }
.user-chip .role { font-size: 11px; color: var(--muted); line-height: 1; margin-top: 2px; }

/* ============ Content ============ */
.app-content { padding: 24px; flex: 1; }
.app-footer { padding: 18px 24px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); background: #fff; }

/* Page header */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    flex-wrap: wrap; margin-bottom: 24px;
}
.page-title { font-size: 24px; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--muted); margin: 4px 0 0; font-size: 14px; }

/* Cards */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: 16px 20px; }
.card-body { padding: 20px; }

/* Stat cards */
.stat-card {
    display: flex; align-items: center; gap: 16px;
    padding: 20px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--border);
    transition: all .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px;
    background: var(--gradient-soft);
    color: var(--primary);
}
.stat-card.purple .icon { background: var(--gradient); color: #fff; }
.stat-card.cyan .icon { background: linear-gradient(135deg, var(--secondary), var(--secondary-light)); color: #fff; }
.stat-card.green .icon { background: linear-gradient(135deg, #10b981, #34d399); color: #fff; }
.stat-card.orange .icon { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
.stat-card .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-card .value { font-size: 24px; font-weight: 700; line-height: 1; margin-top: 4px; }

/* Course card */
.course-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all .25s ease;
    height: 100%;
    display: flex; flex-direction: column;
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.course-thumb {
    aspect-ratio: 16/9;
    background: var(--gradient);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    position: relative;
    overflow: hidden;
}
.course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-thumb .price-badge {
    position: absolute; top: 12px; right: 12px;
    background: rgba(0,0,0,.7); color: #fff;
    padding: 4px 10px; border-radius: 6px;
    font-weight: 600; font-size: 13px;
}
.course-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.course-title { font-weight: 600; font-size: 16px; margin: 0 0 6px; line-height: 1.4; }
.course-meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }

/* Tables */
.table-wrapper {
    background: #fff; border-radius: var(--radius);
    border: 1px solid var(--border); overflow: hidden;
}
.table { margin: 0; }
.table thead th {
    background: #fafbfd;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 12px 16px;
}
.table tbody td { padding: 14px 16px; vertical-align: middle; border-color: var(--border); }
.table tbody tr:hover { background: rgba(var(--primary-rgb), .03); }

/* Status pills */
.pill {
    display: inline-block; padding: 4px 10px; border-radius: 30px;
    font-size: 12px; font-weight: 600;
}
.pill-success { background: #d1fae5; color: #065f46; }
.pill-warning { background: #fef3c7; color: #92400e; }
.pill-danger { background: #fee2e2; color: #991b1b; }
.pill-info { background: #dbeafe; color: #1e40af; }
.pill-secondary { background: #e5e7eb; color: #374151; }

/* ============ Auth ============ */
.auth-body { background: var(--bg); min-height: 100vh; }
.auth-shell { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-left {
    background: var(--gradient);
    padding: 60px;
    color: #fff;
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
}
.auth-left .auth-brand { display: flex; gap: 12px; align-items: center; z-index: 2; }
.auth-left .brand-text { color: #fff; background: none; -webkit-text-fill-color: #fff; }
.auth-left .brand-mark { background: rgba(255,255,255,.2); box-shadow: none; }
.auth-pitch { z-index: 2; max-width: 460px; }
.auth-pitch h1 { font-size: 42px; font-weight: 800; margin: 0 0 16px; line-height: 1.1; }
.auth-pitch p { font-size: 16px; opacity: .9; line-height: 1.6; }
.auth-features { list-style: none; padding: 0; margin: 28px 0 0; }
.auth-features li { padding: 6px 0; display: flex; gap: 10px; align-items: center; opacity: .95; }
.auth-features i { color: #fff; }
.auth-blob {
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    right: -180px; bottom: -180px;
}
.auth-right {
    padding: 60px;
    display: flex; flex-direction: column; justify-content: center;
    background: #fff;
}
.auth-card { max-width: 420px; margin: 0 auto; width: 100%; }
.auth-card h2 { font-weight: 700; margin: 0 0 6px; font-size: 28px; }
.auth-card .lead { color: var(--muted); margin-bottom: 28px; font-size: 15px; }
.auth-footer { text-align: center; color: var(--muted); margin-top: 28px; font-size: 13px; }
.auth-card .form-control { height: 46px; }
.auth-card .btn-primary { height: 46px; font-weight: 600; }

@media (max-width: 991px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-left { display: none; }
    .auth-right { padding: 30px; }
    .app-sidebar { transform: translateX(-100%); }
    .app-main { margin-left: 0 !important; }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    body.sidebar-open::after {
        content: ''; position: fixed; inset: 0;
        background: rgba(0,0,0,.4); z-index: 1025;
    }
}

/* ============ Public landing ============ */
.public-nav {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky; top: 0; z-index: 100;
}
.hero {
    background: var(--gradient);
    color: #fff;
    padding: 100px 0;
    position: relative; overflow: hidden;
}
.hero h1 { font-size: 56px; font-weight: 800; line-height: 1.05; margin: 0 0 20px; }
.hero p { font-size: 19px; opacity: .92; max-width: 600px; margin: 0 0 32px; line-height: 1.5; }
.hero .btn-light {
    background: #fff; color: var(--primary);
    border: none; padding: 14px 28px; font-weight: 700; border-radius: 10px;
}
.hero .btn-outline-light {
    border: 2px solid rgba(255,255,255,.5); padding: 14px 28px; font-weight: 600; border-radius: 10px;
}
.public-footer { background: #fff; border-top: 1px solid var(--border); margin-top: 60px; }
.section-title { font-weight: 700; font-size: 32px; margin-bottom: 8px; }
.section-subtitle { color: var(--muted); margin-bottom: 32px; }

/* ============ Wizard / Installer ============ */
.installer-shell {
    min-height: 100vh; display: flex; align-items: center;
    background: var(--gradient);
    padding: 40px 20px;
}
.installer-card {
    max-width: 720px; margin: 0 auto;
    background: #fff; border-radius: 18px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.installer-header {
    padding: 28px 32px; border-bottom: 1px solid var(--border);
}
.installer-steps {
    display: flex; padding: 20px 32px; gap: 8px;
    background: #fafbfd; border-bottom: 1px solid var(--border);
}
.installer-step {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 8px; position: relative;
}
.installer-step .dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #e5e7eb; color: #6b7280;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    transition: all .2s ease;
}
.installer-step.active .dot {
    background: var(--gradient); color: #fff;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), .3);
}
.installer-step.done .dot { background: #10b981; color: #fff; }
.installer-step .label { font-size: 12px; color: var(--muted); }
.installer-step.active .label { color: var(--primary); font-weight: 600; }
.installer-body { padding: 32px; }
.installer-actions { padding: 20px 32px; background: #fafbfd; border-top: 1px solid var(--border); display: flex; justify-content: space-between; }
.req-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px;
}
.req-row.ok { background: #ecfdf5; border-color: #a7f3d0; }
.req-row.bad { background: #fef2f2; border-color: #fecaca; }

/* Permission grid */
.perm-group {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 16px; overflow: hidden;
}
.perm-group-header {
    padding: 12px 16px; background: #fafbfd; border-bottom: 1px solid var(--border);
    font-weight: 600; display: flex; justify-content: space-between; align-items: center;
}
.perm-group-body { padding: 12px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 8px; }

/* Payment method chooser */
.pay-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; }
.pay-method {
    cursor: pointer; padding: 18px 16px; border-radius: var(--radius);
    border: 2px solid var(--border); background: #fff; text-align: center;
    transition: all .2s ease; position: relative;
}
.pay-method:hover { border-color: var(--primary-light); transform: translateY(-2px); }
.pay-method.selected {
    border-color: var(--primary);
    background: var(--gradient-soft);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), .15);
}
.pay-method i { font-size: 28px; color: var(--primary); margin-bottom: 8px; display: block; }
.pay-method .name { font-weight: 600; font-size: 14px; }
.pay-method input[type=radio] { position: absolute; opacity: 0; }

/* Empty state */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty-state i { font-size: 56px; opacity: .4; margin-bottom: 16px; display: block; }

/* Utility */
.gradient-text {
    background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%; animation: skel 1.4s infinite;
}
@keyframes skel { 0%{background-position:200% 0;} 100%{background-position:-200% 0;} }

/* ============================================================
   Moodle features styles
   ============================================================ */

/* Course activity tabs */
.course-activity-nav .nav-link {
    color: var(--muted); padding: 8px 16px; border-radius: 8px;
    font-weight: 500; transition: all .2s;
}
.course-activity-nav .nav-link:hover { background: var(--gradient-soft); color: var(--primary); }
.course-activity-nav .nav-link.active { background: var(--gradient); color: #fff; }

/* Calendar grid */
.calendar-grid td { transition: background-color .15s; }
.calendar-grid td:hover { background-color: rgba(113, 65, 177, 0.04); }

/* Badge icons on profile / badges page */
.badge-icon { transition: transform .2s; }
.badge-icon:hover { transform: scale(1.08); }

/* Pill semantic variants (used across quizzes / assignments / grades) */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-success  { background: #d1fae5; color: #065f46; }
.pill-danger   { background: #fee2e2; color: #991b1b; }
.pill-warning  { background: #fef3c7; color: #92400e; }
.pill-info     { background: #dbeafe; color: #1e40af; }
.pill-secondary{ background: #e5e7eb; color: #374151; }
.pill-primary  { background: rgba(113, 65, 177, 0.12); color: var(--primary); }

/* Quiz attempt review borders */
.border-3 { border-width: 3px !important; }

/* ============================================================
   v1.2 ENHANCEMENTS — Avatars, Vertical Settings Tabs, Branding
   ============================================================ */

/* ---------- Avatars ---------- */
.avatar-img {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: var(--gradient);
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.avatar-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.avatar-img .avatar-initials { display: none; }
.avatar-img.avatar-fallback .avatar-initials { display: inline; }
.avatar-img.avatar-fallback img { display: none; }
.topbar-avatar { border: 2px solid #fff; }

/* Profile page avatar */
.profile-card { border-radius: 14px; overflow: hidden; }
.profile-avatar-wrap {
    position: relative;
    width: 128px;
    height: 128px;
    margin: 0 auto;
}
.profile-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,.10);
    display: block;
}
.profile-avatar-fallback {
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 700;
}
.avatar-edit-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    transition: transform .15s, background .15s;
}
.avatar-edit-btn:hover {
    transform: scale(1.08);
    background: var(--primary-dark);
}
.upload-hint {
    font-size: 12px;
    color: var(--muted);
}

/* ---------- Vertical Settings Tabs ---------- */
.settings-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 991px) {
    .settings-shell { grid-template-columns: 1fr; }
}
.settings-tabs {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    position: sticky;
    top: 88px;
}
.settings-tabs-header {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 700;
    padding: 8px 12px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text, #374151);
    transition: background-color .15s, color .15s;
    position: relative;
}
.settings-tab > i:first-child {
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: var(--muted);
    transition: color .15s;
}
.settings-tab .tab-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}
.settings-tab .tab-label {
    font-weight: 600;
    font-size: 14px;
    color: inherit;
}
.settings-tab .tab-desc {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-tab .tab-arrow {
    font-size: 12px;
    color: var(--muted);
    opacity: 0;
    transition: opacity .15s, transform .15s;
}
.settings-tab:hover {
    background: rgba(var(--primary-rgb), .06);
    color: var(--primary);
}
.settings-tab:hover > i:first-child,
.settings-tab:hover .tab-arrow {
    color: var(--primary);
    opacity: 1;
}
.settings-tab.active {
    background: var(--gradient);
    color: #fff;
}
.settings-tab.active > i:first-child,
.settings-tab.active .tab-label,
.settings-tab.active .tab-arrow {
    color: #fff;
}
.settings-tab.active .tab-desc {
    color: rgba(255,255,255,.85);
}
.settings-tab.active .tab-arrow { opacity: 1; }

/* ---------- Settings Content Panels ---------- */
.settings-content { min-width: 0; }
.settings-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.02);
}
.settings-panel .panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(var(--primary-rgb),.03), transparent);
}
.settings-panel .panel-header h4 {
    margin: 0 0 4px;
    font-weight: 700;
    color: var(--primary);
}
.settings-panel .panel-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}
.settings-panel .panel-body { padding: 24px; }
.settings-panel .panel-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: #fafbfd;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.settings-panel .req { color: #dc2626; }
.settings-panel .section-title {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}

/* ---------- Upload preview blocks ---------- */
.upload-preview {
    width: 100%;
    min-height: 120px;
    background: #fafbfd;
    border: 2px dashed var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    padding: 12px;
    overflow: hidden;
}
.upload-preview img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}
.upload-preview-lg { min-height: 220px; }
.upload-preview-lg img { max-height: 220px; }
.upload-preview-sm { min-height: 80px; }
.upload-preview-sm img { max-height: 60px; }
.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-align: center;
}
.upload-placeholder i { font-size: 32px; opacity: .6; }
.upload-placeholder span { font-size: 13px; }

/* ---------- Toggle-card grid ---------- */
.toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.toggle-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
    background: #fff;
    margin: 0;
}
.toggle-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.toggle-card > i {
    font-size: 22px;
    color: var(--muted);
    width: 32px;
    text-align: center;
    transition: color .15s;
}
.toggle-card > div { flex: 1; line-height: 1.3; }
.toggle-card strong { display: block; font-size: 14px; }
.toggle-card small { color: var(--muted); font-size: 12px; }
.toggle-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb),.06);
}
.toggle-card:has(input:checked) {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), .05);
}
.toggle-card:has(input:checked) > i {
    color: var(--primary);
}
.toggle-card:has(input:checked) strong { color: var(--primary); }

/* ---------- Integration cards ---------- */
.integration-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}
.integration-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    transition: box-shadow .15s;
}
.integration-item:hover { box-shadow: 0 3px 10px rgba(0,0,0,.06); }
.int-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
}
.int-body { flex: 1; min-width: 0; }
.int-title { font-weight: 600; font-size: 14px; }

/* ---------- Sidebar logo image ---------- */
.sidebar-logo {
    height: 36px;
    max-width: 160px;
    object-fit: contain;
}

/* ---------- Footer social ---------- */
.footer-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), .08);
    color: var(--primary);
    text-decoration: none;
    transition: background-color .15s, color .15s, transform .15s;
}
.footer-social-link:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

/* ---------- Fix topbar user chip text alignment ---------- */
.user-chip { line-height: 1.15; }
.user-chip .name { font-weight: 600; font-size: 13px; }
.user-chip .role { font-size: 11px; color: var(--muted); text-transform: capitalize; }

/* ============================================================
   v1.3 ENHANCEMENTS — Progress Tracker, Sections, Dashboard
   ============================================================ */

/* ---------- Progress Tracker ---------- */
.progress-list { display: flex; flex-direction: column; gap: 16px; }
.progress-row {
    display: flex;
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    transition: box-shadow .15s, border-color .15s;
}
.progress-row:hover {
    border-color: var(--primary-light);
    box-shadow: 0 3px 12px rgba(var(--primary-rgb),.06);
}
.pr-thumb {
    width: 72px; height: 72px;
    border-radius: 10px;
    background: var(--gradient-soft, rgba(var(--primary-rgb),.08));
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    color: var(--primary);
    font-size: 28px;
}
.pr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pr-body { flex: 1; min-width: 0; }
.pr-title {
    font-weight: 600; color: #111827;
    text-decoration: none;
    font-size: 15px;
    display: inline-block; margin-bottom: 2px;
}
.pr-title:hover { color: var(--primary); }
.pr-meta {
    display: flex; gap: 12px; flex-wrap: wrap;
    color: var(--muted); font-size: 12px;
    margin-top: 2px;
}
.pr-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 8px;
}

/* Legend dots on progress overview */
.dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    margin-right: 6px; vertical-align: middle;
}
.dot-progress    { background: #f59e0b; }
.dot-not-started { background: #94a3b8; }
.dot-completed   { background: #10b981; }

/* ---------- Course Sections ---------- */
.section-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
    display: flex; flex-direction: column;
    height: 100%;
}
.section-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.section-header {
    height: 120px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 40px;
}
.section-body { padding: 16px; }
.section-icon-inline {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 8px;
    color: #fff; font-size: 16px;
    margin-right: 8px; vertical-align: middle;
}

/* ---------- Admin Dashboard: Upcoming Events / Announcements ---------- */
.event-list, .announcement-list { display: flex; flex-direction: column; gap: 12px; margin: 0; }

.event-item { display: flex; gap: 12px; align-items: flex-start; }
.event-date {
    width: 52px; height: 56px;
    border-radius: 10px;
    display: inline-flex; flex-direction: column;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    line-height: 1;
}
.event-date .ev-month {
    font-size: 10px; text-transform: uppercase;
    letter-spacing: .05em; opacity: .8;
}
.event-date .ev-day { font-size: 20px; margin-top: 2px; }
.event-body { flex: 1; min-width: 0; }
.event-title { font-weight: 600; font-size: 14px; color: #111827; }
.event-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.announcement-item {
    display: flex; gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}
.announcement-item:last-child { border-bottom: none; padding-bottom: 0; }
.ann-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), .12);
    color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}
.ann-icon.ann-pinned { background: rgba(245, 158, 11, .15); color: #d97706; }
.ann-body { flex: 1; min-width: 0; }
.ann-title { font-size: 14px; color: #111827; }
.ann-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.ann-preview {
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
