/* ============================================================
   EnglishPath — Complete Site Stylesheet
   Version: 1.0.0
   ============================================================ */

/* ─── CSS Custom Properties ────────────────────────────────── */
:root {
    /* Colours */
    --navy:         #1a2744;
    --navy-light:   #243258;
    --purple:       #7c3aed;
    --purple-light: #8b5cf6;
    --purple-pale:  #ede9fe;
    --white:        #ffffff;
    --bg:           #f4f6fb;
    --text:         #1f2937;
    --text-muted:   #6b7280;
    --border:       #e5e7eb;
    --success:      #059669;
    --danger:       #dc2626;
    --warning:      #d97706;

    /* Sidebar */
    --sidebar-width: 260px;

    /* Shadows */
    --shadow-sm:   0 1px 4px rgba(0,0,0,0.06);
    --shadow-md:   0 2px 12px rgba(0,0,0,0.07);
    --shadow-lg:   0 8px 32px rgba(0,0,0,0.12);

    /* Radius */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  10px;
    --radius-xl:  16px;

    /* Typography */
    --font-sans:  system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono:  'Courier New', Courier, monospace;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--navy);
    font-weight: 700;
    line-height: 1.3;
}

a {
    color: var(--purple);
    text-decoration: none;
}

a:hover {
    color: var(--purple-light);
    text-decoration: underline;
}

img, svg {
    display: inline-block;
    vertical-align: middle;
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
}

/* ─── Layout: Sidebar + Main ───────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.sidebar-logo svg {
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--white);
    flex-shrink: 0;
}

.sidebar-username {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-role {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.55);
    text-transform: capitalize;
}

/* ─── Sidebar Navigation ───────────────────────────────────── */
.nav-section-label {
    font-size: 0.675rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    padding: 0.9rem 0.75rem 0.3rem;
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.75);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-left-color 0.15s;
    border-left: 3px solid transparent;
    margin-bottom: 1px;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: var(--white);
    text-decoration: none;
}

.nav-link.active {
    background: rgba(124,58,237,0.18);
    color: var(--purple-pale);
    border-left-color: var(--purple-light);
    font-weight: 600;
}

.nav-link svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-link.active svg {
    opacity: 1;
}

.nav-sub {
    padding-left: 1.1rem;
}

.nav-sub .nav-link {
    font-size: 0.83rem;
    padding: 0.45rem 0.75rem;
}

.nav-link-locked {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}

.nav-badge-soon {
    margin-left: auto;
    font-size: 0.65rem;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.6);
    padding: 0.1rem 0.4rem;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* ─── Main Content Area ────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    background-color: var(--bg);
    min-height: 100vh;
    overflow-x: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 2rem;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
}

.page-body {
    padding: 2rem;
    flex: 1;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--navy);
    padding: 0.25rem;
    line-height: 1;
}

/* ─── Sidebar Overlay (mobile) ─────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ─── Login Page ───────────────────────────────────────────── */
body.login-page {
    background: linear-gradient(135deg, var(--navy) 0%, #2d1b69 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo svg {
    display: block;
    margin: 0 auto 0.75rem;
}

.login-site-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.03em;
    margin-bottom: 0.3rem;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.login-footer {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

/* Role Selector */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.role-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
    text-align: center;
}

.role-option:hover {
    border-color: var(--purple-light);
    background: rgba(124,58,237,0.03);
}

.role-option.selected {
    border-color: var(--purple);
    background: var(--purple-pale);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

.role-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.role-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--purple);
}

.role-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--navy);
}

/* Password toggle */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .form-control {
    padding-left: 2.5rem;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.2rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    line-height: 1;
    transition: color 0.15s;
}

.password-toggle:hover {
    color: var(--purple);
}

/* ─── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
    margin: 0;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ─── Module Cards (learning dashboards) ───────────────────── */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.module-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-left-color 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.11);
    border-left-color: var(--purple);
    text-decoration: none;
    color: inherit;
}

.module-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--purple-pale);
    color: var(--purple);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.module-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.35rem;
}

.module-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Level badge */
.level-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--purple);
    color: var(--white);
}

.level-badge.a1 { background: #7c3aed; }
.level-badge.a2 { background: #2563eb; }
.level-badge.b1 { background: #059669; }

/* ─── Level Cards (top-level dashboard) ────────────────────── */
.level-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.level-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.level-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.level-card.locked {
    opacity: 0.65;
    pointer-events: none;
}

.level-card.locked::after {
    content: 'Coming soon';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--border);
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
}

.level-card-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--purple-pale);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.level-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.level-card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.level-card-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--purple);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    transition: gap 0.15s;
}

.level-card-link:hover {
    gap: 0.5rem;
    text-decoration: none;
    color: var(--purple-light);
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
    line-height: 1.4;
    white-space: nowrap;
    font-family: inherit;
}

.btn:hover {
    text-decoration: none;
}

.btn:focus-visible {
    outline: 3px solid rgba(124,58,237,0.4);
    outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-light) 100%);
    color: var(--white);
    border-color: transparent;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9 0%, var(--purple) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(124,58,237,0.4);
}

.btn-secondary {
    background: var(--white);
    color: var(--purple);
    border-color: var(--purple);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--purple-pale);
    color: var(--purple);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: transparent;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    color: var(--white);
    box-shadow: 0 4px 14px rgba(220,38,38,0.35);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg);
    color: var(--text);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
}

/* Logout button in sidebar */
.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(220,38,38,0.12);
    color: #fca5a5;
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-logout:hover {
    background: rgba(220,38,38,0.22);
    color: #fca5a5;
    text-decoration: none;
}

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.form-label .required {
    color: var(--danger);
    margin-left: 0.2rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
    appearance: none;
    -webkit-appearance: none;
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-control:focus {
    outline: none;
    border-color: var(--purple-light);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}

.form-control:disabled {
    background: var(--bg);
    opacity: 0.7;
    cursor: not-allowed;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.form-error {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 0.3rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ─── Alerts ────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-info {
    background: var(--purple-pale);
    border-color: #c4b5fd;
    color: #5b21b6;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* ─── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: capitalize;
    white-space: nowrap;
}

.badge-student {
    background: var(--purple-pale);
    color: var(--purple);
}

.badge-teacher {
    background: var(--navy);
    color: var(--white);
}

.badge-admin {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid var(--border);
}

/* Status dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.35rem;
    flex-shrink: 0;
}

.status-active   { background: var(--success); }
.status-disabled { background: var(--danger); }

.status-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 500;
}

/* ─── Tables (admin views) ──────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--white);
}

.data-table thead tr {
    background: var(--purple);
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--white);
    white-space: nowrap;
}

.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td {
    background: #f9fafb;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: #f0f4ff;
}

.data-table .actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ─── Content Body (markdown rendered content) ──────────────── */
.content-body {
    max-width: 780px;
    line-height: 1.8;
    color: var(--text);
}

.content-body h1 {
    font-size: 1.75rem;
    color: var(--navy);
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.content-body h2 {
    font-size: 1.3rem;
    color: var(--navy);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
    border-left: 3px solid var(--purple);
}

.content-body h3 {
    font-size: 1.05rem;
    color: var(--navy);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.content-body p {
    margin-bottom: 1rem;
}

.content-body ul,
.content-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.content-body ul {
    list-style: disc;
}

.content-body ol {
    list-style: decimal;
}

.content-body li {
    margin-bottom: 0.35rem;
}

.content-body strong {
    font-weight: 700;
    color: var(--navy);
}

.content-body em {
    font-style: italic;
}

.content-body code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: #f3f0ff;
    color: var(--purple);
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
}

.content-body pre {
    background: var(--navy);
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.content-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 0.88rem;
}

.content-body blockquote {
    background: var(--purple-pale);
    border-left: 4px solid var(--purple);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 1.25rem 0;
    color: #4c1d95;
    font-style: italic;
}

.content-body blockquote p:last-child {
    margin-bottom: 0;
}

.content-body hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 2rem 0;
}

.content-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.content-body table th {
    background: var(--purple);
    color: var(--white);
    padding: 0.6rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.content-body table td {
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border);
}

.content-body table tbody tr:nth-child(even) td {
    background: #f9fafb;
}

.content-body a {
    color: var(--purple);
    font-weight: 500;
}

.content-body a:hover {
    color: var(--purple-light);
}

/* ─── Utility: Text Colours ─────────────────────────────────── */
.text-muted   { color: var(--text-muted) !important; }
.text-purple  { color: var(--purple) !important; }
.text-navy    { color: var(--navy) !important; }
.text-danger  { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-white   { color: var(--white) !important; }
.text-sm      { font-size: 0.85rem; }
.text-xs      { font-size: 0.75rem; }
.text-bold    { font-weight: 700; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

/* ─── Utility: Spacing ──────────────────────────────────────── */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mt-6 { margin-top: 1.5rem !important; }
.mt-8 { margin-top: 2rem !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-6 { margin-bottom: 1.5rem !important; }
.mb-8 { margin-bottom: 2rem !important; }

.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-4 { padding: 1rem !important; }
.p-6 { padding: 1.5rem !important; }
.p-8 { padding: 2rem !important; }

/* ─── Utility: Flexbox ──────────────────────────────────────── */
.flex         { display: flex !important; }
.flex-col     { flex-direction: column !important; }
.flex-between { display: flex !important; justify-content: space-between !important; align-items: center !important; }
.flex-center  { display: flex !important; align-items: center !important; justify-content: center !important; }
.flex-start   { display: flex !important; align-items: center !important; }
.flex-wrap    { flex-wrap: wrap !important; }
.flex-1       { flex: 1 !important; }

.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }
.gap-6 { gap: 1.5rem !important; }

/* ─── Utility: Width / Display ──────────────────────────────── */
.w-full  { width: 100% !important; }
.w-auto  { width: auto !important; }
.d-none  { display: none !important; }
.d-block { display: block !important; }

/* ─── Stat Cards (dashboard summaries) ─────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1;
}

.stat-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* ─── Progress Bar ──────────────────────────────────────────── */
.progress {
    height: 6px;
    background: var(--border);
    border-radius: 20px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--purple-light));
    border-radius: 20px;
    transition: width 0.5s ease;
}

/* ─── Empty States ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state svg {
    opacity: 0.35;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

/* ─── Pagination ────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 1.25rem;
    justify-content: center;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--white);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.page-link:hover {
    background: var(--purple-pale);
    border-color: var(--purple-light);
    color: var(--purple);
    text-decoration: none;
}

.page-link.active {
    background: var(--purple);
    border-color: var(--purple);
    color: var(--white);
}

/* ─── Modal (generic) ───────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.75rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ─── Responsive: Mobile ────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

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

    .hamburger {
        display: block;
    }

    .page-body {
        padding: 1rem;
    }

    .level-grid {
        grid-template-columns: 1fr;
    }

    .module-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .login-card {
        padding: 1.75rem 1.25rem;
    }

    .role-selector {
        grid-template-columns: 1fr 1fr;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.65rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .role-selector {
        grid-template-columns: 1fr 1fr;
    }

    .modal {
        padding: 1.5rem;
    }
}

/* ─── Print ─────────────────────────────────────────────────── */
@media print {
    .sidebar,
    .hamburger,
    .btn-logout,
    .page-header {
        display: none !important;
    }

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

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
