@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-start: #07101F;
    --bg-end: #0B1628;
    --panel-bg: rgba(14, 26, 46, 0.82);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-glow: rgba(37, 99, 235, 0.15);
    
    --accent-primary-start: #2563EB;
    --accent-primary-end: #4F46E5;
    --accent-secondary: #7C3AED;
    
    --status-safe: #10B981;
    --status-safe-glow: rgba(16, 185, 129, 0.2);
    --status-warning: #F59E0B;
    --status-warning-glow: rgba(245, 158, 11, 0.2);
    --status-danger: #EF4444;
    --status-danger-glow: rgba(239, 68, 68, 0.2);
    
    --text-main: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: radial-gradient(circle at 50% 50%, var(--bg-start) 0%, var(--bg-end) 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
}

select option {
    background-color: #07101F;
    color: #F8FAFC;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(7, 16, 31, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Typography Utilities */
.font-mono {
    font-family: var(--font-mono);
}

/* Common Layouts & Containers */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.gradient-text {
    background: linear-gradient(135deg, #FFF 30%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-gradient {
    background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary-start), var(--accent-primary-end));
    color: var(--text-main);
    border: none;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(37, 99, 235, 0.45);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 12px 24px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--status-danger);
    color: #FFA5A5;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
}
.btn-danger:hover {
    background: var(--status-danger);
    color: var(--text-main);
    box-shadow: 0 0 15px var(--status-danger-glow);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--status-safe);
    color: #A7F3D0;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
}
.btn-success:hover {
    background: var(--status-safe);
    color: var(--text-main);
    box-shadow: 0 0 15px var(--status-safe-glow);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    width: 100%;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}
.form-control {
    width: 100%;
    background: rgba(14, 26, 46, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 16px;
    transition: var(--transition-fast);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent-primary-start);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-blue {
    background: rgba(37, 99, 235, 0.15);
    color: #93C5FD;
    border: 1px solid rgba(37, 99, 235, 0.3);
}
.badge-purple {
    background: rgba(124, 58, 237, 0.15);
    color: #C7D2FE;
    border: 1px solid rgba(124, 58, 237, 0.3);
}
.badge-safe {
    background: rgba(16, 185, 129, 0.15);
    color: #A7F3D0;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #FDE68A;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Toast Messages */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.toast {
    background: rgba(14, 26, 46, 0.95);
    border-left: 4px solid var(--accent-primary-start);
    padding: 16px 20px;
    border-radius: 4px var(--radius-md) var(--radius-md) 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    color: var(--text-main);
    transform: translateX(120%);
    animation: slideIn 0.3s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.toast-warning { border-left-color: var(--status-warning); }
.toast.toast-danger { border-left-color: var(--status-danger); }
.toast.toast-success { border-left-color: var(--status-safe); }
.toast.hide {
    animation: slideOut 0.3s forwards cubic-bezier(0.6, -0.28, 0.735, 0.045);
}

@keyframes slideIn { to { transform: translateX(0); } }
@keyframes slideOut { to { transform: translateX(120%); } }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    width: 90%;
    max-width: 550px;
    padding: 32px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Header & Main Views */
header {
    border-bottom: 1px solid var(--panel-border);
    background: rgba(14, 26, 46, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

/* Landing Page layout */
.landing-container {
    max-width: 1200px;
    margin: auto;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    justify-content: center;
}
.landing-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.025em;
}
.landing-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin-bottom: 48px;
}
.role-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    width: 100%;
    max-width: 960px;
}
.role-card {
    padding: 40px 32px;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}
.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(800px circle at var(--x, 0px) var(--y, 0px), rgba(255,255,255,0.06), transparent 40%);
    z-index: 0;
    pointer-events: none;
}
.role-card:hover {
    transform: translateY(-8px);
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.15);
}
.role-icon {
    font-size: 40px;
    margin-bottom: 24px;
    display: inline-block;
}
.role-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}
.role-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* Auth Pages */
.auth-container {
    max-width: 480px;
    width: 90%;
    margin: auto;
    padding: 40px;
}
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}
.auth-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}
.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Selection / Setup Screens */
.setup-container {
    max-width: 800px;
    width: 90%;
    margin: auto;
    padding: 40px 0;
}
.setup-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}
@media (max-width: 767px) {
    .setup-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}
.setup-header {
    margin-bottom: 32px;
}
.setup-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}
.setup-header p {
    color: var(--text-secondary);
}

.check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--panel-border);
}
.check-item:last-child {
    border-bottom: none;
}
.check-info {
    display: flex;
    align-items: center;
    gap: 16px;
}
.check-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.check-text h4 {
    font-size: 16px;
    font-weight: 600;
}
.check-text p {
    font-size: 13px;
    color: var(--text-secondary);
}
.check-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Exam Viewport (Design No. 5) */
.exam-layout {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100vh;
    overflow: hidden;
}

.exam-header {
    padding: 12px 24px;
}

.header-left, .header-center, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-center {
    flex: 1;
    justify-content: center;
    max-width: 400px;
    margin: 0 auto;
    flex-direction: column;
    gap: 6px;
}

.header-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.header-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary-start), var(--accent-primary-end));
    width: 30%;
    transition: width var(--transition-normal);
}

.header-timer {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}
.header-timer.warning {
    border-color: var(--status-warning);
    color: var(--status-warning);
    animation: pulse 1s infinite alternate;
}
.header-timer.danger {
    border-color: var(--status-danger);
    background: rgba(239, 68, 68, 0.1);
    color: var(--status-danger);
    animation: shake 0.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 5px rgba(245, 158, 11, 0.2); }
    100% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.5); }
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(0px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(2px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(2px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.exam-body {
    display: grid;
    grid-template-columns: 280px 1fr 340px;
    overflow: hidden;
    position: relative;
}

/* Sidebar Navigator */
.exam-sidebar-left {
    border-right: 1px solid var(--panel-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.legend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}
.legend-dot.answered { background: var(--status-safe); }
.legend-dot.active { background: var(--accent-primary-start); box-shadow: 0 0 8px var(--accent-primary-start); }
.legend-dot.flagged { background: var(--status-warning); }
.legend-dot.unanswered { background: var(--text-muted); }

.navigator-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
.nav-num {
    aspect-ratio: 1;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}
.nav-num:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}
.nav-num.active {
    background: var(--panel-bg);
    border-color: var(--accent-primary-start);
    color: var(--text-main);
    box-shadow: 0 0 12px var(--panel-glow);
}
.nav-num.answered {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--status-safe);
    color: #A7F3D0;
}
.nav-num.flagged {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--status-warning);
    color: #FDE68A;
}
.nav-num.flagged::after {
    content: '🚩';
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 9px;
}
.nav-num.bookmark::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 4px;
    height: 4px;
    border-radius: var(--radius-full);
    background: var(--accent-secondary);
}

/* Main Content Area */
.exam-content-area {
    padding: 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.meta-badges {
    display: flex;
    gap: 8px;
}

.question-card {
    padding: 24px;
}
.question-text {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 24px;
    font-weight: 500;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--panel-border);
    cursor: pointer;
    transition: var(--transition-fast);
}
.option-row:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.15);
}
.option-row.selected {
    background: rgba(37, 99, 235, 0.12);
    border-color: var(--accent-primary-start);
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.1);
}

.option-radio {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    border: 2px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.option-row.selected .option-radio {
    border-color: var(--accent-primary-start);
}
.option-radio-inner {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--accent-primary-start);
    transform: scale(0);
    transition: transform var(--transition-fast);
}
.option-row.selected .option-radio-inner {
    transform: scale(1);
}

.option-letter {
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 20px;
}
.option-row.selected .option-letter {
    color: var(--text-main);
}
.option-text {
    font-size: 15px;
}

.autosave-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    align-self: flex-start;
}
.autosave-status.saving { color: var(--status-warning); }
.autosave-status.saved { color: var(--status-safe); }
.autosave-status.error { color: var(--status-danger); }

/* Sidebar Proctoring */
.exam-sidebar-right {
    border-left: 1px solid var(--panel-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.webcam-container {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    background: #020617;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--accent-secondary);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.15);
}
.webcam-container video, .webcam-container canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.webcam-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(239, 68, 68, 0.85);
    color: var(--text-main);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.webcam-badge.active {
    background: rgba(16, 185, 129, 0.85);
}
.webcam-controls {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
}
.webcam-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition-fast);
}
.webcam-btn:hover {
    background: rgba(15, 23, 42, 0.95);
}

.rules-card {
    padding: 16px;
}
.rules-card h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.rules-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}
.rules-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

/* Bottom Bar sticky navigation */
.exam-bottom-bar {
    border-top: 1px solid var(--panel-border);
    background: rgba(14, 26, 46, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}
.bottom-bar-left, .bottom-bar-right {
    display: flex;
    gap: 12px;
}

/* Teacher Dashboard Dashboard Styling */
.dashboard-layout {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
    overflow: hidden;
}
.dashboard-body {
    display: grid;
    grid-template-columns: 300px 1fr;
    overflow: hidden;
}
.dashboard-sidebar {
    border-right: 1px solid var(--panel-border);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.dashboard-content {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.summary-card {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.summary-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.summary-val {
    font-size: 24px;
    font-weight: 700;
}

/* Classes Filter Panel */
.filter-section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 12px;
}
.class-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.class-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}
.class-checkbox-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary-start);
}

.selected-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.chip {
    background: rgba(37, 99, 235, 0.15);
    color: #93C5FD;
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.chip-close {
    cursor: pointer;
    font-weight: bold;
}
.chip-close:hover {
    color: var(--text-main);
}

/* Monitoring Grid */
.monitoring-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.student-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition-fast);
    position: relative;
    cursor: pointer;
}
.student-card:hover {
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-2px);
}
.student-card.high-risk {
    border-color: var(--status-danger);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
}
.student-card.yellow-card {
    border-color: var(--status-warning);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.1);
}

.student-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.student-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: #1E293B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
    overflow: hidden;
}
.student-card-avatar video, .student-card-avatar canvas, .student-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.student-card-info {
    flex: 1;
    min-width: 0;
}
.student-card-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.student-card-nim {
    font-size: 12px;
    color: var(--text-secondary);
}

.student-card-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.status-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
}
.status-dot.active { background: var(--status-safe); box-shadow: 0 0 6px var(--status-safe); }
.status-dot.inactive { background: var(--text-muted); }

.student-card-progress {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.student-card-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.student-card-progress-fill {
    height: 100%;
    background: var(--accent-primary-start);
}

/* Violation log lists */
.log-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}
.log-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--panel-border);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.log-item.warning { border-left: 3px solid var(--status-warning); }
.log-item.danger { border-left: 3px solid var(--status-danger); }
.log-item-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.log-item-time {
    font-size: 10px;
    color: var(--text-muted);
}

/* Overlay / Zoomed Camera */
.camera-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    aspect-ratio: 16/9;
    background: #000;
    z-index: 1000;
    border-radius: var(--radius-lg);
    border: 3px solid var(--accent-secondary);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    display: none;
    overflow: hidden;
}
.camera-overlay.active {
    display: block;
}
.camera-overlay-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 2;
}

/* Results Grid / CSV Export View */
.result-table-container {
    width: 100%;
    overflow-x: auto;
}
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}
.result-table th, .result-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--panel-border);
}
.result-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.02);
}
.result-table tr:hover {
    background: rgba(255,255,255,0.01);
}

/* Admin Dashboard styling */
.admin-tab-nav {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 12px;
    margin-bottom: 24px;
}
.admin-tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    aspect-ratio: auto !important;
}
.admin-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.04);
}
.admin-tab-btn.active {
    color: var(--text-main);
    background: var(--accent-primary-start);
}

.admin-grid-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

/* Responsiveness overrides */
@media (max-width: 1439px) {
    .exam-body {
        grid-template-columns: 200px 1fr 300px;
    }
}

@media (max-width: 1023px) {
    .exam-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .exam-sidebar-left {
        display: none; /* turns into drawer or modal selection */
    }
    .exam-sidebar-right {
        position: fixed;
        right: 16px;
        bottom: 80px;
        width: 180px;
        height: auto;
        border: 1px solid var(--panel-border);
        border-radius: var(--radius-md);
        box-shadow: 0 8px 24px rgba(0,0,0,0.5);
        z-index: 100;
        background: var(--panel-bg);
        padding: 10px;
    }
    .exam-sidebar-right .rules-card,
    .exam-sidebar-right h4 {
        display: none;
    }
    .webcam-container {
        width: 100%;
        aspect-ratio: 16/9;
    }
}

@media (max-width: 767px) {
    /* Mobile blocker disabled to allow mobile access */
    body.mobile-blocked::before,
    body.mobile-blocked::after {
        display: none !important;
    }
}

/* ========================================================
   Landing Page / Homepage Premium Style Enhancements
   ======================================================== */

/* Exempt landing page from mobile blocker */
body.homepage::before, body.homepage::after {
    display: none !important;
}

/* Ambient Floating Glow Background */
.bg-glow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.bg-glow-ball {
    position: absolute;
    border-radius: var(--radius-full);
    filter: blur(100px);
    opacity: 0.12;
    animation: floatGlow 12s infinite alternate ease-in-out;
}

.bg-glow-ball-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary-start);
    top: -100px;
    left: -100px;
}

.bg-glow-ball-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    bottom: -150px;
    right: -100px;
    animation-delay: -4s;
}

.bg-glow-ball-3 {
    width: 300px;
    height: 300px;
    background: #06B6D4;
    top: 40%;
    left: 60%;
    animation-delay: -8s;
}

@keyframes floatGlow {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(60px, 40px) scale(1.15);
    }
}

/* Landing Header / Navbar */
.landing-header {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background: transparent;
    border-bottom: none;
    flex-wrap: wrap;
    gap: 16px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-logo span {
    font-size: 1.5rem;
}

.header-widgets {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-widget-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.header-widget-item.clock {
    font-family: var(--font-mono);
    color: var(--text-main);
}

.system-status-pill {
    font-weight: 600;
    color: var(--status-safe);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Landing Container overrides */
.landing-container {
    padding: 20px 24px 60px 24px !important;
}

/* Hero Section */
.landing-hero {
    margin-top: 30px;
    margin-bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.landing-tagline-badge {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #93C5FD;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.1);
}

.landing-title {
    font-size: 3.5rem !important;
    line-height: 1.1;
    margin-bottom: 20px !important;
    text-align: center;
}

.landing-subtitle {
    font-size: 1.15rem !important;
    margin-bottom: 40px !important;
    line-height: 1.6;
    text-align: center;
    max-width: 640px;
}

/* Role Cards Grid */
.role-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

/* Glow highlights for role cards */
.role-card {
    border-radius: var(--radius-lg) !important;
    border: 1.5px solid var(--panel-border) !important;
    background: rgba(14, 26, 46, 0.7) !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.role-card.student-card-glow:hover {
    border-color: rgba(37, 99, 235, 0.5) !important;
    box-shadow: 0 15px 45px rgba(37, 99, 235, 0.25) !important;
}

.role-card.teacher-card-glow:hover {
    border-color: rgba(124, 58, 237, 0.5) !important;
    box-shadow: 0 15px 45px rgba(124, 58, 237, 0.25) !important;
}

.role-card.admin-card-glow:hover {
    border-color: rgba(6, 182, 212, 0.5) !important;
    box-shadow: 0 15px 45px rgba(6, 182, 212, 0.25) !important;
}

.role-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    font-size: 28px;
    transition: var(--transition-fast);
}

.role-card:hover .role-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

.student-card-glow .role-icon-wrapper {
    background: rgba(37, 99, 235, 0.15);
    color: #3B82F6;
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.teacher-card-glow .role-icon-wrapper {
    background: rgba(124, 58, 237, 0.15);
    color: #8B5CF6;
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.admin-card-glow .role-icon-wrapper {
    background: rgba(6, 182, 212, 0.15);
    color: #06B6D4;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.role-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}

.role-card p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Stats Dashboard Section */
.stats-dashboard {
    width: 100%;
    max-width: 960px;
    margin: 60px auto 40px auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-item {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--panel-border);
    transition: var(--transition-fast);
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-val {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: var(--font-mono);
    margin-bottom: 4px;
}

.stat-val.glow-green {
    color: var(--status-safe);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.stat-lbl {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Key Features Grid Section */
.features-section {
    width: 100%;
    max-width: 960px;
    margin: 60px auto 20px auto;
    text-align: left;
}

.features-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
    letter-spacing: -0.01em;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.feature-card {
    padding: 24px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                border-color 0.3s ease, 
                box-shadow 0.3s ease, 
                background-color 0.3s ease;
}

.feature-card:hover {
    background: rgba(37, 99, 235, 0.04);
    border-color: rgba(37, 99, 235, 0.35);
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.12);
}

.feature-card:hover .feature-icon-box {
    transform: scale(1.1) rotate(6deg);
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.4);
}

.feature-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                background-color 0.3s ease, 
                border-color 0.3s ease;
}

.feature-info h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-main);
}

.feature-info p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Footer style */
.landing-footer {
    width: 100%;
    max-width: 1200px;
    margin: 40px auto 0 auto;
    padding: 24px;
    border-top: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a:hover {
    color: var(--text-secondary);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .landing-title {
        font-size: 2.8rem !important;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    /* Header navbar responsive shift */
    .landing-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 16px;
    }
    .header-widgets {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .header-widget-item.clock {
        font-size: 11px;
    }
}

@media (max-width: 767px) {
    
    /* Landing container */
    .landing-container {
        padding: 16px 16px 48px 16px !important;
    }
    
    /* Hero section */
    .landing-hero {
        margin-top: 16px;
        margin-bottom: 32px;
    }
    .landing-hero img[alt="UAS On-Cam Proctoring Logo"] {
        width: 80px !important;
        height: 80px !important;
    }
    .landing-title {
        font-size: 1.85rem !important;
        text-align: center;
    }
    .landing-subtitle {
        font-size: 0.95rem !important;
        text-align: center;
        padding: 0 8px;
    }
    .landing-tagline-badge {
        font-size: 11px;
        padding: 5px 12px;
    }
    
    /* Role cards: stack vertically on mobile */
    .role-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .role-card {
        padding: 20px !important;
    }
    .role-icon-wrapper {
        width: 52px !important;
        height: 52px !important;
        font-size: 22px !important;
        margin-bottom: 14px !important;
    }
    .role-card h3 {
        font-size: 1.15rem !important;
    }
    .role-card p {
        font-size: 13px !important;
    }
    
    /* Stats: 3 cols stay but compact */
    .stats-dashboard {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin: 36px auto 24px auto;
    }
    .stat-item {
        padding: 14px 8px;
    }
    .stat-val {
        font-size: 1.1rem !important;
    }
    .stat-lbl {
        font-size: 9px !important;
    }
    
    /* Features: single column */
    .features-section {
        margin: 36px auto 16px auto;
    }
    .features-title {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }
    .features-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .feature-card {
        padding: 16px;
        gap: 12px;
    }
    .feature-icon-box {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
    .feature-info h4 {
        font-size: 13.5px !important;
    }
    .feature-info p {
        font-size: 12px !important;
    }
    
    /* Footer */
    .landing-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        font-size: 11px;
        padding: 16px;
    }
}

/* ========================================================
   User Portal Mobile Portrait Responsiveness
   ======================================================== */
@media (max-width: 767px) {
    /* Header layout */
    header {
        height: auto !important;
        padding: 10px 14px !important;
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        gap: 8px !important;
    }
    .header-left {
        gap: 8px !important;
    }
    .header-left div:first-child {
        display: none !important; /* Hide UAS icon badge to save space */
    }
    .header-left h2 {
        font-size: 13px !important;
    }
    .header-left div {
        font-size: 10px !important;
    }
    .header-center {
        grid-column: span 2 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        order: 3 !important;
        background: rgba(255, 255, 255, 0.02);
        padding: 6px;
        border-radius: var(--radius-sm);
    }
    .header-right {
        justify-content: flex-end !important;
        gap: 8px !important;
    }
    .header-timer {
        font-size: 13px !important;
        padding: 4px 8px !important;
    }
    .header-right #camera-active-badge,
    .header-right #fullscreen-active-badge {
        display: none !important;
    }
    .header-right .btn-danger {
        padding: 6px 12px !important;
        font-size: 11px !important;
    }
    
    /* Toggle list button */
    #btn-toggle-nav-mobile {
        display: inline-flex !important;
    }
    
    /* Main body layout */
    .exam-body {
        grid-template-columns: 1fr !important;
        height: calc(100vh - 118px - 70px) !important;
    }
    .exam-content-area {
        padding: 16px !important;
        gap: 16px !important;
    }
    .question-card {
        padding: 16px !important;
    }
    .question-text {
        font-size: 15px !important;
        margin-bottom: 16px !important;
    }
    .option-row {
        padding: 12px 14px !important;
        gap: 10px !important;
    }
    .option-text {
        font-size: 13px !important;
    }
    
    /* Left sidebar drawer */
    .exam-sidebar-left {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 10000;
        background: #07101f;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important;
        border-right: 1px solid var(--panel-border);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }
    .exam-sidebar-left.active {
        left: 0;
    }
    .exam-sidebar-left #toggle-nav-width {
        font-size: 18px !important;
        color: var(--status-danger) !important;
    }
    
    /* Floating camera Pip */
    .exam-sidebar-right {
        position: fixed;
        right: 12px;
        bottom: 84px;
        width: 90px !important;
        height: 60px !important;
        border-radius: var(--radius-sm);
        z-index: 99;
        padding: 0 !important;
        overflow: hidden;
        background: rgba(14, 26, 46, 0.9);
        border: 1.5px solid var(--accent-secondary);
        box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    }
    .exam-sidebar-right .webcam-container {
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        aspect-ratio: auto !important;
        margin: 0 !important;
        box-shadow: none !important;
    }
    .exam-sidebar-right .webcam-badge {
        font-size: 8px !important;
        padding: 1px 4px !important;
        top: 4px !important;
        left: 4px !important;
    }
    .exam-sidebar-right .webcam-controls {
        bottom: 2px !important;
        right: 2px !important;
    }
    .exam-sidebar-right .webcam-btn {
        width: 18px !important;
        height: 18px !important;
        font-size: 9px !important;
    }
    .exam-sidebar-right .rules-card,
    .exam-sidebar-right .glass-panel {
        display: none !important;
    }
    
    /* Mobile action buttons inside card */
    .mobile-actions-container {
        display: flex !important;
    }
    
    /* Footer layout adjustment */
    .exam-bottom-bar {
        height: 70px !important;
        padding: 12px 16px !important;
    }
    .exam-bottom-bar button {
        padding: 8px 16px !important;
        font-size: 12px !important;
    }
    .exam-bottom-bar .bottom-bar-right #btn-doubtful,
    .exam-bottom-bar .bottom-bar-right #btn-save-manual {
        display: none !important;
    }
}
