/* Sober and Formal Academic Color Palette CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-primary: #1e3a8a; /* Formal Deep Blue */
    --accent-glow: rgba(30, 58, 138, 0.15);
    --accent-success: #059669; /* Emerald Green */
    --accent-warning: #d97706; /* Amber */
    --accent-error: #dc2626; /* Rose Red */
    
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 4px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & selection block */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    padding: 30px 20px;
    position: relative;
}

/* Blur overlay for screenshot / window blur protection */
#security-blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    text-align: center;
    padding: 30px;
}

#security-blur-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#security-blur-overlay h1 {
    font-family: 'Outfit', sans-serif;
    color: var(--accent-error);
    font-size: 2.2rem;
    margin-bottom: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#security-blur-overlay p {
    font-size: 1.1rem;
    color: #e2e8f0;
    max-width: 500px;
    line-height: 1.6;
}

#security-blur-overlay .btn-resume {
    margin-top: 25px;
    padding: 12px 30px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(30,58,138,0.3);
    transition: var(--transition);
}

#security-blur-overlay .btn-resume:hover {
    transform: scale(1.03);
    background: #1d4ed8;
}

/* Floating webcam preview circle for student */
#webcam-preview-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 3px solid var(--accent-primary);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 99;
    display: none;
    background: #000000;
    transform: scaleX(-1); /* mirror view */
}

#webcam-preview-container.active {
    display: block;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0) scaleX(-1); opacity: 0; }
    to { transform: scale(1) scaleX(-1); opacity: 1; }
}

#webcam-preview-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.webcam-status-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%) scaleX(-1); /* unmirror status text */
    background: rgba(15, 23, 42, 0.85);
    border-radius: 20px;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-success);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent-success);
    animation: breathing 1.5s infinite;
}

@keyframes breathing {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

.status-text {
    font-size: 0.62rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* App Wrapper */
.app-container {
    width: 100%;
    max-width: 800px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    padding: 40px;
    transition: var(--transition);
    position: relative;
    z-index: 10;
}

/* Headings */
h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-logo {
    text-align: center;
    margin-bottom: 30px;
}

.header-logo h1 {
    font-size: 2.1rem;
    color: var(--accent-primary);
    margin-bottom: 8px;
    font-weight: 800;
}

.header-logo p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Cards & Sections transition */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: #ffffff;
}

select.form-control option {
    background: #ffffff;
    color: var(--text-primary);
}

/* Primary Button */
.btn-primary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 14px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
}

/* Quiz UI Components */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--card-border);
}

.quiz-progress-info {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.quiz-part-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(30, 58, 138, 0.08);
    border: 1px solid rgba(30, 58, 138, 0.2);
    color: var(--accent-primary);
    padding: 4px 10px;
    border-radius: 20px;
}

/* Progress bar container */
.progress-container {
    width: 100%;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-primary);
    border-radius: 3px;
    transition: width 0.25s ease;
}

/* Question style */
.question-container h3 {
    font-size: 1.3rem;
    line-height: 1.45;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Monospace Syntax Code Block */
.code-block {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 25px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #e2e8f0;
}

.code-keyword { color: #f43f5e; font-weight: 500; }
.code-type { color: #38bdf8; }
.code-string { color: #10b981; }
.code-comment { color: #64748b; font-style: italic; }
.code-fn { color: #fbbf24; }

/* Options layout */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.option-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.option-item.selected {
    background: rgba(30, 58, 138, 0.04);
    border-color: var(--accent-primary);
}

.option-radio {
    display: none; /* Hide default radio */
}

.option-marker {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    margin-right: 15px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition);
    background: #ffffff;
}

.option-item:hover .option-marker {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.option-item.selected .option-marker {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
}

.option-text {
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-primary);
}

/* Footer of Quiz Card */
.quiz-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.btn-secondary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    color: #475569;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: #94a3b8;
    color: var(--text-primary);
    background: #f8fafc;
}

.btn-success {
    background: var(--accent-success);
}

.btn-success:hover {
    background: #047857;
}

/* Results / Info Card Styling */
.results-card {
    text-align: center;
}

.score-circle {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(30, 58, 138, 0.05) 0%, rgba(255, 255, 255, 1) 100%);
    border: 3px solid var(--card-border);
    margin: 0 auto 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.score-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--accent-success);
    line-height: 1.1;
}

.score-total {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.results-stats {
    background: #f8fafc;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-around;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 5px;
    letter-spacing: 0.02em;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
}

.stat-value.ok {
    color: var(--accent-success);
}

.stat-value.warn {
    color: var(--accent-warning);
}

.stat-value.danger {
    color: var(--accent-error);
}

/* Warnings layout in-app */
.alert-banner {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(220, 38, 38, 0.05);
    border: 1px solid rgba(220, 38, 38, 0.15);
    border-radius: var(--radius-sm);
    color: var(--accent-error);
    margin-bottom: 20px;
    font-size: 0.88rem;
    line-height: 1.4;
}

.alert-banner svg {
    flex-shrink: 0;
    margin-right: 10px;
    width: 20px;
    height: 20px;
    fill: var(--accent-error);
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 15px;
}

.tab-btn {
    padding: 10px 18px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: #f8fafc;
}

.tab-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

/* Admin Dashboard View */
.admin-card {
    max-width: 1000px;
    margin: 20px auto;
    width: 100%;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.admin-stat-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: left;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

.admin-stat-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    margin-top: 5px;
}

.table-wrapper {
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    margin-bottom: 35px;
}

.table-admin {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-admin th {
    background: #f8fafc;
    padding: 14px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--card-border);
}

.table-admin td {
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}

.table-admin tr:hover {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 4px;
}

.badge-success { background: rgba(5, 150, 105, 0.1); color: #047857; border: 1px solid rgba(5, 150, 105, 0.2); }
.badge-warning { background: rgba(217, 119, 6, 0.1); color: #b45309; border: 1px solid rgba(217, 119, 6, 0.2); }
.badge-danger { background: rgba(220, 38, 38, 0.1); color: #b91c1c; border: 1px solid rgba(220, 38, 38, 0.2); }

.btn-table {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.15);
    color: var(--accent-error);
    transition: var(--transition);
}

.btn-table:hover {
    background: var(--accent-error);
    color: white;
}

/* Details popup modal for Admin */
.modal-admin {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-admin.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content-admin {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 850px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 30px;
    box-shadow: 0 10px 45px rgba(0,0,0,0.15);
}

.modal-header-admin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 10px;
}

.modal-close-admin {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close-admin:hover {
    color: var(--text-primary);
}

.detail-ans-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-ans-item {
    padding: 20px;
    background: #f8fafc;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
}

.detail-ans-item.correct {
    border-left: 5px solid var(--accent-success);
}

.detail-ans-item.incorrect {
    border-left: 5px solid var(--accent-error);
}

/* Webcam capture images side-by-side grid inside details */
.webcam-captures-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.webcam-capture-card {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
}

.webcam-capture-card span {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.webcam-capture-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid #cbd5e1;
    background: #000;
}

.no-webcam-capture {
    height: 120px;
    border-radius: var(--radius-sm);
    border: 1px dashed #cbd5e1;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    background: #ffffff;
}

/* Horizontal accuracy progress bar for stats per question */
.stat-bar-container {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.stat-bar-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 4px;
}

/* QR display box */
.qr-container {
    display: flex;
    gap: 30px;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--card-border);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-top: 20px;
}

.qr-image-box {
    background: #ffffff;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 160px;
    height: 160px;
    flex-shrink: 0;
}

.qr-image-box img {
    width: 100%;
    height: 100%;
}

/* Animations and Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 20px;
    }
    
    .quiz-footer {
        flex-direction: column;
    }
    
    .btn-secondary, .btn-primary {
        width: 100%;
    }
    
    .header-logo h1 {
        font-size: 1.8rem;
    }
    
    .webcam-captures-grid {
        grid-template-columns: 1fr;
    }
    
    .qr-container {
        flex-direction: column;
        text-align: center;
    }
}

/* Face Missing Lock Layout */
.question-container {
    position: relative;
}

.face-missing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: var(--radius-md);
    border: 2px dashed var(--accent-error);
    transition: all 0.3s ease;
}

.face-missing-message {
    text-align: center;
    padding: 30px;
    max-width: 400px;
}

.face-missing-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    animation: pulse-warn 1.5s infinite;
}

.face-missing-message h3 {
    color: var(--accent-error);
    font-size: 1.3rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.face-missing-message p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.5;
}

@keyframes pulse-warn {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Student Dashboard Attendance Layout */
.student-attendance-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    align-items: flex-start;
}

@media (max-width: 768px) {
    .student-attendance-grid {
        grid-template-columns: 1fr;
    }
}

.student-attendance-summary {
    padding: 25px;
    text-align: center;
}

.student-attendance-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.student-attendance-rate {
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent-primary);
    margin: 15px 0;
}

.student-attendance-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 0.85rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
    margin-top: 15px;
    text-align: left;
}

.student-attendance-logs-card {
    padding: 25px;
}

.student-attendance-logs-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.student-attendance-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}

/* ==========================================
   MODERN TOP NAVBAR & RESPONSIVE NAVIGATION
   ========================================== */
.admin-body {
    padding-top: 85px !important;
}

.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    z-index: 999;
    display: flex;
    align-items: center;
}

.top-navbar-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-navbar-brand-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
}

.top-navbar-brand .brand-icon {
    font-size: 1.6rem;
    color: var(--accent-primary);
}

.top-navbar-brand .brand-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.top-navbar-brand .brand-text strong {
    color: var(--accent-primary);
    font-weight: 800;
}

.top-navbar-toggler {
    display: none;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 1.3rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.top-navbar-toggler:hover {
    background: #e2e8f0;
}

.top-navbar-collapse {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    margin-left: 20px;
}

.top-navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.top-navbar-nav .nav-item {
    display: inline-block;
}

.top-navbar-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.top-navbar-nav .nav-link .nav-icon {
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.top-navbar-nav .nav-link:hover {
    background: #f1f5f9;
    color: var(--accent-primary);
}

.top-navbar-nav .nav-link:hover .nav-icon {
    color: var(--accent-primary);
}

.top-navbar-nav .nav-link.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--accent-primary);
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.06);
}

.top-navbar-nav .nav-link.active .nav-icon {
    color: var(--accent-primary);
}

/* Nav Chevron for dropdown toggles */
.nav-chevron {
    font-size: 0.7rem;
    margin-left: 2px;
    transition: transform 0.2s ease;
}

.nav-dropdown-toggle[aria-expanded="true"] .nav-chevron,
.nav-dropdown-item:has(.show) .nav-chevron {
    transform: rotate(180deg);
}

/* Nav Group Dropdowns */
.nav-dropdown-item {
    position: relative;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12);
    padding: 6px 0;
    z-index: 1000;
}

.nav-dropdown-menu.show {
    display: block;
    animation: fadeIn 0.15s ease;
}

.nav-dropdown-link {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.87rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.nav-dropdown-link i {
    font-size: 1rem;
    color: var(--text-secondary);
}

.nav-dropdown-link:hover {
    background: #f1f5f9;
    color: var(--accent-primary);
}

.nav-dropdown-link:hover i {
    color: var(--accent-primary);
}

.nav-dropdown-link.active {
    background: #eff6ff;
    color: var(--accent-primary);
    font-weight: 700;
}

.nav-dropdown-link.active i {
    color: var(--accent-primary);
}

/* User Dropdown */
.top-navbar-user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 15px;
}

.user-dropdown-container {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 5px 12px 5px 6px;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
}

.user-dropdown-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.2;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.user-role-badge {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 210px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12);
    padding: 8px 0;
    display: none;
    z-index: 1000;
}

.user-dropdown-menu.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: #f8fafc;
}

.dropdown-item i {
    font-size: 1.1rem;
}

.dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 6px 0;
}

/* Mobile & Tablet Styles for Navbar */
@media (max-width: 1180px) {
    .top-navbar-nav .nav-link span {
        display: none;
    }
    .top-navbar-nav .nav-link {
        padding: 8px 10px;
    }
    .top-navbar-nav .nav-link .nav-icon {
        font-size: 1.25rem;
    }
}

@media (max-width: 991px) {
    .admin-body {
        padding-top: 68px !important;
    }
    .top-navbar-container {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 15px;
    }
    .top-navbar {
        height: auto;
    }
    .top-navbar-toggler {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .top-navbar-collapse {
        display: none;
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #e2e8f0;
        gap: 15px;
    }
    .top-navbar-collapse.show {
        display: flex;
    }
    .top-navbar-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    .top-navbar-nav .nav-link span {
        display: inline;
    }
    .top-navbar-nav .nav-link {
        padding: 10px 14px;
        width: 100%;
        justify-content: flex-start;
    }
    .top-navbar-user-actions {
        margin-left: 0;
        justify-content: space-between;
        padding-top: 8px;
        border-top: 1px dashed #e2e8f0;
    }
    .user-dropdown-menu {
        right: auto;
        left: 0;
        width: 100%;
    }
    /* Mobile: nav dropdowns become static/inline */
    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-left: 3px solid #bfdbfe;
        border-radius: 0;
        padding: 4px 0 4px 10px;
        margin: 4px 0 4px 14px;
        background: #f8fafc;
    }
}
