/* ============================================================
   CLASSROOM STAR — Main Design System
   Theme: Dark mode premium with gold accent
   ============================================================ */

/* ── CSS Custom Properties (Design Tokens) ──────────────── */
:root {
    /* Colors — Primary Palette */
    --clr-bg-primary:    #0d0f1a;
    --clr-bg-secondary:  #131628;
    --clr-bg-tertiary:   #1a1d35;
    --clr-bg-card:       #1e2240;
    --clr-bg-card-hover: #252a4a;
    --clr-bg-input:      #181b30;
    --clr-bg-sidebar:    #10122a;

    /* Accent — Gold/Star theme */
    --clr-gold-100: #fff8e1;
    --clr-gold-300: #ffd54f;
    --clr-gold-400: #ffca28;
    --clr-gold-500: #ffc107;
    --clr-gold-600: #ffb300;
    --clr-gold-700: #ff8f00;

    /* Accent — Purple (secondary) */
    --clr-purple-400: #9c6dff;
    --clr-purple-500: #7c4dff;
    --clr-purple-600: #6200ea;

    /* Accent — Blue */
    --clr-blue-400:  #448aff;
    --clr-blue-500:  #2979ff;

    /* Status colors */
    --clr-success:  #00e676;
    --clr-warning:  #ffea00;
    --clr-danger:   #ff5252;
    --clr-info:     #40c4ff;

    /* Text */
    --clr-text-primary:   #eef0ff;
    --clr-text-secondary: #9ba3c9;
    --clr-text-muted:     #5a6080;
    --clr-text-inverse:   #0d0f1a;

    /* Borders */
    --clr-border:       rgba(255, 255, 255, 0.08);
    --clr-border-focus: var(--clr-gold-500);

    /* Gradients */
    --grad-gold:    linear-gradient(135deg, #ffc107 0%, #ff8f00 100%);
    --grad-purple:  linear-gradient(135deg, #9c6dff 0%, #6200ea 100%);
    --grad-hero:    linear-gradient(135deg, #1a1d35 0%, #0d0f1a 50%, #1a0d35 100%);
    --grad-card:    linear-gradient(145deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.01) 100%);
    --grad-sidebar: linear-gradient(180deg, #10122a 0%, #0d0f1a 100%);

    /* Shadows */
    --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md:     0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg:     0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-gold:   0 0 30px rgba(255, 193, 7, 0.2);
    --shadow-purple: 0 0 30px rgba(124, 77, 255, 0.25);
    --shadow-card:   0 4px 20px rgba(0, 0, 0, 0.35);

    /* Spacing scale */
    --space-1:  0.25rem;    /* 4px */
    --space-2:  0.5rem;     /* 8px */
    --space-3:  0.75rem;    /* 12px */
    --space-4:  1rem;       /* 16px */
    --space-5:  1.25rem;    /* 20px */
    --space-6:  1.5rem;     /* 24px */
    --space-7:  1.75rem;    /* 28px */
    --space-8:  2rem;       /* 32px */
    --space-10: 2.5rem;     /* 40px */
    --space-12: 3rem;       /* 48px */
    --space-16: 4rem;       /* 64px */

    /* Typography */
    --font-base:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fs-xs:   0.6875rem;   /* 11px */
    --fs-sm:   0.8125rem;   /* 13px */
    --fs-base: 0.9375rem;   /* 15px */
    --fs-md:   1.0625rem;   /* 17px */
    --fs-lg:   1.25rem;     /* 20px */
    --fs-xl:   1.5rem;      /* 24px */
    --fs-2xl:  1.875rem;    /* 30px */
    --fs-3xl:  2.25rem;     /* 36px */
    --fs-4xl:  3rem;        /* 48px */

    /* Border radius */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast:   all 0.15s ease;
    --transition-base:   all 0.25s ease;
    --transition-slow:   all 0.4s ease;

    /* Layout */
    --sidebar-width:     260px;
    --sidebar-collapsed: 72px;
    --header-height:     64px;
    --content-max-width: 1280px;
}

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

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

body {
    font-family: var(--font-base);
    font-size: var(--fs-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--clr-text-primary);
    background-color: var(--clr-bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--clr-bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--clr-bg-card-hover); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--clr-text-muted); }

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--clr-text-primary);
    letter-spacing: -0.02em;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 { font-size: var(--fs-base); }

p { color: var(--clr-text-secondary); line-height: 1.7; }

a {
    color: var(--clr-gold-400);
    text-decoration: none;
    transition: var(--transition-fast);
}
a:hover { color: var(--clr-gold-300); }

img { display: block; max-width: 100%; }

/* ── Selection ───────────────────────────────────────────── */
::selection {
    background: rgba(255, 193, 7, 0.3);
    color: var(--clr-text-primary);
}

/* ── Focus visible ───────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--clr-gold-500);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* ── Utility: Visually hidden ────────────────────────────── */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    50%       { box-shadow: 0 0 0 12px rgba(255, 193, 7, 0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}
@keyframes starPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.animate-fade-in     { animation: fadeIn 0.4s ease both; }
.animate-slide-left  { animation: slideInLeft 0.4s ease both; }
.animate-float       { animation: float 3s ease-in-out infinite; }
.animate-star-pop    { animation: starPop 0.3s ease; }

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: var(--clr-gold-500);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

/* ── Skeleton loader ─────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg,
        var(--clr-bg-card) 25%,
        var(--clr-bg-card-hover) 50%,
        var(--clr-bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* ── Star display ────────────────────────────────────────── */
.star-icon { color: var(--clr-gold-400); }
.star-count {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-weight: 700;
    color: var(--clr-gold-400);
}
.star-count .star-icon { font-size: 1.1em; }

/* ── Badge / Pill ────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.badge-gold    { background: rgba(255,193,7,0.15); color: var(--clr-gold-400); border: 1px solid rgba(255,193,7,0.25); }
.badge-purple  { background: rgba(124,77,255,0.15); color: var(--clr-purple-400); border: 1px solid rgba(124,77,255,0.25); }
.badge-blue    { background: rgba(41,121,255,0.15); color: var(--clr-blue-400); border: 1px solid rgba(41,121,255,0.25); }
.badge-success { background: rgba(0,230,118,0.12); color: var(--clr-success); border: 1px solid rgba(0,230,118,0.2); }
.badge-danger  { background: rgba(255,82,82,0.12); color: var(--clr-danger); border: 1px solid rgba(255,82,82,0.2); }
.badge-muted   { background: rgba(255,255,255,0.07); color: var(--clr-text-secondary); border: 1px solid var(--clr-border); }

/* Role badges */
.role-admin   { background: rgba(255,193,7,0.15);  color: var(--clr-gold-400);   border: 1px solid rgba(255,193,7,0.3); }
.role-teacher { background: rgba(124,77,255,0.15); color: var(--clr-purple-400); border: 1px solid rgba(124,77,255,0.3); }
.role-student { background: rgba(41,121,255,0.15); color: var(--clr-blue-400);   border: 1px solid rgba(41,121,255,0.3); }

/* ── Avatar ──────────────────────────────────────────────── */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    background: var(--grad-purple);
    color: #fff;
}
.avatar-sm  { width: 32px; height: 32px; font-size: var(--fs-xs); }
.avatar-md  { width: 40px; height: 40px; font-size: var(--fs-sm); }
.avatar-lg  { width: 56px; height: 56px; font-size: var(--fs-md); }
.avatar-xl  { width: 80px; height: 80px; font-size: var(--fs-xl); }
.avatar-gold   { background: var(--grad-gold); color: var(--clr-text-inverse); }
.avatar-purple { background: var(--grad-purple); }

/* ── Rank colors ─────────────────────────────────────────── */
.rank-1st { color: #ffd700; }   /* Gold */
.rank-2nd { color: #c0c0c0; }   /* Silver */
.rank-3rd { color: #cd7f32; }   /* Bronze */
