/**
 * ═══════════════════════════════════════════════════════════════════════
 * EDUVERSE DESIGN SYSTEM — "Modular-Layered"
 * ─────────────────────────────────────────────────────────────────────
 * Philosophy: Flat color. Geometric precision. No gradients.
 * Depth is achieved through strategic layering — not shadows.
 * Color palette derived directly from the Eduverse logo.
 * ═══════════════════════════════════════════════════════════════════════
 */

:root {
    /* ── Eduverse Brand Palette ──────────────────────────────────────── */
    --brand-primary:        #0077CC;   /* Core blue — U, R, S in logo     */
    --brand-primary-dark:   #005FA3;
    --brand-primary-xdark:  #004D87;
    --brand-accent:         #5CC0EB;   /* Cerulean — E stripes, overlays  */
    --brand-accent-dim:     rgba(92, 192, 235, 0.16);
    --brand-grey:           #404040;   /* Charcoal — logo body            */
    --brand-grey-dark:      #2D2D2D;   /* Sidebar & dark surfaces         */
    --brand-grey-mid:       #5C5C5C;
    --brand-stripe:         #E0E0E0;   /* E-stripe highlight grey         */
    --brand-text:           #202020;   /* Near-black                      */
    --brand-bg:             #F2F4F7;   /* Page background                 */

    /* ── System Aliases (keep existing template class names working) ─ */
    --color-primary:           var(--brand-primary);
    --color-primary-dark:      var(--brand-primary-dark);
    --color-primary-light:     var(--brand-accent);
    --color-primary-bg:        rgba(0, 119, 204, 0.08);

    --color-secondary:         var(--brand-accent);
    --color-secondary-dark:    #3BADD6;
    --color-secondary-light:   rgba(92, 192, 235, 0.2);

    --color-accent:            var(--brand-accent);
    --color-accent-dark:       #3BADD6;
    --color-accent-light:      rgba(92, 192, 235, 0.25);

    /* ── Status Colors ──────────────────────────────────────────────── */
    --color-success:        #1A9E5C;
    --color-success-dark:   #14804A;
    --color-success-light:  #B3EDD4;
    --color-success-bg:     #F0FBF6;

    --color-warning:        #D97706;
    --color-warning-dark:   #B45309;
    --color-warning-light:  #FDE68A;
    --color-warning-bg:     #FFFBEB;

    --color-danger:         #DC2626;
    --color-danger-dark:    #B91C1C;
    --color-danger-light:   #FECACA;
    --color-danger-bg:      #FEF2F2;

    --color-info:            var(--brand-accent);
    --color-info-dark:       #3BADD6;
    --color-info-light:      rgba(92, 192, 235, 0.22);

    /* ── Neutrals (mapped to brand scale) ───────────────────────────── */
    --color-white:      #FFFFFF;
    --color-gray-50:    #F2F4F7;
    --color-gray-100:   #EAECF0;
    --color-gray-200:   #E0E0E0;   /* = brand-stripe */
    --color-gray-300:   #C8C8C8;
    --color-gray-400:   #9A9A9A;
    --color-gray-500:   #727272;
    --color-gray-600:   #5C5C5C;
    --color-gray-700:   #404040;   /* = brand-grey   */
    --color-gray-800:   #2D2D2D;   /* = brand-grey-dark */
    --color-gray-900:   #202020;   /* = brand-text   */

    /* ── Layout ─────────────────────────────────────────────────────── */
    --sidebar-width:    256px;
    --topbar-height:    60px;

    /* Geometric radius — tight and structured */
    --radius:           6px;
    --radius-sm:        4px;
    --radius-lg:        8px;

    /* Aliases used in blade templates */
    --border-radius:    var(--radius);
    --border-radius-sm: var(--radius-sm);
    --border-radius-lg: var(--radius-lg);
    --border-radius-xl: 10px;

    /* ── Shadows — used sparingly, kept subtle ───────────────────────── */
    --shadow-sm:   0 1px 2px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.04);
    --shadow:      0 2px 8px rgba(0,0,0,0.07);
    --shadow-lg:   0 4px 18px rgba(0,0,0,0.09);
    --shadow-xl:   0 8px 30px rgba(0,0,0,0.11);

    /* ── Typography ─────────────────────────────────────────────────── */
    --font-en:   'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-ar:   'Cairo', 'Noto Sans Arabic', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* ── Motion ─────────────────────────────────────────────────────── */
    --transition:      all 0.14s ease;
    --transition-slow: all 0.28s ease;
}

/* ═══════════════════════════════════════════════════════════════════════
   BASE RESET & TYPOGRAPHY
═══════════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ar);
    background: var(--brand-bg);
    color: var(--brand-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

[dir="ltr"] body,
body[dir="ltr"],
body.ltr {
    font-family: var(--font-en);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.25;
    color: var(--brand-text);
    letter-spacing: -0.01em;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-primary-dark); }

/* ═══════════════════════════════════════════════════════════════════════
   LAYOUT — SIDEBAR
═══════════════════════════════════════════════════════════════════════ */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--brand-grey-dark);
    color: #fff;
    position: fixed;
    top: 0;
    right: 0;               /* RTL default */
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: width 0.25s ease, transform 0.25s ease;
    display: flex;
    flex-direction: column;
    border-inline-start: 3px solid var(--brand-primary);
}

[dir="ltr"] .sidebar {
    right: auto;
    left: 0;
}

/* ── Desktop collapsed (icon-only) ─────────────────────────── */
.sidebar.collapsed {
    width: 60px;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-logo-sub,
.sidebar.collapsed .sidebar-logo > div > div:last-child,  /* "Powered by" line */
.sidebar.collapsed .nav-item-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-user-footer > div,
.sidebar.collapsed .sidebar-user-footer > a {
    display: none !important;
}

.sidebar.collapsed .sidebar-logo {
    align-items: center;
    padding: .875rem .5rem;
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo > div {
    justify-content: center;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: .6rem 0;
}

.sidebar.collapsed .nav-item-icon {
    margin: 0;
}

.sidebar.collapsed .sidebar-user-footer {
    justify-content: center;
    padding: .75rem .5rem;
}

[dir="ltr"] .main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s ease;
}
[dir="rtl"] .main-content {
    margin-right: var(--sidebar-width);
    transition: margin-right 0.25s ease;
}
[dir="ltr"] .sidebar.collapsed ~ * .main-content,
body.sidebar-collapsed [dir="ltr"] .main-content {
    margin-left: 60px;
}
body.sidebar-collapsed [dir="rtl"] .main-content {
    margin-right: 60px;
}

/* Scrollbar — minimal */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* ── Logo Area ───────────────────────────────────────────────────── */
.sidebar-logo {
    padding: 1.125rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    position: relative;
    overflow: hidden;
}

/* Layered-shape accent: semi-transparent rhombus in corner */
.sidebar-logo::after {
    content: '';
    position: absolute;
    top: -22px;
    inset-inline-end: -22px;
    width: 72px;
    height: 72px;
    background: rgba(92, 192, 235, 0.14);
    transform: rotate(45deg);
    pointer-events: none;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--brand-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    /* Layered accent on icon: small accent-blue overlap block */
    box-shadow: 3px 3px 0 rgba(92,192,235,0.4);
}

.sidebar-logo-text {
    font-size: 1.0625rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

.sidebar-logo-text span {
    /* The 'E' in EDUVERSE gets accent coloring — mirroring logo */
    color: var(--brand-accent);
}

.sidebar-logo-sub {
    font-size: 0.625rem;
    opacity: 0.45;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Navigation ─────────────────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    padding: 0.625rem 0;
}

.nav-section-title {
    padding: 0.875rem 1rem 0.35rem;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: rgba(255,255,255,0.28);
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.6rem 1rem;
    color: rgba(255,255,255,0.58);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    transition: color 0.14s ease, background 0.14s ease;
    margin: 1px 0;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.88);
}

.nav-item.active {
    background: rgba(0, 119, 204, 0.18);
    color: #fff;
    font-weight: 600;
}

/* ── E-Stripe Active Indicator ───────────────────────────────────────
   Three horizontal bands in a vertical strip — mirroring the E-letter
   stripes from the logo. Top = accent, middle = primary, bottom = accent.
────────────────────────────────────────────────────────────────────── */
.nav-item.active::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 15%;
    height: 70%;
    width: 4px;
    background: linear-gradient(
        to bottom,
        var(--brand-accent)   0%,
        var(--brand-accent)   30%,
        var(--brand-primary)  30%,
        var(--brand-primary)  70%,
        var(--brand-accent)   70%,
        var(--brand-accent)   100%
    );
    border-radius: 0 2px 2px 0;
}

[dir="rtl"] .nav-item.active::before {
    border-radius: 2px 0 0 2px;
}

.nav-item-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.nav-badge {
    margin-inline-start: auto;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.6rem;
    padding: 0.1rem 0.425rem;
    border-radius: 999px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

/* ── Sidebar User Footer ─────────────────────────────────────────── */
.sidebar-user-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   LAYOUT — MAIN CONTENT
═══════════════════════════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin 0.25s ease;
    min-width: 0;
}

/* margins now handled by sidebar collapsed rules above */

/* ── Top Bar ─────────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--color-white);
    /* Brand-accented bottom border */
    border-bottom: 2px solid var(--brand-primary);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--brand-text);
    flex: 1;
    letter-spacing: 0.01em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-content {
    flex: 1;
    padding: 1.25rem 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════════════════ */
.card {
    background: var(--color-white);
    border-radius: var(--radius);
    border: 1px solid var(--brand-stripe);
    overflow: hidden;
}

.card-header {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--brand-stripe);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-white);
}

.card-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--brand-text);
    letter-spacing: 0.01em;
}

.card-body   { padding: 1.25rem; }
.card-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--brand-stripe);
    background: var(--color-gray-50);
}

/* ── Brand Card Header — Modular-Layered motif ───────────────────────
   Dark charcoal base with semi-transparent accent blue rhombus.
   Use class="card-header--brand" for featured/hero sections.
──────────────────────────────────────────────────────────────────── */
.card-header--brand {
    background: var(--brand-grey-dark);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.card-header--brand .card-title { color: #fff; }

/* Layered accent rhombus — the 'depth' from overlapping shapes in logo */
.card-header--brand::after {
    content: '';
    position: absolute;
    top: -20px;
    inset-inline-end: -20px;
    width: 64px;
    height: 64px;
    background: rgba(92, 192, 235, 0.2);
    transform: rotate(45deg);
    pointer-events: none;
}

/* Secondary accent block — slightly offset */
.card-header--brand::before {
    content: '';
    position: absolute;
    top: -8px;
    inset-inline-end: 22px;
    width: 32px;
    height: 32px;
    background: rgba(0, 119, 204, 0.3);
    transform: rotate(45deg);
    pointer-events: none;
}

/* ── Dark modular card (full card variant) ────────────────────────── */
.card--dark {
    background: var(--brand-grey-dark);
    border-color: var(--brand-grey);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.card--dark::after {
    content: '';
    position: absolute;
    bottom: -30px;
    inset-inline-end: -30px;
    width: 100px;
    height: 100px;
    background: rgba(92, 192, 235, 0.1);
    transform: rotate(45deg);
    pointer-events: none;
}

.card--dark::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 3px;
    background: var(--brand-primary);
}

/* ── Stat Cards ──────────────────────────────────────────────────── */
.stat-card {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 1.125rem;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    /* Top accent bar — brand primary */
    border: 1px solid var(--brand-stripe);
    border-top: 3px solid var(--brand-primary);
    position: relative;
    overflow: hidden;
    transition: border-top-color 0.14s ease, transform 0.14s ease;
}

/* E-stripe subtle texture overlay */
.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent            0px,
        transparent            7px,
        rgba(0,119,204,0.025) 7px,
        rgba(0,119,204,0.025) 8px
    );
    pointer-events: none;
}

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

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: background 0.14s ease, color 0.14s ease;
}

.stat-card:hover .stat-icon.primary { background: var(--brand-primary); color: #fff; }

.stat-icon.primary   { background: var(--color-primary-bg);         color: var(--brand-primary); }
.stat-icon.success   { background: var(--color-success-light);       color: var(--color-success-dark); }
.stat-icon.warning   { background: var(--color-warning-light);       color: var(--color-warning-dark); }
.stat-icon.danger    { background: var(--color-danger-light);        color: var(--color-danger-dark); }
.stat-icon.secondary { background: rgba(92,192,235,0.14);             color: var(--brand-accent); }

.stat-body  { flex: 1; min-width: 0; position: relative; z-index: 1; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--brand-text); line-height: 1; }
.stat-label {
    font-size: 0.7rem;
    color: var(--color-gray-500);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.stat-change { font-size: 0.73rem; margin-top: 0.3rem; font-weight: 600; }
.stat-change.up   { color: var(--color-success-dark); }
.stat-change.down { color: var(--color-danger-dark); }

/* ═══════════════════════════════════════════════════════════════════════
   BADGES — Geometric (not pill) to match logo's block-letter style
═══════════════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);   /* Sharp corners — geometric */
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
}

.badge-primary   { background: var(--color-primary-bg);        color: var(--brand-primary-dark); }
.badge-success   { background: var(--color-success-light);     color: var(--color-success-dark); }
.badge-warning   { background: var(--color-warning-light);     color: var(--color-warning-dark); }
.badge-danger    { background: var(--color-danger-light);      color: var(--color-danger-dark); }
.badge-secondary { background: var(--brand-stripe);            color: var(--brand-grey); }
.badge-info      { background: rgba(92,192,235,0.15);           color: var(--brand-primary-dark); }

/* ═══════════════════════════════════════════════════════════════════════
   BUTTONS
   Primary: solid --brand-primary, bold.
   Secondary: --brand-grey border.
   Hover: scale(1.02) + color shift. No heavy shadows.
═══════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9375rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.12s ease, background 0.14s ease,
                border-color 0.14s ease, color 0.14s ease;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.btn:hover  { transform: scale(1.02); }
.btn:active { transform: scale(0.98); }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Primary — solid brand blue */
.btn-primary       { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-dark); }

/* Secondary — accent blue */
.btn-secondary       { background: var(--brand-accent); color: #fff; }
.btn-secondary:hover { background: #3BADD6; }

/* Success */
.btn-success       { background: var(--color-success); color: #fff; }
.btn-success:hover { background: var(--color-success-dark); }

/* Warning */
.btn-warning       { background: var(--color-warning); color: #fff; }
.btn-warning:hover { background: var(--color-warning-dark); }

/* Danger */
.btn-danger       { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: var(--color-danger-dark); }

/* Ghost — charcoal border, no fill */
.btn-ghost {
    background: transparent;
    color: var(--brand-grey);
    border: 1.5px solid var(--brand-stripe);
}
.btn-ghost:hover {
    background: var(--color-gray-50);
    border-color: var(--brand-grey-mid);
    color: var(--brand-text);
}

.btn-sm   { padding: 0.325rem 0.6875rem; font-size: 0.8rem; }
.btn-lg   { padding: 0.625rem 1.25rem;   font-size: 0.9375rem; }
.btn-icon { padding: 0.46rem; aspect-ratio: 1; justify-content: center; }

/* ═══════════════════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 1.125rem; }

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.775rem;
    font-weight: 700;
    color: var(--brand-grey);
    text-transform: uppercase;
    letter-spacing: 0.045em;
}

.form-control {
    width: 100%;
    padding: 0.55rem 0.875rem;
    border: 1.5px solid var(--brand-stripe);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--brand-text);
    background: var(--color-white);
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.11);
}

.form-control.is-invalid { border-color: var(--color-danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.11); }

.invalid-feedback {
    color: var(--color-danger);
    font-size: 0.775rem;
    margin-top: 0.25rem;
    font-weight: 600;
}

select.form-control    { cursor: pointer; }
textarea.form-control  { resize: vertical; min-height: 88px; }

/* ═══════════════════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    background: var(--color-gray-50);
    padding: 0.625rem 1rem;
    text-align: start;
    font-weight: 700;
    color: var(--brand-grey);
    font-size: 0.695rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    /* Brand accent underline on header */
    border-bottom: 2px solid var(--brand-primary);
}

.table td {
    padding: 0.8125rem 1rem;
    border-bottom: 1px solid var(--brand-stripe);
    color: var(--brand-grey);
    vertical-align: middle;
}

.table tbody tr:hover { background: rgba(0, 119, 204, 0.025); }

/* ═══════════════════════════════════════════════════════════════════════
   ALERTS — Left/right accent bar replaces full border
═══════════════════════════════════════════════════════════════════════ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-inline-start: 4px solid;
}

.alert-success { background: var(--color-success-bg); border-color: var(--color-success);  color: var(--color-success-dark); }
.alert-warning { background: var(--color-warning-bg); border-color: var(--color-warning);  color: var(--color-warning-dark); }
.alert-danger  { background: var(--color-danger-bg);  border-color: var(--color-danger);   color: var(--color-danger-dark); }
.alert-info    { background: rgba(0,119,204,0.06);    border-color: var(--brand-primary);  color: var(--brand-primary-dark); }

/* ═══════════════════════════════════════════════════════════════════════
   AVATAR
═══════════════════════════════════════════════════════════════════════ */
.avatar    { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 52px; height: 52px; }
.avatar-xl { width: 80px; height: 80px; }

/* ═══════════════════════════════════════════════════════════════════════
   QR CODE CONTAINER — Modular-Layered motif
   Top bar = brand primary. Corner diamond = accent blue.
═══════════════════════════════════════════════════════════════════════ */
.qr-container {
    background: var(--color-white);
    border: 2px solid var(--brand-stripe);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

/* Top brand bar */
.qr-container::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 4px;
    background: var(--brand-primary);
}

/* Bottom-corner layered accent diamond */
.qr-container::after {
    content: '';
    position: absolute;
    bottom: -20px;
    inset-inline-end: -20px;
    width: 60px;
    height: 60px;
    background: var(--brand-accent-dim);
    transform: rotate(45deg);
    pointer-events: none;
}

.qr-container img { width: 200px; height: 200px; }

/* ═══════════════════════════════════════════════════════════════════════
   GAMIFICATION — Streak & Points

   STREAK: flat amber block — no gradient
   POINTS: dark charcoal block + V-triangle (upward chevron)
           representing the 'V' in EDUVERSE
═══════════════════════════════════════════════════════════════════════ */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--color-warning);   /* flat amber — no gradient */
    color: #fff;
    padding: 0.375rem 0.8125rem;
    border-radius: var(--radius-sm);    /* geometric, not pill */
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

.streak-flame { font-size: 1.1rem; animation: flame-pulse 1.5s ease-in-out infinite; }

@keyframes flame-pulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50%       { transform: scale(1.18) rotate(-5deg); }
}

/* Points badge — charcoal block with V-triangle indicator */
.points-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--brand-grey-dark);  /* flat charcoal */
    color: #fff;
    padding: 0.375rem 0.8125rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
}

/* V-Triangle: upward-pointing — accent blue. Represents the 'V' in EDUVERSE. */
.points-badge::before {
    content: '';
    display: inline-block;
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-inline-start: 5px solid transparent;
    border-inline-end:   5px solid transparent;
    border-bottom: 9px solid var(--brand-accent);
}

/* ── Progress Bar — E-Stripe Pattern ─────────────────────────────────
   The progress fill uses repeating brand+accent stripes,
   mirroring the horizontal lines in the 'E' of EDUVERSE.
────────────────────────────────────────────────────────────────────── */
.progress-bar-wrap {
    height: 8px;
    background: var(--brand-stripe);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--brand-primary) 0px,
        var(--brand-primary) 10px,
        var(--brand-accent)  10px,
        var(--brand-accent)  12px
    );
    transition: width 0.4s ease;
}

/* ═══════════════════════════════════════════════════════════════════════
   SESSION LIVE DOT
═══════════════════════════════════════════════════════════════════════ */
.session-live-dot {
    width: 8px;
    height: 8px;
    background: var(--color-success);
    border-radius: 50%;
    display: inline-block;
    animation: live-pulse 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.35; transform: scale(1.7); }
}

/* ═══════════════════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    list-style: none;
    flex-wrap: wrap;
}

.page-link {
    padding: 0.375rem 0.6875rem;
    border: 1.5px solid var(--brand-stripe);
    border-radius: var(--radius-sm);
    color: var(--brand-grey);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
}

.page-link:hover {
    background: var(--color-primary-bg);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.page-item.active .page-link {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.page-item.disabled .page-link {
    opacity: 0.38;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   SKELETON LOADING
═══════════════════════════════════════════════════════════════════════ */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--brand-stripe) 25%,
        #EBEBEB 50%,
        var(--brand-stripe) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.4s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
}

.empty-state-icon  { font-size: 2.25rem; margin-bottom: 1rem; opacity: 0.35; }
.empty-state-title { font-size: 1rem; font-weight: 700; color: var(--brand-grey); margin-bottom: 0.4rem; }
.empty-state-text  { font-size: 0.875rem; color: var(--color-gray-400); margin-bottom: 1.25rem; }

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile
═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);   /* RTL: slides off right */
        width: var(--sidebar-width) !important; /* always full on mobile */
    }
    [dir="ltr"] .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    /* Hide collapsed state on mobile — use overlay instead */
    .sidebar.collapsed { width: var(--sidebar-width) !important; }
    .sidebar.collapsed .sidebar-logo-text,
    .sidebar.collapsed .sidebar-logo-sub,
    .sidebar.collapsed .nav-item-label,
    .sidebar.collapsed .nav-section-title,
    .sidebar.collapsed .sidebar-user-footer > div,
    .sidebar.collapsed .sidebar-user-footer > a { display: revert !important; }
    .sidebar.collapsed .nav-item { justify-content: flex-start; padding: revert; }

    [dir="ltr"] .main-content { margin-left: 0 !important; }
    [dir="rtl"] .main-content { margin-right: 0 !important; }

    .page-content { padding: 0.875rem 1rem; }
    .stat-value   { font-size: 1.5rem; }

    /* On mobile, QR is the hero — full width, centered */
    .qr-container {
        width: 100%;
        align-items: center;
    }
    .qr-container img { width: 160px; height: 160px; }
}

/* ── Mobile sidebar overlay ──────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }

/* ═══════════════════════════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════════════════════════ */
@media print {
    .sidebar, .topbar, .sidebar-overlay, .no-print { display: none !important; }

    /* Break the flex layout so content isn't clipped to viewport height */
    .layout-wrapper {
        display: block !important;
        min-height: 0 !important;
    }
    .main-content {
        display: block !important;
        margin: 0 !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    .page-content {
        padding: 0 !important;
        overflow: visible !important;
    }
    .card { border: 1px solid #ccc; box-shadow: none !important; }
    .table-wrapper { overflow: visible !important; }
}
