:root {
    --brand: #4f46e5;
    --brand-2: #4338ca;
    --brand-dark: #312e81;
    --accent: #06b6d4;
    --accent-2: #8b5cf6;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --ink: #1e1b3a;
    --muted: #6b7280;
    --surface: #ffffff;
    --bg: #f4f5fb;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 3px rgba(30, 27, 58, 0.06), 0 1px 2px rgba(30, 27, 58, 0.04);
    --shadow-md: 0 4px 16px rgba(30, 27, 58, 0.08);
    --shadow-lg: 0 12px 32px rgba(30, 27, 58, 0.12);
}

* { box-sizing: border-box; }

body {
    background:
        radial-gradient(1200px 400px at 100% -10%, rgba(79, 70, 229, 0.07), transparent),
        radial-gradient(1000px 400px at -10% 0%, rgba(6, 182, 212, 0.06), transparent),
        var(--bg);
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--ink);
}

h1, h2, h3, h4, h5, h6, .brand-mark, .navbar-brand {
    font-family: 'Poppins', 'Plus Jakarta Sans', sans-serif;
}

/* ---------- Navbar ---------- */
.bg-primary-custom {
    background: linear-gradient(100deg, var(--brand) 0%, var(--accent-2) 55%, var(--brand-dark) 100%) !important;
    box-shadow: 0 2px 20px rgba(49, 46, 129, 0.25);
}
.navbar-brand { font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-mark {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.18);
    border-radius: 10px;
    font-size: 1rem;
}
.navbar-nav .nav-link {
    font-weight: 500;
    opacity: 0.92;
    border-radius: 999px;
    padding: 0.4rem 0.9rem !important;
    transition: background 0.15s ease, opacity 0.15s ease;
}
.navbar-nav .nav-link:hover { background: rgba(255,255,255,0.12); opacity: 1; }
.user-chip {
    background: rgba(255,255,255,0.15);
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.9rem;
    color: #fff;
}

/* ---------- Cards ---------- */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card-header {
    border-radius: var(--radius) var(--radius) 0 0 !important;
    font-weight: 700;
    border-bottom: 1px solid rgba(30,27,58,0.06);
}
.card.hoverable:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 600; }
.btn-brand {
    background: linear-gradient(100deg, var(--brand), var(--accent-2));
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}
.btn-brand:hover {
    filter: brightness(1.08);
    color: #fff;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}
.btn-outline-primary { border-color: var(--brand); color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }

/* ---------- Page header ---------- */
.page-hero {
    background: linear-gradient(110deg, var(--brand) 0%, var(--accent-2) 60%, var(--accent) 130%);
    border-radius: 20px;
    padding: 2rem 2.25rem;
    color: #fff;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}
.page-hero::after {
    content: "";
    position: absolute;
    right: -60px; top: -60px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(255,255,255,0.16), transparent 70%);
    border-radius: 50%;
}
.page-hero h2 { font-weight: 800; letter-spacing: -0.02em; }
.page-hero p { opacity: 0.92; margin-bottom: 0; }

/* ---------- Stat cards ---------- */
.stat-card {
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    isolation: isolate;
}
.stat-card::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(160deg, rgba(255,255,255,0.14), transparent 60%);
    z-index: -1;
}
.stat-card .stat-icon {
    width: 42px; height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
}
.stat-card .stat-value {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.1;
    font-family: 'Poppins', sans-serif;
}
.stat-card .stat-label {
    opacity: 0.9;
    font-size: 0.88rem;
    font-weight: 500;
}
.stat-grad-1 { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.stat-grad-2 { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.stat-grad-3 { background: linear-gradient(135deg, #059669, #22c55e); }
.stat-grad-4 { background: linear-gradient(135deg, #ea580c, #f59e0b); }

/* ---------- Avatars / course chips ---------- */
.avatar-circle {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.95rem;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--accent-2));
    flex-shrink: 0;
}
.course-card .avatar-circle { font-family: 'Poppins', sans-serif; }
ß
/* ---------- Progress bars ---------- */
.progress-thin { height: 6px; border-radius: 999px; background: #eef0fb; }
.progress-thin .progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--accent)); }

/* ---------- QR frame ---------- */
.qr-frame {
    background: #fff;
    padding: 1.25rem;
    border-radius: 18px;
    display: inline-block;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(30,27,58,0.05);
}

/* ---------- Check-in (public) page ---------- */
.checkin-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand), var(--accent-2) 60%, var(--accent));
    padding: 1.5rem;
}
.checkin-card {
    max-width: 420px;
    width: 100%;
    border-radius: 22px;
}

/* ---------- Badges ---------- */
.badge { border-radius: 999px; font-weight: 600; padding: 0.4em 0.8em; }
.badge-open { background-color: var(--success); }
.badge-closed { background-color: var(--danger); }

/* ---------- Tables ---------- */
table.table thead {
    background-color: #f3f2fd;
}
table.table thead th {
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    border-bottom: none;
}
table.table td, table.table th { vertical-align: middle; }

/* ---------- Empty states ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--muted);
}
.empty-state i { font-size: 2.4rem; color: #c7c9ec; margin-bottom: 0.75rem; display: block; }

/* ---------- Auth pages ---------- */
.auth-wrap {
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card { max-width: 440px; width: 100%; border-radius: 20px; }
.auth-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--brand), var(--accent-2));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 0.75rem;
}

/* ---------- Live camera capture ---------- */
.camera-frame {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 4 / 3;
    background: #111827;
    border-radius: 14px;
    overflow: hidden;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
}
.camera-frame video,
.camera-frame canvas,
.camera-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: rgba(255,255,255,0.55);
    font-size: 0.85rem;
}
.camera-placeholder i { font-size: 2rem; }

/* ---------- Student profile page ---------- */
.profile-banner {
    background: linear-gradient(110deg, var(--brand) 0%, var(--accent-2) 60%, var(--accent) 130%);
    border-radius: 20px;
    padding: 2rem 2.25rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}
.profile-banner::after {
    content: "";
    position: absolute;
    right: -60px; top: -60px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(255,255,255,0.16), transparent 70%);
    border-radius: 50%;
}
.profile-banner-inner { position: relative; z-index: 1; gap: 1rem !important; }
.profile-avatar-wrap {
    position: relative;
    flex: 0 0 clamp(76px, 11vw, 112px);
    z-index: 2;
}
.profile-avatar {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 21px;
    object-fit: cover;
    display: block;
    border: 3px solid rgba(255,255,255,0.6);
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s ease;
}
.profile-photo-hover {
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(15, 23, 42, 0.72);
    pointer-events: none;
}
.profile-avatar-wrap:hover .profile-photo-hover {
    display: flex;
}
.profile-photo-hover img {
    display: block;
    max-width: min(78vw, 760px);
    max-height: 78vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 4px solid #fff;
    border-radius: var(--radius);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}
.profile-avatar-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 2.4rem;
}
.profile-identity { min-width: 0; flex: 1 1 220px; }
.profile-eyebrow {
    color: rgba(255,255,255,0.72);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.profile-name {
    color: #fff;
    font-size: clamp(1.65rem, 3vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}
.profile-meta { color: rgba(255,255,255,0.72); }
.info-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 0.2rem;
}
.profile-info-item {
    height: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid #ececf7;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #fff 0%, #f8f8ff 100%);
}
.info-value {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--ink);
    word-break: break-word;
}

@media (max-width: 575.98px) {
    .profile-banner { padding: 1.5rem; }
    .profile-banner-inner { justify-content: flex-start; text-align: left; }
    .profile-identity { width: 100%; }
    .profile-identity .d-flex { justify-content: flex-start; }
    .profile-banner .btn { width: 100%; }
}
