/* Ported verbatim from the inline <style> block in Classguardv1/index.html <head>. */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #202124; }
::-webkit-scrollbar-thumb { background: #3c4043; border-radius: 4px; }

.nav-icon-active {
    background-color: #f1f3f4 !important;
    color: #202124 !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}
.nav-icon-active i {
    color: #202124 !important;
}

/* Google Classroom Style Collapsible Sidebar System */
.sidebar {
    width: 15rem;
    min-width: 15rem;
    max-width: 15rem;
    transition: width 240ms cubic-bezier(0.4, 0, 0.2, 1),
                min-width 240ms cubic-bezier(0.4, 0, 0.2, 1),
                max-width 240ms cubic-bezier(0.4, 0, 0.2, 1),
                opacity 180ms ease,
                padding 200ms ease;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: nowrap;
}
body.sidebar-collapsed .sidebar {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-right-width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.rail-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    width: 100%;
    height: 2.75rem;
    padding-left: 20px;
    padding-right: 14px;
    border-radius: 0 9999px 9999px 0;
    transition: background-color 150ms ease, color 150ms ease;
}
.rail-btn:hover {
    background-color: #f8f9fa;
    color: #202124;
}

.sidebar .nav-label {
    opacity: 1;
    max-width: 11rem;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 160ms ease;
}
body.sidebar-collapsed .sidebar .nav-label {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

.hidden-view { display: none !important; }

/* ---------- Touch + motion polish ---------- */
button, a, select, input { touch-action: manipulation; }
.rail-btn:active { transform: scale(0.97); }
.rail-btn { transition: background-color 150ms ease, color 150ms ease, transform 120ms cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------- Popover (notifications) ---------- */
.cg-pop {
    position: absolute; right: 0; top: calc(100% + 8px); width: min(20rem, calc(100vw - 1.5rem));
    background: rgba(255,255,255,0.96); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid #e4e4e7; border-radius: 1rem; box-shadow: 0 18px 40px -12px rgba(0,0,0,0.22);
    padding: 0.5rem; z-index: 70; transform-origin: top right;
    opacity: 0; transform: scale(0.96) translateY(-4px); visibility: hidden;
    transition: opacity 120ms ease, transform 120ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 120ms;
}
.cg-pop[data-open="true"] { opacity: 1; transform: none; visibility: visible; transition: opacity 0ms, transform 160ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s; }
.cg-pop-item { display: flex; gap: 0.75rem; width: 100%; text-align: left; padding: 0.625rem 0.75rem; border-radius: 0.75rem; align-items: flex-start; }
.cg-pop-item:hover { background: #f4f4f5; }

/* ---------- Sheet ---------- */
.cg-sheet {
    position: fixed; inset: 0; z-index: 180; display: flex; align-items: center; justify-content: center; padding: 1rem;
    background: rgba(9,9,11,0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    opacity: 0; visibility: hidden; transition: opacity 150ms ease, visibility 0s linear 150ms;
}
.cg-sheet[data-open="true"] { opacity: 1; visibility: visible; transition: opacity 200ms ease, visibility 0s; }
.cg-sheet-panel {
    background: #fff; width: 100%; max-width: 26rem; border-radius: 1.5rem; padding: 1.25rem; max-height: 85vh; overflow-y: auto;
    box-shadow: 0 25px 60px -15px rgba(0,0,0,0.35);
    transform: scale(0.96) translateY(8px); transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
}
.cg-sheet[data-open="true"] .cg-sheet-panel { transform: none; }
.cg-sheet-grabber { display: none; width: 2.25rem; height: 0.3rem; border-radius: 9999px; background: #d4d4d8; margin: -0.25rem auto 0.75rem; }

/* ---------- Mobile chrome (hidden on desktop) ---------- */
.cg-scrim { display: none; }

/* ---------- Onboarding tour ---------- */
#cg-tour { position: fixed; inset: 0; z-index: 400; opacity: 0; transition: opacity 200ms ease; }
#cg-tour.is-open { opacity: 1; }
.cg-tour-spot {
    position: fixed; border-radius: 14px; pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(9,9,11,0.55), 0 0 0 2px rgba(255,255,255,0.9);
    transition: top 260ms cubic-bezier(0.25, 1, 0.5, 1), left 260ms cubic-bezier(0.25, 1, 0.5, 1), width 260ms cubic-bezier(0.25, 1, 0.5, 1), height 260ms cubic-bezier(0.25, 1, 0.5, 1);
}
.cg-tour-card {
    position: fixed; width: min(21rem, calc(100vw - 1.5rem)); background: #fff; border-radius: 1.25rem; padding: 1.1rem 1.1rem 0.9rem;
    box-shadow: 0 24px 60px -12px rgba(0,0,0,0.45);
    transition: top 260ms cubic-bezier(0.25, 1, 0.5, 1), left 260ms cubic-bezier(0.25, 1, 0.5, 1), opacity 160ms ease;
}
.cg-tour-card.is-swapping { opacity: 0; }
.cg-tour-dots { display: flex; gap: 4px; }
.cg-tour-dot { width: 6px; height: 6px; border-radius: 9999px; background: #d4d4d8; transition: background-color 200ms ease, width 200ms ease; }
.cg-tour-dot.is-on { background: #18181b; width: 16px; }

@media (max-width: 1023px) {
    /* Sidebar becomes an off-canvas drawer; opened with body.nav-open above the navbar */
    body .sidebar, body.sidebar-collapsed .sidebar {
        position: fixed !important; top: 0 !important; bottom: 0 !important; left: 0 !important; z-index: 70 !important;
        width: 16rem !important; min-width: 16rem !important; max-width: 16rem !important;
        padding-left: 0 !important; padding-right: 0 !important; border-right-width: 1px !important;
        opacity: 1 !important; visibility: visible !important; pointer-events: auto !important;
        transform: translateX(-102%); transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: none; padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,0.3); }
    body.sidebar-collapsed .sidebar .nav-label { opacity: 1; max-width: 11rem; pointer-events: auto; }
    .cg-scrim {
        display: block; position: fixed; left: 0; right: 0; top: 0 !important; bottom: 0 !important; z-index: 65 !important; background: rgba(9,9,11,0.45);
        opacity: 0; visibility: hidden; transition: opacity 200ms ease, visibility 0s linear 200ms;
    }
    body.nav-open .cg-scrim { opacity: 1; visibility: visible; transition: opacity 250ms ease, visibility 0s; }

    main.gc-surface { padding: 1rem !important; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important; }
    main table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    #main-top-header { padding-top: env(safe-area-inset-top); height: calc(4rem + env(safe-area-inset-top)); }
    .rail-btn { height: 3rem; }

    .cg-sheet { align-items: flex-end; padding: 0; }
    .cg-sheet-panel { max-width: none; border-radius: 1.5rem 1.5rem 0 0; padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateY(100%); }
    .cg-sheet-grabber { display: block; }
    .cg-tour-card { left: 0.75rem !important; right: 0.75rem; width: auto; top: auto !important; bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 767px) {
    [id^="modal-"] > div { max-height: 92vh; overflow-y: auto; }
    h1.text-3xl { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
    .cg-tour-spot, .cg-tour-card, .cg-sheet-panel, .cg-pop, body .sidebar, .cg-scrim { transition-duration: 1ms !important; }
}

@keyframes scanline {
    0% { top: 10%; }
    50% { top: 90%; }
    100% { top: 10%; }
}
.animate-scanline {
    animation: scanline 2.5s ease-in-out infinite;
}

.wave-bar {
    animation: soundWave 1.2s ease-in-out infinite alternate;
}
.wave-bar:nth-child(2) { animation-delay: 0.2s; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; }
.wave-bar:nth-child(4) { animation-delay: 0.1s; }
.wave-bar:nth-child(5) { animation-delay: 0.3s; }
@keyframes soundWave {
    0% { height: 4px; }
    100% { height: 20px; }
}

/* Classroom: stage fills the full width; the browser drawer pushes it */
#browser-drawer {
    width: 0;
}
#view-classroom-module.browser-open #browser-drawer {
    width: 24rem;
}
/* While the real browser is open, snap (no push animation) so the
   overlay WebView2 stays glued to the drawer viewport. */
#view-classroom-module.browser-open #browser-drawer {
    transition: none;
}

/* Views fade in smoothly when they appear */
.portal-view:not(.hidden-view) {
    animation: viewFadeIn 220ms ease;
}
@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* Mirror webcam feeds (selfie view). Screen shares are NOT flipped. */
.cam-flip {
    transform: scaleX(-1);
}

/* ---------- 3D Multi-Angle Face ID Modal Styles ---------- */
.cg-faceid-card {
    --card-bg: #ffffff;
    --card-border: #e4e4e7;
    --text-primary: #18181b;
    --text-secondary: #71717a;
    --text-muted: #a1a1aa;
    --circle-idle-bg: #f4f4f5;
    --ring-track: #e4e4e7;
    --ring-fill: #10b981;
    --ring-error: #ef4444;
    --glyph-color: #18181b;
    --btn-bg: #18181b;
    --btn-hover: #27272a;
    --btn-text: #ffffff;
    --badge-bg: #f4f4f5;
    --badge-border: #e4e4e7;
    --success-circle-bg: #ecfdf5;
    --success-circle-border: #10b981;
    --success-check: #059669;
    --error-circle-bg: #fef2f2;
    --error-circle-border: #ef4444;
    --error-icon: #dc2626;
    position: relative;
    width: 100%;
    max-width: 390px;
    min-height: 550px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 32px 26px 26px;
    overflow: hidden;
    user-select: none;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.cg-faceid-card .back-btn {
    position: absolute;
    top: 22px;
    left: 22px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: var(--badge-bg);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(-6px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.2s ease;
    z-index: 30;
}
.cg-faceid-card .back-btn:hover { color: var(--text-primary); }
.cg-faceid-card[data-stage="scanning"] .back-btn {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.cg-faceid-card .header-area {
    position: relative;
    width: 100%;
    height: 68px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 20;
}
.cg-faceid-card .header-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1), transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}
.cg-faceid-card[data-stage="idle"] .header-idle,
.cg-faceid-card[data-stage="scanning"] .header-scanning,
.cg-faceid-card[data-stage="success"] .header-success,
.cg-faceid-card[data-stage="mismatch"] .header-mismatch {
    opacity: 1;
    transform: translateY(0);
}
.cg-faceid-card .cg-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.cg-faceid-card .cg-subtitle {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.42;
    margin-top: 4px;
    max-width: 295px;
}

.cg-faceid-card .center-stage {
    position: relative;
    width: 236px;
    height: 236px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    margin: 8px 0;
}
.cg-faceid-card .scanner-assembly {
    position: relative;
    width: 232px;
    height: 232px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.48s ease;
}
.cg-faceid-card[data-stage="success"] .scanner-assembly,
.cg-faceid-card[data-stage="mismatch"] .scanner-assembly {
    transform: scale(1.75);
    opacity: 0;
    pointer-events: none;
}
.cg-faceid-card .idle-circle-bg {
    position: absolute;
    width: 208px;
    height: 208px;
    border-radius: 50%;
    background: var(--circle-idle-bg);
    transition: background-color 0.25s ease;
}
.cg-faceid-card .faceid-glyph {
    position: relative;
    z-index: 5;
    width: 62px;
    height: 62px;
    stroke: var(--glyph-color);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, stroke 0.25s ease;
}
.cg-faceid-card[data-stage="scanning"] .faceid-glyph {
    transform: scale(0.45);
    opacity: 0;
    pointer-events: none;
}

.cg-faceid-card .camera-viewport {
    position: absolute;
    width: 208px;
    height: 208px;
    border-radius: 50%;
    overflow: hidden;
    background: #18181b;
    z-index: 10;
    opacity: 0;
    transform: scale(0.28);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.36s ease;
}
.cg-faceid-card[data-stage="scanning"] .camera-viewport,
.cg-faceid-card[data-stage="success"] .camera-viewport,
.cg-faceid-card[data-stage="mismatch"] .camera-viewport {
    opacity: 1;
    transform: scale(1);
}
.cg-faceid-card .camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    display: block;
}
.cg-faceid-card .capture-flash {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.38);
    opacity: 0;
    z-index: 18;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
.cg-faceid-card .capture-flash.flash { opacity: 1; }

.cg-faceid-card .direction-cue-badge {
    position: absolute;
    z-index: 22;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #10b981;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.85);
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}
.cg-faceid-card .direction-cue-badge.active {
    opacity: 1;
    transform: scale(1);
    animation: cgPulseCue 0.9s infinite alternate ease-in-out;
}
@keyframes cgPulseCue {
    from { transform: scale(0.95); }
    to { transform: scale(1.15); }
}
.cg-faceid-card .cue-left { left: -4px; top: 50%; margin-top: -15px; }
.cg-faceid-card .cue-right { right: -4px; top: 50%; margin-top: -15px; }
.cg-faceid-card .cue-up { top: -4px; left: 50%; margin-left: -15px; }
.cg-faceid-card .cue-down { bottom: -4px; left: 50%; margin-left: -15px; }

.cg-faceid-card .spherical-scan-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    pointer-events: none;
}
.cg-faceid-card .progress-ring-svg {
    position: absolute;
    inset: 0;
    width: 232px;
    height: 232px;
    transform: rotate(-90deg);
    z-index: 20;
    pointer-events: none;
}

.cg-faceid-card .result-badge-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 25;
}
.cg-faceid-card .result-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--success-circle-bg);
    border: 2px solid var(--success-circle-border);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.35);
    transition: transform 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s, opacity 0.32s ease 0.1s;
}
.cg-faceid-card[data-stage="success"] .result-circle {
    opacity: 1;
    transform: scale(1);
    background: var(--success-circle-bg);
    border-color: var(--success-circle-border);
}
.cg-faceid-card[data-stage="mismatch"] .result-circle {
    opacity: 1;
    transform: scale(1);
    background: var(--error-circle-bg);
    border-color: var(--error-circle-border);
}
.cg-faceid-card .checkmark-path {
    stroke: var(--success-check);
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    transition: stroke-dashoffset 0.45s cubic-bezier(0.65, 0, 0.35, 1) 0.28s;
}
.cg-faceid-card[data-stage="success"] .checkmark-path { stroke-dashoffset: 0; }
.cg-faceid-card .cross-path { stroke: var(--error-icon); display: none; }
.cg-faceid-card[data-stage="mismatch"] .checkmark-svg { display: none; }
.cg-faceid-card[data-stage="mismatch"] .cross-path { display: block; }

.cg-faceid-card .footer-area {
    position: relative;
    width: 100%;
    min-height: 104px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    z-index: 20;
}
.cg-faceid-card .scanning-hint-wrap {
    position: absolute;
    top: 4px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.cg-faceid-card[data-stage="scanning"] .scanning-hint-wrap {
    opacity: 1;
    transform: translateY(0);
}
.cg-faceid-card .scanning-hint {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}
.cg-faceid-card .depth-meter-track {
    width: 210px;
    height: 6px;
    border-radius: 999px;
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    overflow: hidden;
}
.cg-faceid-card .depth-meter-fill {
    height: 100%;
    width: 0%;
    background: #10b981;
    border-radius: 999px;
    transition: width 0.1s linear;
}
.cg-faceid-card .depth-subhint {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}
.cg-faceid-card .action-buttons {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.cg-faceid-card[data-stage="scanning"] .action-buttons {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}
.cg-faceid-card .cg-primary-btn {
    position: relative;
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--btn-bg);
    color: var(--btn-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.18s ease;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.cg-faceid-card .cg-primary-btn:hover { background: var(--btn-hover); }
.cg-faceid-card .cg-primary-btn:active { transform: scale(0.98); }
.cg-faceid-card .cg-verify-btn {
    width: 100%;
    height: 40px;
    border: 1px solid #10b981;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.18s ease;
}
.cg-faceid-card .cg-verify-btn.visible { display: flex; }
.cg-faceid-card .cg-verify-btn:hover { background: #10b981; color: #ffffff; }
.cg-faceid-card .device-privacy-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---------- Modern Skeleton Loading State ---------- */
.cg-skeleton-shimmer {
    position: relative;
    overflow: hidden;
    background-color: #f4f4f5;
}

.cg-skeleton-shimmer::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.6) 35%,
        rgba(255, 255, 255, 0.85) 50%,
        rgba(255, 255, 255, 0.6) 65%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: cg-shimmer 1.8s infinite ease-in-out;
    content: '';
}

@keyframes cg-shimmer {
    100% {
        transform: translateX(100%);
    }
}
