/*
 * Cross-document View Transitions: opts every normal navigation AND every
 * location.reload() (used by flashAndReload() after almost every action)
 * into a smooth native crossfade between the old and new page, instead of
 * the browser's default hard white flash in between. Zero JS changes needed
 * - this is a full-page-reload app by design (no build step/SPA framework),
 * so this is the actual fix for "blinking" rather than rewriting every
 * action into a partial AJAX update. Chromium-based browsers only for now
 * (Chrome/Edge 111+) - unsupported browsers just ignore this rule entirely
 * and keep behaving exactly as before, so there's no downside either way.
 */
@view-transition {
    navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.18s;
    animation-timing-function: ease-out;
}

/*
 * Branded full-page loading overlay - see #pageLoadingOverlay in
 * includes/header.php. Visible by default (covers this page's own initial
 * paint), faded to invisible on ready via .hide, and un-hidden again right
 * before any navigation/reload so the transition above always has this to
 * crossfade FROM/TO instead of a blank frame.
 */
.page-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg);
    opacity: 1;
    transition: opacity 0.25s ease;
}
.page-loading-overlay.hide {
    opacity: 0;
    pointer-events: none;
}
.page-loading-spinner {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.page-loading-ring {
    position: absolute;
    inset: 0;
    border: 4px solid rgba(79,70,229,0.15);
    border-top-color: var(--brand-primary, #4f46e5);
    border-radius: 50%;
    animation: page-loading-spin 0.85s linear infinite;
}
.page-loading-spinner i {
    font-size: 1.6rem;
    color: var(--brand-primary, #4f46e5);
}
.page-loading-text {
    font-weight: 600;
    color: var(--brand-primary, #4f46e5);
    letter-spacing: 0.5px;
    animation: page-loading-pulse 1.4s ease-in-out infinite;
}
@keyframes page-loading-spin {
    to { transform: rotate(360deg); }
}
@keyframes page-loading-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

:root {
    --brand-primary: #4f46e5;
    --brand-primary-dark: #3730a3;
    --brand-accent: #06b6d4;
    --brand-gold: #d4a017;
    --brand-diamond: #0dcaf0;
    --surface: #ffffff;
    --bg: #f4f6fb;
    --radius: 14px;
}

html {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg);
    animation: fadeIn 0.4s ease;
}

/* Pushes the footer to the bottom of the viewport on short pages, without pinning
   it in place - it still scrolls normally with the page once content is tall.
   .page-content grows to fill the exact leftover space (no vh guesswork), so the
   footer sits right after it - which lands flush at the bottom on short pages,
   and just below the content as usual once a page is taller than the viewport. */
.page-content {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.site-footer {
    margin-top: auto;
    flex-shrink: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Navbar */
.navbar {
    background: linear-gradient(90deg, var(--brand-primary-dark), var(--brand-primary)) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.25s ease;
}

.admin-portal .navbar {
    background: linear-gradient(90deg, #111827, #1f2937) !important;
}

.navbar.navbar-scrolled {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: transform 0.2s ease;
}

.navbar-brand-auth {
    font-size: 1.5rem;
    padding: 0.25rem 0;
}

@media (max-width: 480px) {
    .navbar-brand-auth { font-size: 1.1rem; }
    .navbar .position-absolute.start-0 span,
    .navbar .position-absolute.start-0 { font-size: 0; padding: 0.4rem 0.55rem; }
    .navbar .position-absolute.start-0 i { font-size: 1rem; }
}

.navbar-brand:hover {
    transform: scale(1.03);
}

.nav-link {
    position: relative;
    transition: color 0.2s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 2px;
    width: 0;
    height: 2px;
    background: #fff;
    transition: width 0.25s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: fadeUp 0.35s ease both;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(17, 24, 39, 0.12);
}

.card .card-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Stagger card animation for grids */
.row.g-3 > [class*="col-"]:nth-child(1) .card { animation-delay: 0.02s; }
.row.g-3 > [class*="col-"]:nth-child(2) .card { animation-delay: 0.06s; }
.row.g-3 > [class*="col-"]:nth-child(3) .card { animation-delay: 0.1s; }
.row.g-3 > [class*="col-"]:nth-child(4) .card { animation-delay: 0.14s; }
.row.g-3 > [class*="col-"]:nth-child(5) .card { animation-delay: 0.18s; }
.row.g-3 > [class*="col-"]:nth-child(6) .card { animation-delay: 0.22s; }

/* Buttons */
.btn {
    border-radius: 8px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
    border: none;
}

.btn-primary:hover {
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
}

.btn-dark {
    background: linear-gradient(90deg, #111827, #374151);
    border: none;
}

/* Tier badges */
/* Fallback for any admin-added tier beyond the original three (no !important,
   so the specific silver/gold/diamond overrides below still win for those). */
.tier-badge { background: #4f46e5; color: #fff; }
.tier-badge-silver { background-color: #adb5bd !important; }
.tier-badge-gold { background: linear-gradient(90deg, #d4a017, #f0c14b) !important; color: #3b2e00 !important; }
.tier-badge-diamond { background: linear-gradient(90deg, #0dcaf0, #66e0ff) !important; color: #063a45 !important; }

.badge {
    border-radius: 6px;
    letter-spacing: 0.2px;
}

/* Video embeds */
.video-embed-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.video-embed-wrapper iframe,
.video-embed-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

.video-open-link {
    font-size: 0.8rem;
}

.level-section h5 {
    display: inline-block;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 6px;
    margin-bottom: 1rem;
}

.watched-badge {
    cursor: pointer;
}

/* Auth pages */
body.auth-page {
    background: radial-gradient(circle at top left, #6366f1, #1e1b4b 65%);
    min-height: 100vh;
}

.auth-wrap {
    position: relative;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.auth-wrap .floating-shapes,
.auth-wrap .floating-icon {
    position: absolute;
}

.auth-wrap .auth-card {
    position: relative;
    z-index: 2;
    margin: 0;
}

.auth-card {
    max-width: 420px;
    margin: 48px auto;
    border-radius: var(--radius);
    animation: fadeUp 0.45s ease both;
}

.auth-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
    font-size: 1.6rem;
    margin: -52px auto 16px;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.password-toggle-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.password-toggle-btn .icon-eye-off {
    display: none;
}

.password-toggle-btn.is-showing .icon-eye {
    display: none;
}

.password-toggle-btn.is-showing .icon-eye-off {
    display: inline;
}

/* Landing page */
.landing-hero {
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 20% 20%, #4f46e5, #0f172a 70%);
    background-size: 200% 200%;
    animation: heroDrift 12s ease infinite;
    color: #fff;
    border-radius: var(--radius);
    padding: 4rem 1.5rem;
    margin-top: 1rem;
}

.landing-hero .hero-content {
    position: relative;
    z-index: 2;
}

/* Floating decorative shapes/icons - purely cosmetic, ignore clicks */
.floating-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.floating-shapes .shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    filter: blur(2px);
    animation: floatDrift ease-in-out infinite alternate;
}

.floating-shapes .shape-1 { width: 90px; height: 90px; top: 12%; left: 8%; animation-duration: 9s; }
.floating-shapes .shape-2 { width: 50px; height: 50px; top: 65%; left: 18%; animation-duration: 7s; animation-delay: 0.6s; background: rgba(6, 182, 212, 0.18); }
.floating-shapes .shape-3 { width: 130px; height: 130px; top: 20%; right: 10%; animation-duration: 11s; animation-delay: 1.2s; }
.floating-shapes .shape-4 { width: 60px; height: 60px; top: 70%; right: 16%; animation-duration: 8s; animation-delay: 0.3s; background: rgba(212, 160, 23, 0.18); }
.floating-shapes .shape-5 { width: 36px; height: 36px; top: 40%; left: 46%; animation-duration: 6s; animation-delay: 0.9s; }

@keyframes floatDrift {
    from { transform: translate(0, 0) rotate(0deg); }
    to { transform: translate(18px, -26px) rotate(12deg); }
}

.floating-icon {
    position: absolute;
    color: rgba(255, 255, 255, 0.35);
    animation: floatDrift ease-in-out infinite alternate;
    pointer-events: none;
}

.floating-icon.fi-1 { top: 18%; left: 14%; font-size: 1.8rem; animation-duration: 8s; }
.floating-icon.fi-2 { top: 60%; left: 6%; font-size: 1.3rem; animation-duration: 6.5s; animation-delay: 0.4s; }
.floating-icon.fi-3 { top: 24%; right: 14%; font-size: 2rem; animation-duration: 10s; animation-delay: 0.8s; }
.floating-icon.fi-4 { top: 66%; right: 8%; font-size: 1.4rem; animation-duration: 7.5s; animation-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
    .floating-shapes .shape,
    .floating-icon,
    .landing-hero {
        animation: none !important;
    }
}

@keyframes heroDrift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.landing-hero h1 {
    font-weight: 800;
    animation: fadeUp 0.6s ease both;
}

.landing-hero p.lead {
    animation: fadeUp 0.6s ease 0.1s both;
}

.landing-hero .cta-group {
    animation: fadeUp 0.6s ease 0.2s both;
}

.landing-hero .btn {
    padding: 0.75rem 1.75rem;
}

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 12px;
    transition: transform 0.25s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.1) rotate(-4deg);
}

.stats-strip {
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.06);
    padding: 1.5rem;
    margin-top: -2.5rem;
    position: relative;
    z-index: 2;
}

.stats-strip .stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-primary);
}

/* Progress bars */
.progress {
    height: 8px;
    border-radius: 999px;
    background-color: #e9ecef;
}

.progress-bar {
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
}

/* Search boxes */
.search-box {
    position: relative;
    max-width: 320px;
}

.search-box .bi-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-box input {
    padding-left: 36px;
}

.global-search-box {
    max-width: none;
}

.global-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    margin-top: 4px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-height: 360px;
    overflow-y: auto;
}

.global-search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.global-search-result-item:last-child {
    border-bottom: none;
}

.global-search-result-item:hover {
    background: rgba(0,0,0,0.04);
}

[data-theme="dark"] .global-search-results {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .global-search-result-item:hover {
    background: rgba(255,255,255,0.06);
}

@keyframes searchHighlightPulse {
    0%, 100% { background-color: transparent; }
    25%, 75% { background-color: rgba(255, 193, 7, 0.35); }
}

.search-highlight {
    animation: searchHighlightPulse 2.5s ease;
}

/* Admin dashboard stat tiles */
.stat-tile {
    border-left: 4px solid var(--brand-primary);
}

.stat-tile.stat-warning { border-left-color: #f59e0b; }
.stat-tile.stat-success { border-left-color: #10b981; }
.stat-tile.stat-info { border-left-color: #0dcaf0; }

.stat-tile .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Footer */
.site-footer {
    background: #111827;
    color: #d1d5db;
}

.site-footer .nav-link {
    color: #d1d5db;
}

.site-footer .nav-link:hover {
    color: #fff;
}

/* Scroll-reveal utility (JS toggles .in-view) */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Table polish */
.table {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
}

.table thead {
    background-color: #f8f9fc;
}

/* Modal polish */
.modal-content {
    border-radius: var(--radius);
    border: none;
}

@media (max-width: 576px) {
    .landing-hero h1 { font-size: 2rem; }
    .auth-card { margin: 24px 12px; }
}

/* Dark mode - toggled via [data-theme="dark"] on <html>, persisted in localStorage */
[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
}

[data-theme="dark"] body {
    background-color: var(--bg);
    color: #e2e8f0;
}

[data-theme="dark"] .card,
[data-theme="dark"] .table,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .list-group-item {
    background-color: var(--surface);
    color: #e2e8f0;
}

[data-theme="dark"] .table thead {
    background-color: #16213a;
    color: #e2e8f0;
}

[data-theme="dark"] .card .card-footer,
[data-theme="dark"] .card .card-header {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}

[data-theme="dark"] .form-control::placeholder {
    color: #64748b;
}

[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

[data-theme="dark"] .site-footer {
    background: #05070d;
}

[data-theme="dark"] .search-box input {
    background-color: #0f172a;
    color: #e2e8f0;
}

[data-theme="dark"] .stats-strip,
[data-theme="dark"] .feature-card {
    background-color: var(--surface) !important;
}

/* Buttons/links frozen while a delete/removal request is pending approval. */
.btn:disabled,
.dropdown-item.disabled {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    color: #6c757d !important;
    opacity: 0.75;
    cursor: not-allowed;
}

/* ============================
   Admin vertical sidebar layout
   ============================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #0f172a;
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    scrollbar-color: #000000 #0f172a;
    scrollbar-width: thin;
}

.admin-sidebar::-webkit-scrollbar {
    width: 8px;
}

.admin-sidebar::-webkit-scrollbar-track {
    background: #0f172a;
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: #000000;
    border-radius: 4px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: #1e293b;
}

.admin-sidebar-brand {
    display: block;
    padding: 18px 20px;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-sidebar-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #4f46e5;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.admin-identity-text {
    min-width: 0;
}

.admin-identity-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-identity-email {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.admin-sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
    scrollbar-color: #000000 #0f172a; /* Firefox: thumb, track - matches the sidebar's own dark background */
    scrollbar-width: thin;
}

.admin-sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.admin-sidebar-nav::-webkit-scrollbar-track {
    background: #0f172a;
}

.admin-sidebar-nav::-webkit-scrollbar-thumb {
    background: #000000;
    border-radius: 4px;
}

.admin-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #1e293b;
}

.admin-sidebar-nav-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Hover-to-auto-scroll arrows above/below a long sidebar nav list - blink via
   CSS animation, only shown (see .visible, toggled by initSidebarAutoScroll()
   in header.php) when there's actually more content in that direction. */
.sidebar-scroll-arrow {
    position: absolute;
    left: 0;
    right: 0;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sidebar-scroll-arrow.visible {
    opacity: 1;
    pointer-events: auto;
    animation: sidebarArrowBlink 1.2s infinite;
}

.sidebar-scroll-arrow-up {
    top: 0;
    background: linear-gradient(to bottom, #0f172a 40%, transparent);
}

.sidebar-scroll-arrow-down {
    bottom: 0;
    background: linear-gradient(to top, #0f172a 40%, transparent);
}

@keyframes sidebarArrowBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

/* "Explore all options" floating draggable launcher - see initAppLauncherFab()
   in header.php. Default position (bottom-right) is overridden with left/top
   once the user drags it; the fan items it spawns are plain fixed-position
   elements appended to <body>, not children of this container. */
.app-launcher-fab {
    position: fixed;
    right: 24px;
    bottom: 90px;
    z-index: 1050;
}

.app-launcher-fab-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    font-size: 1.4rem;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
    cursor: grab;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-launcher-fab-btn:hover {
    box-shadow: 0 8px 26px rgba(79, 70, 229, 0.6);
    transform: scale(1.05);
}

.app-launcher-fab-btn:active {
    cursor: grabbing;
    transform: scale(0.94);
}

.app-launcher-fab-hide {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #ef4444;
    color: #fff;
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 2;
    padding: 0;
}

.app-launcher-fab:hover .app-launcher-fab-hide {
    opacity: 1;
}

.app-launcher-fab-restore {
    position: fixed;
    right: 0;
    bottom: 110px;
    width: 26px;
    height: 46px;
    border-radius: 10px 0 0 10px;
    border: none;
    background: rgba(79, 70, 229, 0.85);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    z-index: 1050;
    box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.2);
}

.app-launcher-fab-restore:hover {
    background: #4f46e5;
}

/* Fan-out items - spawned at the FAB's own center (see openFan() in
   header.php) then transitioned out to their arc position with a springy
   overshoot easing, staggered a few ms apart per item for a "burst" feel.
   Each is an icon circle plus a visible label underneath (not just a hover
   tooltip), laid out full-circle around the button with radius scaled to the
   item count so nothing overlaps. */
.app-launcher-fan-item {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 72px;
    text-decoration: none;
    z-index: 1049;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
    transition: left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Category bubbles (level 1 of the launcher) are <button> elements since they
   drill into a sub-fan instead of navigating - strip the browser's default
   button chrome so they look identical to the <a> page bubbles (harmless on
   the <a> bubbles too, which have no such chrome to begin with). */
.app-launcher-fan-item {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.app-launcher-fan-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--surface, #fff);
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 6px 16px rgba(30, 27, 75, 0.35);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.app-launcher-fan-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #fff;
    background: rgba(15, 23, 42, 0.85);
    padding: 2px 8px;
    border-radius: 6px;
    text-align: center;
    line-height: 1.3;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-launcher-fan-item:hover .app-launcher-fan-icon {
    background: #4f46e5;
    color: #fff;
    transform: scale(1.15);
}

.app-launcher-fan-item:hover {
    z-index: 1051;
}

.app-launcher-fan-item:hover .app-launcher-fan-label {
    white-space: normal;
}

/* Dims the page behind the fan so the labeled icons read clearly regardless
   of light/dark mode or whatever content is underneath - toggled by
   openFan()/closeFan() in header.php. */
.app-launcher-fan-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1048;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.app-launcher-fan-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.admin-sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: #cbd5e1;
    font-size: 0.92rem;
    border-left: 3px solid transparent;
}

.admin-sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.admin-sidebar-nav .nav-link.active {
    background: rgba(79,70,229,0.18);
    color: #fff;
    border-left-color: #4f46e5;
    font-weight: 600;
}

.admin-sidebar-section {
    padding: 14px 20px 6px;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #64748b;
}

.admin-sidebar-section-privileged {
    color: #d4a017;
}

.admin-sidebar-footer {
    display: flex;
    gap: 6px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.admin-main {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.admin-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.admin-main .page-content {
    padding: 24px;
    flex: 1;
}

.admin-inline-footer {
    padding: 14px 24px;
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1020;
}

/* Below the desktop breakpoint, the sidebar becomes an off-screen slide-out drawer -
   toggled by adding .sidebar-open to <body> (see initSidebarToggle() in header.php). */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-main {
        margin-left: 0;
    }
    body.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }
    body.sidebar-open .sidebar-backdrop {
        display: block;
    }
}

[data-theme="dark"] .admin-topbar {
    background: var(--surface);
    border-bottom-color: rgba(255,255,255,0.06);
}

/* Small unread-count pill on a sidebar nav item (e.g. "Registration Requests 3") -
   see get_admin_pending_request_counts() in functions.php. */
.admin-sidebar-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 7px;
    border-radius: 999px;
    flex-shrink: 0;
}

/* Desktop collapse-to-icons mode (distinct from the mobile slide-out drawer
   above) - toggled by #sidebarCollapseToggle, see initSidebarCollapseToggle()
   in header.php. Narrows the sidebar to an icon rail and hides every
   .admin-sidebar-label (nav text, brand text, identity block, search box). */
@media (min-width: 992px) {
    body.admin-sidebar-collapsed .admin-sidebar {
        width: 72px;
    }
    body.admin-sidebar-collapsed .admin-main {
        margin-left: 72px;
    }
    body.admin-sidebar-collapsed .admin-sidebar-label,
    body.admin-sidebar-collapsed .admin-sidebar-identity,
    body.admin-sidebar-collapsed .global-search-box,
    body.admin-sidebar-collapsed .admin-sidebar-section,
    body.admin-sidebar-collapsed .admin-sidebar-badge {
        display: none;
    }
    body.admin-sidebar-collapsed .admin-sidebar-brand {
        text-align: center;
        padding: 18px 0;
    }
    body.admin-sidebar-collapsed .admin-sidebar-nav .nav-link {
        justify-content: center;
        padding: 10px 0;
    }
    body.admin-sidebar-collapsed .admin-sidebar-footer {
        flex-direction: column;
    }
}

/* GitHub-contribution-graph-style activity calendar (student profile + admin
   student points page) - see render_activity_heatmap_html() in functions.php. */
.activity-heatmap-months {
    display: flex;
    gap: 3px;
    overflow-x: auto;
    margin-bottom: 2px;
}

.activity-heatmap-month-label {
    width: 11px;
    flex-shrink: 0;
    font-size: 0.65rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: visible;
}

.activity-heatmap {
    display: flex;
    gap: 3px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.activity-heatmap-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.activity-heatmap-cell {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    background: #ebedf0;
}

.activity-heatmap-empty {
    background: transparent;
}

.activity-heatmap-level-1 { background: #9be9a8; }
.activity-heatmap-level-2 { background: #40c463; }
.activity-heatmap-level-3 { background: #30a14e; }
.activity-heatmap-level-4 { background: #216e39; }

[data-theme="dark"] .activity-heatmap-cell { background: #2d333b; }
[data-theme="dark"] .activity-heatmap-level-1 { background: #0e4429; }
[data-theme="dark"] .activity-heatmap-level-2 { background: #006d32; }
[data-theme="dark"] .activity-heatmap-level-3 { background: #26a641; }
[data-theme="dark"] .activity-heatmap-level-4 { background: #39d353; }

@keyframes btn-pulse-attention {
    0%, 100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.6); }
    50% { box-shadow: 0 0 0 8px rgba(13, 110, 253, 0); }
}
.btn-pulse-attention { animation: btn-pulse-attention 1.5s ease-in-out infinite; }
