/* ===== File Upload Area Styles ===== */
.upload-area {
    margin-bottom: 2rem;
}
/* ===== File Upload Area Styles ===== */
.upload-area {
    margin-bottom: 2rem;
}
.upload-drop-zone {
    border: 2px dashed #3b82f6;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(59,130,246,0.04), rgba(37,99,235,0.03));
    padding: 2rem 1.5rem;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    position: relative;
}
.upload-drop-zone.dragover {
    border-color: #2563eb;
    background: linear-gradient(135deg, rgba(59,130,246,0.10), rgba(37,99,235,0.08));
}
.upload-icon {
    font-size: 2.5rem;
    color: #3b82f6;
    margin-bottom: 0.5rem;
}
.upload-text {
    font-size: 1.1rem;
    color: #3b82f6;
    margin-bottom: 0.2rem;
}
.upload-browse {
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}
.upload-browse:hover {
    color: #6a1b9a;
}
.upload-subtext {
    color: #999da3;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}
.upload-file-list {
    margin-top: 1rem;
    text-align: left;
}
.upload-file-item {
    background: linear-gradient(135deg, rgba(59,130,246,0.07), rgba(37,99,235,0.05));
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1rem;
    color: #3c4043;
    box-shadow: 0 2px 8px rgba(59,130,246,0.04);
}
.upload-file-item:last-child {
    margin-bottom: 0;
}
.upload-file-icon {
    font-size: 1.2rem;
    color: #3b82f6;
}
.upload-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-file-size {
    color: #999da3;
    font-size: 0.92rem;
    margin-left: 0.5rem;
}
@media (max-width: 768px) {
    .upload-drop-zone {
        padding: 1.2rem 0.5rem;
    }
}

/* ===== Design System ===== */
:root {
    /* Color Palette */
    --primary: #4285F4;
    --primary-dark: #3367D6;
    --secondary: #34A853;
    --secondary-dark: #2D8E49;
    --accent: #EA4335;
    --accent-dark: #D33426;
    --warning: #FBBC05;
    --warning-dark: #F9AB00;
    --light: #f8f9fa;
    --medium: #999da3;
    --dark: #5f6368;
    --darker: #3c4043;
    --white: #ffffff;
    --black: #000000;
    
    /* Typography */
    --font-main: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 1rem;
    --line-height: 1.5;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Effects */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --blur-effect: blur(10px);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    
    /* Glass morphism */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: 1px solid rgba(255, 255, 255, 0.18);
    --glass-bg-dark: rgba(0, 0, 0, 0.6);
    --glass-border-dark: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dark Mode Variables */
.dark-mode {
    --glass-bg: var(--glass-bg-dark);
    --glass-border: var(--glass-border-dark);
    --dark: #e8eaed;
    --darker: #ffffff;
    --light: #202124;
    --medium: #5f6368;
}

/* Animations */
@keyframes gradientFlow {
    0%, 100% {
        background-position: 17% 0%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--dark);
    background: linear-gradient(135deg, #f5f5ff 0%, #f9f9ff 50%, #ffffff 100%);
    min-height: 100vh;
    transition: background-color var(--transition-normal);
    position: relative;
    overflow-x: hidden;
}

body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: var(--darker);
}

/* Floating Background Icons & Emojis */
.floating-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.float-icon,
.float-emoji {
    position: absolute;
    font-size: 2rem;
    color: #999;
    opacity: 0.15;
    animation: floatUp linear infinite;
}

.float-emoji {
    opacity: 0.12;
}

/* Individual positioning and timing */
.float-icon:nth-child(1), .float-emoji:nth-child(1) { left: 3%; animation-duration: 28s; animation-delay: 0s; font-size: 1.8rem; }
.float-icon:nth-child(2), .float-emoji:nth-child(2) { left: 8%; animation-duration: 32s; animation-delay: 1s; font-size: 2rem; }
.float-icon:nth-child(3), .float-emoji:nth-child(3) { left: 12%; animation-duration: 26s; animation-delay: 3s; font-size: 1.5rem; }
.float-icon:nth-child(4), .float-emoji:nth-child(4) { left: 17%; animation-duration: 30s; animation-delay: 2s; font-size: 2.2rem; }
.float-icon:nth-child(5), .float-emoji:nth-child(5) { left: 22%; animation-duration: 29s; animation-delay: 4s; font-size: 1.7rem; }
.float-icon:nth-child(6), .float-emoji:nth-child(6) { left: 27%; animation-duration: 31s; animation-delay: 1s; font-size: 2.1rem; }
.float-icon:nth-child(7), .float-emoji:nth-child(7) { left: 32%; animation-duration: 27s; animation-delay: 5s; font-size: 1.9rem; }
.float-icon:nth-child(8), .float-emoji:nth-child(8) { left: 37%; animation-duration: 33s; animation-delay: 2s; font-size: 1.6rem; }
.float-icon:nth-child(9), .float-emoji:nth-child(9) { left: 42%; animation-duration: 28s; animation-delay: 0s; font-size: 2.3rem; }
.float-icon:nth-child(10), .float-emoji:nth-child(10) { left: 47%; animation-duration: 30s; animation-delay: 3s; font-size: 1.8rem; }
.float-icon:nth-child(11), .float-emoji:nth-child(11) { left: 52%; animation-duration: 26s; animation-delay: 4s; font-size: 2rem; }
.float-icon:nth-child(12), .float-emoji:nth-child(12) { left: 57%; animation-duration: 32s; animation-delay: 1s; font-size: 1.7rem; }
.float-icon:nth-child(13), .float-emoji:nth-child(13) { left: 62%; animation-duration: 29s; animation-delay: 5s; font-size: 2.2rem; }
.float-icon:nth-child(14), .float-emoji:nth-child(14) { left: 67%; animation-duration: 27s; animation-delay: 2s; font-size: 1.5rem; }
.float-icon:nth-child(15), .float-emoji:nth-child(15) { left: 72%; animation-duration: 31s; animation-delay: 0s; font-size: 1.9rem; }
.float-icon:nth-child(16), .float-emoji:nth-child(16) { left: 77%; animation-duration: 28s; animation-delay: 3s; font-size: 2.1rem; }
.float-icon:nth-child(17), .float-emoji:nth-child(17) { left: 82%; animation-duration: 30s; animation-delay: 4s; font-size: 1.6rem; }
.float-icon:nth-child(18), .float-emoji:nth-child(18) { left: 87%; animation-duration: 33s; animation-delay: 1s; font-size: 2.3rem; }
.float-icon:nth-child(19), .float-emoji:nth-child(19) { left: 92%; animation-duration: 26s; animation-delay: 5s; font-size: 1.8rem; }
.float-icon:nth-child(20), .float-emoji:nth-child(20) { left: 5%; animation-duration: 29s; animation-delay: 2s; font-size: 2rem; }
.float-icon:nth-child(21), .float-emoji:nth-child(21) { left: 10%; animation-duration: 31s; animation-delay: 0s; font-size: 1.7rem; }
.float-icon:nth-child(22), .float-emoji:nth-child(22) { left: 15%; animation-duration: 27s; animation-delay: 3s; font-size: 2.2rem; }
.float-icon:nth-child(23), .float-emoji:nth-child(23) { left: 20%; animation-duration: 32s; animation-delay: 4s; font-size: 1.5rem; }
.float-icon:nth-child(24), .float-emoji:nth-child(24) { left: 25%; animation-duration: 28s; animation-delay: 1s; font-size: 1.9rem; }
.float-icon:nth-child(25), .float-emoji:nth-child(25) { left: 30%; animation-duration: 30s; animation-delay: 5s; font-size: 2.1rem; }
.float-icon:nth-child(26), .float-emoji:nth-child(26) { left: 35%; animation-duration: 26s; animation-delay: 2s; font-size: 1.6rem; }
.float-icon:nth-child(27), .float-emoji:nth-child(27) { left: 40%; animation-duration: 29s; animation-delay: 0s; font-size: 2.3rem; }
.float-icon:nth-child(28), .float-emoji:nth-child(28) { left: 45%; animation-duration: 33s; animation-delay: 3s; font-size: 1.8rem; }
.float-icon:nth-child(29), .float-emoji:nth-child(29) { left: 50%; animation-duration: 27s; animation-delay: 4s; font-size: 2rem; }
.float-icon:nth-child(30), .float-emoji:nth-child(30) { left: 55%; animation-duration: 31s; animation-delay: 1s; font-size: 1.7rem; }
.float-icon:nth-child(31), .float-emoji:nth-child(31) { left: 60%; animation-duration: 28s; animation-delay: 5s; font-size: 2.2rem; }
.float-icon:nth-child(32), .float-emoji:nth-child(32) { left: 65%; animation-duration: 30s; animation-delay: 2s; font-size: 1.5rem; }
.float-icon:nth-child(33), .float-emoji:nth-child(33) { left: 70%; animation-duration: 32s; animation-delay: 0s; font-size: 1.9rem; }
.float-icon:nth-child(34), .float-emoji:nth-child(34) { left: 75%; animation-duration: 26s; animation-delay: 3s; font-size: 2.1rem; }
.float-icon:nth-child(35), .float-emoji:nth-child(35) { left: 80%; animation-duration: 29s; animation-delay: 4s; font-size: 1.6rem; }
.float-icon:nth-child(36), .float-emoji:nth-child(36) { left: 85%; animation-duration: 27s; animation-delay: 1s; font-size: 2.3rem; }
.float-icon:nth-child(37), .float-emoji:nth-child(37) { left: 90%; animation-duration: 31s; animation-delay: 5s; font-size: 1.8rem; }
.float-icon:nth-child(38), .float-emoji:nth-child(38) { left: 95%; animation-duration: 33s; animation-delay: 2s; font-size: 2rem; }
.float-icon:nth-child(39), .float-emoji:nth-child(39) { left: 7%; animation-duration: 28s; animation-delay: 0s; font-size: 1.7rem; }
.float-icon:nth-child(40), .float-emoji:nth-child(40) { left: 13%; animation-duration: 30s; animation-delay: 3s; font-size: 2.2rem; }
.float-icon:nth-child(41), .float-emoji:nth-child(41) { left: 18%; animation-duration: 26s; animation-delay: 4s; font-size: 1.5rem; }
.float-icon:nth-child(42), .float-emoji:nth-child(42) { left: 23%; animation-duration: 32s; animation-delay: 1s; font-size: 1.9rem; }
.float-icon:nth-child(43), .float-emoji:nth-child(43) { left: 28%; animation-duration: 29s; animation-delay: 5s; font-size: 2.1rem; }
.float-icon:nth-child(44), .float-emoji:nth-child(44) { left: 33%; animation-duration: 27s; animation-delay: 2s; font-size: 1.6rem; }
.float-icon:nth-child(45), .float-emoji:nth-child(45) { left: 38%; animation-duration: 31s; animation-delay: 0s; font-size: 2.3rem; }
.float-icon:nth-child(46), .float-emoji:nth-child(46) { left: 43%; animation-duration: 28s; animation-delay: 3s; font-size: 1.8rem; }
.float-icon:nth-child(47), .float-emoji:nth-child(47) { left: 48%; animation-duration: 30s; animation-delay: 4s; font-size: 2rem; }
.float-icon:nth-child(48), .float-emoji:nth-child(48) { left: 53%; animation-duration: 33s; animation-delay: 1s; font-size: 1.7rem; }

@keyframes floatUp {
    0% {
        bottom: -10%;
        transform: translateX(0) rotate(0deg);
        opacity: 0;
    }
    5% {
        opacity: 0.15;
    }
    95% {
        opacity: 0.15;
    }
    100% {
        bottom: 110%;
        transform: translateX(calc(var(--drift, 20px))) rotate(360deg);
        opacity: 0;
    }
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f5f5ff 0%, #f9f9ff 50%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

body.dark-mode .loading-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(66, 133, 244, 0.2);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 1.1rem;
    color: var(--medium);
    font-weight: 500;
    margin: 0;
}

input {
    min-width: 63px !important;
}

body.dark-mode .spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
}

body.dark-mode .loading-spinner p {
    color: #bbb;
}

body.dark-mode .loading-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

body.dark-mode .float-icon {
    color: #ccc;
    opacity: 0.08;
}

body.dark-mode .float-emoji {
    opacity: 0.06;
}

body.dark-mode input {
    background: var(--glass-bg-dark);
    color: #eeeeee;
}

body.dark-mode select,
body.dark-mode .question-set-select {
    background: var(--glass-bg-dark);
    color: #eeeeee;
    border-color: #444 !important;
}

body.dark-mode select option {
    background-color: #222;
    color: #eeeeee;
}

body.dark-mode .question-set-select option {
    background-color: #222;
    color: #eeeeee;
}

/* .question-limit-container input {
    background: #eeeeee;
} */

/* .question-limit-input::-webkit-inner-spin-button,
.question-limit-input::-webkit-outer-spin-button {
    margin: 0;
} */

/* Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-effect);
    padding: var(--space-md);
    box-shadow: var(--glass-shadow);
    border-bottom: var(--glass-border);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 1.25rem;
    margin-bottom: var(--space-xs);
    background: linear-gradient(90deg, 
        var(--primary) 0%, 
        var(--primary) 30%, 
        #FF9800 70%, 
        #FF6F00 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s ease-in-out infinite;
}

.header-left p {
    font-size: 0.875rem;
    color: var(--medium);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Main Content */
.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
    flex: 1;
    width: 100%;
}

/* Glass Card */
.g-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border-radius: 12px;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: var(--space-lg);
    transition: var(--transition-normal);
    margin-bottom: var(--space-md);
    width: 100%;
}

.user-management {
    display: flex;
    gap: 10px;
}
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border-radius: 12px;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: var(--space-lg);
    transition: var(--transition-normal);
    margin-bottom: var(--space-md);
    width: 100%;
}

/* Welcome Section */
.welcome-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.welcome-text h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-xs);
}

.welcome-text p {
    color: var(--medium);
}

.subscription-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  border-radius: 12px;
  margin: 15px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.3);
}

.badge-free { background: #e0e0e0; color: #333; }
.badge-daily { background: #4CAF50; color: white; }
.badge-monthly { background: #2196F3; color: white; }

.upgrade-prompt {
  background: rgba(255,255,255,0.1);
  padding: 10px 15px;
  border-radius: 8px;
  margin-top: 10px;
}

.btn-upgrade {
  background: #ff6b6b;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.profile-picture {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    cursor: pointer;
}

img {
    width: 100%;
}

/* Buttons */
.btn {
    padding: var(--space-sm) var(--space-md);
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
}

.btn.primary {
    background-color: var(--primary);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-dark);
}

.btn.secondary {
    background-color: var(--secondary);
    color: white;
}

.btn.secondary:hover {
    background-color: var(--secondary-dark);
}

.btn.accent {
    background-color: var(--accent);
    color: white;
}

.btn.accent:hover {
    background-color: var(--accent-dark);
}

.btn.warning {
    background-color: var(--warning);
    color: white;
}

.btn.warning:hover {
    background-color: var(--warning-dark);
}

.btn.text {
    background: none;
    color: var(--primary);
    padding: 0;
}

.btn.text:hover {
    text-decoration: underline;
}

.btn.small {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.875rem;
}

body.dark-mode .btn.small {
    backdrop-filter: var(--blur-effect);
    background-color: #1a1a2e;
    border: var(--glass-border-dark);
    color: var(--darker);
}

.btn.large {
    padding: var(--space-md) var(--space-lg);
    font-size: 1.125rem;
}

.icon-btn {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--dark);
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.dark-mode .icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--medium);
    border-radius: 4px;
    font-size: var(--font-size-base);
    transition: var(--transition-fast);
    background: var(--glass-bg);
}

body.dark-mode .form-control {
    background: var(--glass-bg-dark);
    border: var(--glass-border-dark);
    color: #fff;
}


.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.form-row {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Subject Grid */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.post-utme-fallback {
    margin-bottom: var(--space-lg);
}

.utme-fallback-details {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 12px;
    padding: var(--space-md);
    box-shadow: var(--glass-shadow);
}

.utme-fallback-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--darker);
    list-style: none;
}

.utme-fallback-details summary::-webkit-details-marker {
    display: none;
}

.utme-fallback-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: var(--space-md);
}

.subject-card.preview {
    opacity: 0.7;
    pointer-events: none;
}

.subject-card {
    background: var(--glass-bg);
    border-radius: 8px;
    padding: var(--space-md);
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: center;
    position: relative;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.subject-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.subject-card.selected {
    border-color: var(--primary);
    background-color: rgba(66, 133, 244, 0.1);
}

.subject-card.selected::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--primary);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Search Bar */
.search-container {
    margin-bottom: var(--space-lg);
}

.search-box {
    position: relative;
}


.search-box input {
    width: 100%;
    padding: var(--space-md) var(--space-md) var(--space-md) 40px;
    border-radius: 8px;
    border: var(--glass-border);
    background: var(--glass-bg);
    font-size: var(--font-size-base);
}

body.dark-mode .search-box input {
    background: var(--glass-bg-dark);
    border: var(--glass-border-dark);
    color: #fff;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--medium);
}

/* Test Interface */
.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--medium);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.test-tabs {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
}

.test-tab {
    padding: 8px 16px;
    border-radius: 4px;
    background-color: var(--glass-bg);
    color: var(--dark);
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
    transition: var(--transition-normal);
    border: var(--glass-border);
}

.test-tab.active {
    background-color: var(--primary);
    color: white;
}

.timer {
    background-color: var(--glass-bg);
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    color: var(--dark);
    min-width: 100px;
    text-align: center;
    border: var(--glass-border);
    flex-shrink: 0;
}

.timer.warning {
    color: var(--warning);
    animation: pulse 1s infinite;
}

.timer.danger {
    color: var(--accent);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popScore {
    0% { transform: scale(0.9); opacity: 0; }
    60% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); }
}

.question-container {
    margin-bottom: var(--space-lg);
    width: 100%;
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
    animation: floatIn 0.4s ease-out;
}

.question-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4285F4, #FF9800, #9C27B0);
    opacity: 0.75;
}

.question-number {
    font-size: 14px;
    color: var(--medium);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.question-text {
    font-size: 19px;
    margin-bottom: 20px;
    font-weight: 600;
    word-wrap: break-word;
    line-height: 1.6;
}

.question-image-container {
    margin: 15px 0 20px 0;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.question-image {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.option {
    padding: 14px 16px;
    border: 1px solid var(--medium);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    position: relative;
    background: var(--glass-bg);
    word-wrap: break-word;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.option:hover {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.06), rgba(255, 152, 0, 0.04));
    border-color: rgba(66, 133, 244, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(66, 133, 244, 0.12);
}

.option.selected {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.12), rgba(255, 152, 0, 0.08));
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(66, 133, 244, 0.16);
}

.option.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, #FFB74D, #FF9800);
    border-radius: 10px 0 0 10px;
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.35);
}

.option.selected-g {
    background: linear-gradient(135deg, rgba(87, 244, 66, 0.14), rgba(66, 193, 255, 0.08));
    border-color: #42f442;
}

.option.selected-g::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, #42f442, #34c759);
    border-radius: 10px 0 0 10px;
    box-shadow: 0 0 12px rgba(52, 199, 89, 0.28);
}

.option.selected-r {
    background: linear-gradient(135deg, rgba(244, 66, 66, 0.14), rgba(255, 152, 0, 0.08));
    border-color: #f44242;
}

.option.selected-r::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, #f44242, #ff6f61);
    border-radius: 10px 0 0 10px;
    box-shadow: 0 0 12px rgba(244, 66, 66, 0.28);
}

.navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--medium);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.nav-btn {
    padding: 10px 20px;
    border-radius: 4px;
    background-color: var(--glass-bg);
    color: var(--dark);
    border: none;
    cursor: pointer;
    transition: var(--transition-normal);
    border: var(--glass-border);
    flex-shrink: 0;
}

.nav-btn:hover {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.14), rgba(255, 152, 0, 0.12));
    box-shadow: 0 8px 20px rgba(66, 133, 244, 0.12);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.question-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.question-indicator {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--glass-bg);
    color: var(--dark);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.25s ease;
    font-size: 14px;
    border: var(--glass-border);
    flex-shrink: 0;
}

.question-indicator.answered {
    background-color: var(--secondary);
    color: white;
}

.question-indicator.current {
    background-color: var(--primary);
    color: white;
    transform: scale(1.1);
}

.question-indicator:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 18px rgba(66, 133, 244, 0.15);
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.14), rgba(255, 152, 0, 0.1));
}

.submit-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
}

.submit-btn:hover {
    background-color: var(--accent-dark);
    box-shadow: 0 1px 2px 0 rgba(234, 67, 53, 0.3), 0 1px 3px 1px rgba(234, 67, 53, 0.15);
}

/* Results Interface */
.results-container {
    width: 100%;
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: var(--space-lg);
    animation: floatIn 0.45s ease-out;
}

.results-container h2 {
    color: var(--primary);
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
}

.results-image {
    min-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    text-align: center;
}

.results-image img {
    border-radius: 50%;
    width: 100px;
    height: 100px;
}

.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 30px;
    table-layout: fixed;
    background: var(--glass-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

.results-table th, .results-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--medium);
    word-wrap: break-word;
}

.results-table th {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.12), rgba(255, 152, 0, 0.08));
    color: var(--dark);
    font-weight: 600;
    border-bottom: 1px solid rgba(66, 133, 244, 0.15);
}

.results-table tr:hover {
    background-color: rgba(66, 133, 244, 0.05);
}

.total-score {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin: 30px 0;
    color: var(--primary);
    background: linear-gradient(135deg, #4285F4, #FF9800, #9C27B0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: popScore 0.6s ease-out;
}

.restart-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    display: block;
    margin: 0 auto;
}

.restart-btn:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 1px 2px 0 rgba(66, 133, 244, 0.3), 0 1px 3px 1px rgba(66, 133, 244, 0.15);
}

.message-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.message-dialog-content {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border-radius: 16px;
    border: var(--glass-border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 500px;
    padding: var(--space-xl);
    position: relative;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--dark);
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-dialog-content p {
    margin: 0;
    color: var(--dark);
}

.message-dialog-content p.c.info {
    color: var(--primary);
    font-weight: 500;
}

.message-dialog-content p.c.error {
    color: var(--accent);
    font-weight: 600;
}

.message-dialog-content p.c.alert {
    color: var(--accent);
    font-weight: 600;
}

.message-dialog-content p.c.prompt {
    color: var(--darker);
    font-weight: 500;
}

.message-dialog-content p.c.success {
    color: var(--secondary);
    font-weight: 600;
}

.wiggle {
    animation: wiggle 1.4s ease-in-out infinite;
}

.c.info {
    color: #5f6368;
}

.c.error {
    color: #ff4848;
}

.c.alert {
    color: #ff4848;
    animation: blink 1s ease-in-out infinite;
}

.c.prompt {
    color: #585f68;
}

.c.success {
    color: #6abe6a;
}

/* .body.dark-mode .c.info, .c.prompt, .c.alert {
    color: #e0e7ec;
} */

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.close-message {
    position: absolute;
    top: 18px;
    right: 18px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--medium);
    transition: all 0.2s ease;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-message:hover {
    color: var(--dark);
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .close-message:hover {
    background: rgba(255, 255, 255, 0.1);
}

.message-dialog-actions {
    margin-top: var(--space-lg);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.message-dialog-actions .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.message-dialog-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== Explanation FAB ===== */
.explanation-fab {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff9800, #ffc107);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(255, 152, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    z-index: 1001;
}

.explanation-fab:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 24px rgba(255, 152, 0, 0.45);
}

.explanation-fab.hidden {
    opacity: 0;
    pointer-events: none;
}

body.dark-mode .explanation-fab {
    background: linear-gradient(135deg, #ffb74d, #ff9800);
    box-shadow: 0 10px 22px rgba(255, 152, 0, 0.4);
}

.btn.no {
    background-color: var(--accent);
    color: white;
}

body.dark-mode .message-dialog-content {
    background: var(--glass-bg-dark);
    border: var(--glass-border-dark);
    color: var(--darker);
}

body.dark-mode .message-dialog-content p {
    color: var(--darker);
}

body.dark-mode .message-dialog-content p.c.info {
    color: var(--primary);
}

body.dark-mode .message-dialog-content p.c.error {
    color: #ff6b6b;
}

body.dark-mode .message-dialog-content p.c.alert {
    color: #ff6b6b;
}

body.dark-mode .message-dialog-content p.c.success {
    color: #51cf66;
}

body.dark-mode .message-dialog-actions {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    animation: modalFadeIn 0.3s ease-in-out forwards;
}

/* Side panel variant for profile */
.modal.side-panel {
    justify-content: flex-end;
    align-items: stretch;
    animation: none;
    background-color: rgba(0, 0, 0, 0.3);
    opacity: 1;
}

.modal.side-panel .modal-content {
    animation: slideInRight 0.4s ease-in-out forwards;
    border-radius: 0;
    width: 100%;
    max-width: 450px;
    max-height: 100vh;
    margin: 0;
}

.modal.hidden {
    display: none;
}

.modal.hidden.side-panel .modal-content {
    animation: slideOutRight 0.4s ease-in-out forwards;
}

@keyframes modalFadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-effect);
    border-radius: 12px;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.profile-dialog {
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border: none;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

/* Profile metrics cards */
.profile-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.metric-card {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 12px;
    padding: var(--space-md);
    box-shadow: var(--glass-shadow);
}

.metric-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    color: var(--primary);
    font-weight: 600;
}

.metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(66, 133, 244, 0.12);
    color: var(--primary);
}

.metric-label {
    font-size: 0.95rem;
}

.metric-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--darker);
    margin-bottom: var(--space-xs);
}

.metric-subtext {
    font-size: 0.875rem;
    color: var(--medium);
    margin-top: var(--space-xs);
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.progress-fill {
    position: relative;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: var(--space-xs);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
}

.progress-text {
    position: relative;
    z-index: 1;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.modal-content::-webkit-scrollbar {
    display: none;
}

.modal-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: var(--space-md);
}

.modal-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--medium);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* Profile Dialog */
.profile-dialog .profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.profile-dialog .profile-picture-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 2rem;
    flex-shrink: 0;
    flex: 0 0 100px;
}

/* Profile dialog enhanced layout */
.profile-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.profile-card {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 12px;
    padding: var(--space-md);
    box-shadow: var(--glass-shadow);
}

.hero-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.profile-identity {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    min-width: 0;
}

.profile-identity > div:last-child {
    min-width: 0;
    flex: 1;
}

.profile-identity h3,
.profile-identity p {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-tags {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
    flex-wrap: wrap;
}

.tag {
    background: rgba(66, 133, 244, 0.12);
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.profile-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-sm);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-label {
    font-size: 0.9rem;
    color: var(--medium);
}

.pill-input {
    border: var(--glass-border);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--darker);
}

.pill-input[readonly] {
    cursor: default;
}

.insight-card .card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.card-title {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 700;
    color: var(--primary);
}

.caption {
    font-size: 0.85rem;
}

.muted {
    color: var(--medium);
}

/* AI Buddy Button */
.ai-buddy-button {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7ac0ff, #2e9aff, #0066cc);
    background-size: 200% 200%;
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(46, 154, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    animation: aiPulse 2s ease-in-out infinite, gradientShift 4s ease infinite;
}

@keyframes aiPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(46, 154, 255, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(46, 154, 255, 0.6), 0 0 20px rgba(122, 192, 255, 0.3);
    }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.ai-buddy-button:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 35px rgba(46, 154, 255, 0.5), 0 0 25px rgba(122, 192, 255, 0.4);
}

.ai-buddy-button i {
    animation: robotBounce 1s ease-in-out infinite;
}

@keyframes robotBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Help Button */
.help-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: all 0.3s ease;
}

.help-button:hover {
    transform: scale(1.1);
    background-color: var(--primary-dark);
}

.help-button svg {
    width: 24px;
    height: 24px;
}

/* Help Dialog */
.help-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.help-dialog-content {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-effect);
    border-radius: 12px;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    width: 90%;
    max-width: 500px;
    padding: var(--space-lg);
    position: relative;
}

.close-help {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
}

.developer-info {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.dark-mode .developer-info {
    background-color: rgba(255, 255, 255, 0.05);
}


.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-card {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: var(--blur-effect);
    border-radius: 12px;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    width: 90%;
    max-width: 500px;
    padding: var(--space-lg);
    position: relative;
    font-size: large;
}

.auth-btns {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.btn.secondary.google-btn {
    background-color: #3367D6;
}

.dark-mode .auth-modal {
    background-color: rgba(0, 0, 0, 0.97);
}

.dark-mode .auth-card {
    background-color: rgba(12, 12, 12, 0.5);
    color: #eeeeee;
}

/* Auth Page Styles */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    position: relative;
    z-index: 1;
}

.auth-page-content {
    max-width: 500px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
}

.auth-logo {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, 
        var(--primary) 0%, 
        var(--primary) 30%, 
        #FF9800 70%, 
        #FF6F00 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s ease-in-out infinite;
    margin-bottom: var(--space-xs);
}

.auth-tagline {
    color: var(--medium);
    font-size: 1rem;
}

.auth-page-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-effect);
    border-radius: 16px;
    border: var(--glass-border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.auth-welcome h2 {
    font-size: 1.8rem;
    color: var(--darker);
    margin-bottom: var(--space-xs);
}

.auth-welcome p {
    color: var(--medium);
    font-size: 1rem;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.feature-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--dark);
}

.feature-item i {
    color: var(--secondary);
    font-size: 1.2rem;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.btn-auth {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.google-btn {
    background: #4285F4;
    color: white;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.google-btn:hover {
    background: #3367D6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
}

.google-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-footer-text {
    text-align: center;
}

.auth-footer-text p {
    color: var(--medium);
    font-size: 0.85rem;
}

.auth-page-footer {
    text-align: center;
    color: var(--medium);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.theme-toggle-container {
    display: flex;
    justify-content: center;
}


/* Footer */
footer {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-effect);
    padding: var(--space-md);
    text-align: center;
    color: var(--medium);
    font-size: 14px;
    box-shadow: 0 -1px 2px 0 rgba(60,64,67,0.1), 0 -1px 3px 1px rgba(60,64,67,0.1);
    margin-top: var(--space-lg);
    border-top: var(--glass-border);
    width: 100%;
}

/* Collapsible Section */
.collapsible {
    margin-bottom: var(--space-md);
    width: 100%;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--glass-bg);
    border-radius: 8px;
    cursor: pointer;
    border: var(--glass-border);
}

/* Instruction Cards Section */
.section-subtitle {
    font-size: 0.95rem;
    color: var(--medium);
    margin-top: var(--space-xs);
    font-weight: 500;
}

.instruction-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.instruction-card {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.08), rgba(66, 133, 244, 0.04));
    border: 1px solid rgba(66, 133, 244, 0.2);
    border-radius: 12px;
    padding: var(--space-md);
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.instruction-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(66, 133, 244, 0.12);
    transform: translateY(-2px);
}

.instruction-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
    display: inline-block;
}

.instruction-card h4 {
    color: var(--primary);
    margin-bottom: var(--space-xs);
    font-size: 1.05rem;
    font-weight: 700;
}

.instruction-card p {
    color: var(--medium);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Profile Section Card */
.profile-section-card {
    border: var(--glass-border);
}

.profile-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: var(--glass-border);
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-section-header:hover {
    background: rgba(66, 133, 244, 0.04);
}

.header-content {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex: 1;
}

.profile-section-header i {
    font-size: 1.8rem;
    color: var(--primary);
}

.profile-section-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--darker);
}

.expand-toggle {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.profile-section-content {
    padding: var(--space-md);
    display: none;
}

.profile-section-content.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.profile-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.field-wrapper {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.field-icon {
    font-size: 1.8rem;
    margin-top: 2px;
}

.field-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--darker);
}

.field-input {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.field-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
    outline: none;
}

.btn-save-profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-save-profile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(66, 133, 244, 0.25);
}

/* Test Config Section */
.test-config-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.duration-card {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 12px;
    padding: var(--space-md);
    display: flex;
    gap: var(--space-md);
    align-items: center;
    box-shadow: var(--glass-shadow);
}

.duration-card .card-icon {
    font-size: 2.5rem;
    min-width: 60px;
    text-align: center;
}

.duration-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.duration-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--darker);
}

.duration-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.duration-input {
    width: 100px;
    padding: 10px 12px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    background: var(--white);
    transition: all 0.3s ease;
}

.duration-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2);
}

/* Dark mode for duration input */
body.dark-mode .duration-input {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}

.duration-unit {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--medium);
}

.duration-hint {
    font-size: 0.85rem;
    color: var(--medium);
    margin: 0;
}

.btn-start-test {
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
}

.btn-start-test:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(66, 133, 244, 0.35);
}

.btn-start-test:active {
    transform: translateY(-1px);
}

/* Alert Card */
.alert-card {
    border-radius: 12px;
    padding: var(--space-md);
    display: flex;
    gap: var(--space-md);
    border-left: 4px solid;
}

.alert-info {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.08), rgba(66, 133, 244, 0.04));
    border-left-color: var(--primary);
    border: 1px solid rgba(66, 133, 244, 0.2);
    border-left: 4px solid var(--primary);
}

.alert-icon {
    font-size: 1.8rem;
    min-width: 50px;
    text-align: center;
}

.alert-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.alert-message {
    font-size: 0.95rem;
    color: var(--medium);
    margin: 0;
    line-height: 1.5;
}

.alert-message strong {
    color: var(--darker);
    font-weight: 600;
}

.alert-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: 4px;
}

.alert-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(66, 133, 244, 0.1);
}

.alert-link:hover {
    background: rgba(66, 133, 244, 0.15);
    transform: translateX(2px);
}

.collapsible-content {
    padding: 0 var(--space-md);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible.active .collapsible-content {
    max-height: 500px;
    padding: var(--space-md);
}

/* Utility Classes */
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.text-center { text-align: center; gap: 100px; display: flex; flex-direction: column;}
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* Responsive */
@media (max-width: 768px) {
    .app-main {
        padding: var(--space-md);
    }
    
    .modal-content {
        width: 95%;
    }

    .modal.side-panel .modal-content {
        max-width: 100%;
        border-radius: 8px 0 0 8px;
    }
    
    .form-row {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .subject-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .test-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .test-tabs {
        width: 100%;
        padding-bottom: 5px;
    }
    
    .welcome-section {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
    }
    
    .navigation {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .question-indicators {
        order: -1;
    }
}

@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

#home {
    cursor: pointer;
}

/* Explanation glass button */
.explain-control { display:flex; justify-content:flex-end; }
.explain-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  color: var(--dark);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(66, 133, 244, 0.08);
  backdrop-filter: var(--blur-effect);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:600;
  min-width:160px;
}

/* shine animation */
@keyframes shine {
  0% { box-shadow: 0 6px 18px rgba(66,133,244,0.04); transform: translateY(0); }
  50% { box-shadow: 0 10px 26px rgba(66,133,244,0.14); transform: translateY(-2px); }
  100% { box-shadow: 0 6px 18px rgba(66,133,244,0.04); transform: translateY(0); }
}

/* apply shine when available (button present) */
.explain-btn {
  animation: shine 2.2s ease-in-out infinite;
}

/* subtle hover */
.explain-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(66,133,244,0.18);
}

/* dark mode adjustments */
body.dark-mode .explain-btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  color: var(--darker);
  border: 1px solid rgba(255,255,255,0.06);
}

/* Admin results card — responsive fixes so chart doesn't overflow on mobile */
.admin-result-card {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;          /* allow items to wrap on narrow screens */
  box-sizing: border-box;
  width: 100%;
  padding: 10px;
}

.admin-result-card img {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 50%;
}

.admin-result-card .meta {
  flex: 1 1 auto;           /* allow meta block to shrink */
  min-width: 0;             /* allow text to wrap instead of overflowing */
  overflow: hidden;
}

.admin-result-card .chart-wrap {
  flex: 0 0 120px;          /* reserve space but allow container to resize */
  max-width: 120px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure chart internals scale */
.admin-result-card .chart-container,
.admin-result-card .edge-circle {
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
}

/* Smaller mobile adjustments */
@media (max-width: 480px) {
  .admin-result-card {
    align-items: flex-start;
    gap: 10px;
    padding: 8px;
  }

  .admin-result-card img {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
  }

  .admin-result-card .chart-wrap {
    flex: 0 0 72px;
    max-width: 72px;
    width: 72px;
    height: 72px;
  }

  /* make meta block full width when space is tight */
  .admin-result-card .meta {
    width: calc(100% - 72px - 12px);
  }
}

.math-container {
    overflow-x: auto;
}

.katex, .katex-display {
    font-size: 1.1em;
}

/* Prevent line breaks in inline math */
.math-inline {
    white-space: nowrap;
}

/* AI Chat Panel Styles */
.ai-chat-panel {
    display: flex;
    position: fixed;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    
}

.ai-chat-panel .modal-header {
    flex-shrink: 0;
    background: linear-gradient(135deg, #7ac0ff 0%, #2e9aff 50%, #0066cc 100%);
    color: white;
    padding: 1.5rem;
    border-bottom: none;
}

/* .tester {
    color: #2e9aff
} */

.ai-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ai-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    animation: aiGlow 2s ease-in-out infinite;
}

@keyframes aiGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
}

.ai-chat-panel .modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: white;
}

.ai-status {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.ai-chat-panel .icon-btn {
    color: white;
}

.ai-chat-panel .icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--glass-bg);
    min-height: 0;
}

/* Custom scrollbar for AI chat */
.ai-chat-body::-webkit-scrollbar {
    width: 8px;
}

.ai-chat-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.ai-chat-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #7ac0ff, #2e9aff, #0066cc);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.ai-chat-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #93c5fd, #60a5fa, #3b82f6);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.message-avatar.ai {
    background: linear-gradient(135deg, #7ac0ff, #2e9aff, #0066cc);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    color: white;
}

.message-avatar.user {
    background: linear-gradient(135deg, #93c5fd, #60a5fa);
    color: white;
}

.message-content {
    max-width: 75%;
    padding: 0.875rem 1.125rem;
    border-radius: 16px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
}

/* Markdown formatting in messages */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 0.75rem 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.3;
}

.message-content h1 { font-size: 1.5rem; }
.message-content h2 { font-size: 1.25rem; }
.message-content h3 { font-size: 1.1rem; }

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
    margin-top: 0;
}

.message-content strong {
    font-weight: 600;
    color: inherit;
}

.message-content em {
    font-style: italic;
}

.message-content code {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--primary);
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
    max-width: 100%;
}

.message-content pre code {
    background: none;
    padding: 0;
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
}

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content ul {
    list-style-type: disc;
}

.message-content ol {
    list-style-type: decimal;
}

.message-content li {
    margin: 0.25rem 0;
    line-height: 1.6;
}

.message-content br + br {
    display: block;
    content: "";
    margin-top: 0.5rem;
}

/* KaTeX math rendering in messages */
.message-content .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    margin: 0.5rem 0;
    padding: 0.25rem 0;
}

.message-content .katex {
    font-size: 1em;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.message-content .katex-display > .katex {
    display: inline-block;
    max-width: 100%;
}

/* Add scrollbar styling for math overflow */
.message-content .katex-display::-webkit-scrollbar,
.message-content .katex::-webkit-scrollbar {
    height: 4px;
}

.message-content .katex-display::-webkit-scrollbar-thumb,
.message-content .katex::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.chat-message.ai .message-content {
    background: linear-gradient(135deg, rgba(122, 192, 255, 0.05), rgba(46, 154, 255, 0.08), rgba(0, 102, 204, 0.04));
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    border: 1px solid rgba(46, 154, 255, 0.2);
    color: var(--darker);
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, #60a5fa, #3b82f6, #2563eb);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: var(--medium);
    margin-top: 0.25rem;
    display: block;
}

.chat-message.user .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
}

/* Read More/Less functionality */
.read-more-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message-text-truncated {
    display: block;
    max-height: 180px;
    overflow: hidden;
    position: relative;
    line-height: 1.5;
}

/* Gradient fade-out effect at bottom of truncated text */
.message-text-truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, #ffffff80);
    pointer-events: none;
}

body.dark-mode .message-text-truncated::after {
    background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.9));
}

body.dark-mode .chat-message.ai .message-text-truncated::after {
    background: linear-gradient(to bottom, transparent, rgba(0, 102, 204, 0.35));
}

body.dark-mode .chat-message.user .message-text-truncated::after {
    background: linear-gradient(to bottom, transparent, rgba(37, 99, 235, 0.85));
}

.message-text-full {
    display: none;
    line-height: 1.5;
    word-wrap: break-word;
}

.read-more-btn {
    align-self: flex-start;
    background: none;
    border: none;
    color: #4257f4;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    padding: 0.25rem 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    
}

.read-more-btn:hover {
    color: #FFA500;
    transform: translateX(2px);
}

.read-more-btn:active {
    transform: translateX(0);
}

.typing-indicator {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 0;
    animation: messageSlideIn 0.3s ease-out;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0.875rem 1.125rem;
    background: linear-gradient(135deg, rgba(122, 192, 255, 0.15), rgba(46, 154, 255, 0.15));
    border: 1px solid rgba(46, 154, 255, 0.25);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7ac0ff, #2e9aff, #0066cc);
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

.ai-chat-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    border-top: var(--glass-border);
    position: relative;
}

.scroll-to-bottom-btn {
    position: absolute;
    bottom: 80px;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7ac0ff, #2e9aff);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(46, 154, 255, 0.4);
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 1rem;
}

.scroll-to-bottom-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(46, 154, 255, 0.6);
}

.scroll-to-bottom-btn:active {
    transform: scale(0.95);
}

.chat-input-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

#chatInput {
    flex: 1;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    border: var(--glass-border);
    background: rgba(255, 255, 255, 0.9);
    font-family: var(--font-main);
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    transition: all 0.2s ease;
}

#chatInput:focus {
    outline: none;
    border-color: #4285F4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7ac0ff, #2e9aff, #0066cc);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 154, 255, 0.4), 0 2px 8px rgba(0, 102, 204, 0.3);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn i {
    font-size: 1rem;
}

/* Dark mode adjustments */
body.dark-mode .ai-chat-body {
    background: var(--glass-bg-dark);
}

body.dark-mode .ai-chat-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .ai-chat-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #7ac0ff, #2e9aff, #0066cc);
}

body.dark-mode .ai-chat-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #93c5fd, #60a5fa, #3b82f6);
}

body.dark-mode .chat-message.ai .message-content {
    background: linear-gradient(135deg, rgba(122, 192, 255, 0.12), rgba(46, 154, 255, 0.15), rgba(0, 102, 204, 0.08));
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    border-color: rgba(46, 154, 255, 0.3);
    color: var(--darker);
}

body.dark-mode .message-content code {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .message-content pre {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #5294ff;
}

body.dark-mode #chatInput {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--darker);
}

body.dark-mode .typing-dots {
    background: linear-gradient(135deg, rgba(122, 192, 255, 0.2), rgba(46, 154, 255, 0.2));
    border-color: rgba(46, 154, 255, 0.35);
}

body.dark-mode .ai-chat-footer {
    background: var(--glass-bg-dark);
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .ai-buddy-button {
        bottom: 100px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .help-button {
        right: 20px;
        width: 50px;
        height: 50px;
    }

    .message-content {
        max-width: 85%;
    }

    .ai-chat-panel .modal-header {
        padding: 1rem;
    }
}

/* ===== Offline Indicator ===== */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    display: none;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    align-items: center;
    gap: 8px;
    animation: slideInUp 0.3s ease-out;
}

.offline-indicator i {
    font-size: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Offline mode restrictions */
.offline-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.offline-disabled::after {
    content: 'Not available in offline mode';
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    display: none;
}

.offline-disabled:hover::after {
    display: block;
}

/* ===== Mode Toggle Slider Switch ===== */
.mode-toggle-section {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.mode-selector {
    display: flex;
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 240, 250, 0.9));
    border-radius: 50px;
    padding: 0.5rem;
    border: 2px solid rgba(66, 133, 244, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    gap: 0.5rem;
    max-width: 500px;
    width: 100%;
}

.dark-mode .mode-selector {
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.9), rgba(40, 40, 60, 0.9));
    border-color: rgba(66, 133, 244, 0.3);
}

.mode-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 40px;
    background: transparent;
    color: var(--dark);
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition-normal);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    z-index: 1;
}

.mode-btn i {
    font-size: 1.5rem;
    transition: all var(--transition-normal);
}

.mode-btn small {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
}

/* Active State - Torch Light Effect */
.mode-btn.active {
    background: linear-gradient(135deg, #4285F4 0%, #3367D6 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(66, 133, 244, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.mode-btn.active small {
    color: rgba(255, 255, 255, 0.95);
    opacity: 0.95;
}

.mode-btn.active i {
    transform: scale(1.15);
}

/* Hover State */
.mode-btn:hover:not(.active) {
    background: rgba(66, 133, 244, 0.1);
    color: var(--primary);
}

.mode-btn:hover:not(.active) i {
    transform: scale(1.1);
}

.dark-mode .mode-btn:hover:not(.active) {
    background: rgba(66, 133, 244, 0.15);
    color: #5a9fff;
}

/* Responsive */
@media (max-width: 600px) {
    .mode-btn {
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
    }

    .mode-btn small {
        font-size: 0.65rem;
    }

    .mode-btn i {
        font-size: 1.2rem;
    }

    .mode-selector {
        max-width: 100%;
    }
}

/* Question Limit Input - Spinner Buttons */
.question-limit-input::-webkit-inner-spin-button,
.question-limit-input::-webkit-outer-spin-button {
    background-color: #fefefe;
    color: #fff;
    border: 1px solid #999;
    border-radius: 3px;
    cursor: pointer;
    margin: 0 2px;
    padding: 0;
    opacity: 1;
    transition: all 0.2s ease;
    width: 10px;
}

.question-limit-input::-webkit-inner-spin-button:hover,
.question-limit-input::-webkit-outer-spin-button:hover {
    background-color: #555;
    opacity: 1;
    color: #fff;
}

/* Firefox spin button styling */
.question-limit-input[type=number] {
    -moz-appearance: textfield;
}

/* Question limit container styling */
.question-limit-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.question-limit-container label {
    margin: 0;
    white-space: nowrap;
}

/* Light mode - question limit input */
.question-limit-input {
    background-color: #fff !important;
    color: #000 !important;
    width: max-content !important;
}

/* Mobile View - Enhanced Spinner */
@media (max-width: 768px) {
    .question-limit-input {
        width: 60px !important;
        padding: 6px 8px !important;
        font-size: 14px;
        height: 36px;
        border-radius: 6px;
    }

    .question-limit-input::-webkit-inner-spin-button,
    .question-limit-input::-webkit-outer-spin-button {
        width: 22px;
        height: 18px;
        margin: 0 1px;
    }

    .question-limit-container {
        gap: 8px;
    }

    .question-limit-container label {
        font-size: 0.95em;
    }

    .question-limit-container span {
        font-size: 0.9em;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .question-limit-input {
        width: 45px !important;
        padding: 5px 4px !important;
        font-size: 13px;
        height: 32px;
        background-color: #333 !important;
        color: #fff !important;
        border: 1px solid #666 !important;
    }

    .question-limit-input::-webkit-inner-spin-button,
    .question-limit-input::-webkit-outer-spin-button {
        width: 17px;
        height: 16px;
    }

    .question-limit-container {
        gap: 4px;
        flex-direction: row;
        justify-content: flex-start;
    }

    .question-limit-container label {
        font-size: 0.85em;
    }

    .question-limit-container span {
        font-size: 0.8em;
    }
}

/* ID based property mapping */

#aiChatModal, #helpDialog {
    z-index: 1002;
}

/* ===== App Switcher ===== */
.wiggle {
    animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
    20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

.app-switcher-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.app-switcher-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.dark-mode .app-switcher-content {
    background: var(--glass-bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-switcher-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.app-switcher-header h3 {
    font-size: 1.5rem;
    color: var(--darker);
    margin: 0;
}

.dark-mode .app-switcher-header h3 {
    color: var(--white);
}

.close-dialog {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.close-dialog:hover {
    transform: scale(1.1);
    color: var(--accent);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.app-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    text-decoration: none;
    color: var(--darker);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.dark-mode .app-card {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.app-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.app-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
}

.app-icon.blue-gradient {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.app-icon.amber-gradient {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.app-icon.purple-gradient {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.app-card h4 {
    font-size: 1.2rem;
    margin: 0 0 0.5rem 0;
}

.app-card p {
    font-size: 0.9rem;
    color: var(--dark);
    margin: 0;
}

.dark-mode .app-card p {
    color: var(--medium);
}

@media (max-width: 768px) {
    .app-switcher-content {
        padding: 1.5rem;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }

    .wiggle {
        animation: wiggle 1.5s ease-in-out infinite;
    }
}

