/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Arabic UI Text', 'Geeza Pro', 'Traditional Arabic', 'Noto Sans Arabic', sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    color: #1a202c;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Support for Arabic and French characters */
.question-content,
.option-text,
.results-content {
    font-family: 'Inter', 'Arabic UI Text', 'Geeza Pro', 'Traditional Arabic', 'Noto Sans Arabic', 'Segoe UI', sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Arabic text improvements */
[lang="ar"], .arabic-text {
    font-family: 'Arabic UI Text', 'Geeza Pro', 'Traditional Arabic', 'Noto Sans Arabic', 'Amiri', 'Scheherazade', sans-serif;
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
}

/* French text improvements */
[lang="fr"], .french-text {
    font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Full width for login containers */
.app-container > #loginScreen,
.app-container > #adminLoginScreen {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* Login Screen Styles - Full Width Enhanced Design */
.login-container {
    min-height: 100vh;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(-45deg, #667eea, #764ba2, #667eea, #893dc2, #667eea);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: 1;
}

.login-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23ffffff08" fill-opacity="1" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,154.7C960,171,1056,181,1152,165.3C1248,149,1344,107,1392,85.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    pointer-events: none;
    z-index: 2;
}

/* Left side - Visual/Branding */
.login-visual {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: white;
    text-align: center;
}

.login-visual-content {
    max-width: 500px;
}

/* School Branding Styles */
.school-branding {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.school-branding:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.school-logo {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    flex-shrink: 0;
}

.school-info {
    flex: 1;
    text-align: left;
}

.school-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin: 0 0 0.25rem 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.school-tagline {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-weight: 500;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

.main-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.main-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.login-visual-icon {
    font-size: 6rem;
    margin-bottom: 2rem;
    animation: iconFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
}

.login-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.feature-item i {
    font-size: 1.5rem;
    opacity: 0.9;
}

.feature-item span {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Right side - Login Form */
.login-form-side {
    position: relative;
    z-index: 3;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

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

.login-card {
    background: transparent;
    border-radius: 0;
    padding: 0;
    width: 100%;
    max-width: 480px;
    box-shadow: none;
    text-align: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .login-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .login-visual {
        padding: 2rem 1.5rem;
        min-height: auto;
    }
    
    .login-visual h1 {
        font-size: 2.5rem;
    }
    
    .login-visual p {
        font-size: 1.1rem;
    }
    
    .login-visual-icon {
        font-size: 4rem;
        margin-bottom: 1rem;
    }
    
    .login-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-top: 2rem;
    }
    
    .feature-item {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .feature-item span {
        font-size: 0.85rem;
    }
    
    .login-form-side {
        padding: 2rem 1.5rem;
    }
    
    .admin-switch {
        top: 1rem;
        right: 1rem;
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .school-branding {
        padding: 1.5rem;
        margin-bottom: 2rem;
        gap: 1rem;
    }
    
    .school-logo {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }
    
    .school-name {
        font-size: 1.2rem;
    }
    
    .school-tagline {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .login-visual {
        padding: 1.5rem 1rem;
    }
    
    .login-visual h1 {
        font-size: 2rem;
    }
    
    .login-features {
        grid-template-columns: 1fr;
    }
    
    .login-form-side {
        padding: 1.5rem 1rem;
    }
    
    .login-card {
        max-width: none;
    }
    
    .school-branding {
        padding: 1rem;
        margin-bottom: 1.5rem;
        gap: 0.75rem;
        flex-direction: column;
        text-align: center;
    }
    
    .school-info {
        text-align: center;
    }
    
    .school-logo {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .school-name {
        font-size: 1.1rem;
    }
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 24px;
    pointer-events: none;
}

.login-header {
    margin-bottom: 3rem;
    position: relative;
}

.login-header i {
    font-size: 3.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    display: block;
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.login-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.login-header p {
    color: #64748b;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.login-header i {
    font-size: 3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    display: block;
}

.login-form {
    margin-bottom: 2.5rem;
}

.input-group {
    margin-bottom: 2rem;
    text-align: left;
    position: relative;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    padding: 1.25rem 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 8px 25px -5px rgba(102, 126, 234, 0.3);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-3px) scale(1.02);
}

.input-group input::placeholder {
    color: #9ca3af;
    letter-spacing: 1px;
    text-transform: none;
}

.login-btn {
    width: 100%;
    padding: 1.5rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px -5px rgba(102, 126, 234, 0.4);
    margin-top: 1rem;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px -5px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

.login-btn:active {
    transform: translateY(-2px) scale(1.01);
}

.login-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.login-footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.login-footer p:last-child {
    margin-bottom: 0;
}

.login-footer i {
    color: #667eea;
    font-size: 0.9rem;
}

.error-message {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Admin Switch Button */
.admin-switch {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.admin-switch:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    color: white;
    text-decoration: none;
}

.admin-switch i {
    font-size: 0.8rem;
}

/* Header Styles */
.header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    display: none; /* Hidden by default, shown after login */
}

.header.authenticated {
    display: block;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header h1 i {
    color: #3182ce;
    font-size: 2rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #059669;
    font-weight: 500;
    font-size: 0.9rem;
    background: #ecfdf5;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid #d1fae5;
}

.session-info.warning {
    color: #d97706;
    background: #fffbeb;
    border-color: #fed7aa;
}

.session-info.expired {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

.language-selector select {
    padding: 0.75rem 1.25rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.language-selector select:hover {
    border-color: #9ca3af;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.language-selector select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none; /* Hidden by default, shown after login */
}

.main-content.authenticated {
    display: flex;
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.screen.active {
    display: block;
}

/* Full width for login screens */
#loginScreen,
#adminLoginScreen {
    max-width: none;
    margin: 0;
}

#loginScreen.active,
#adminLoginScreen.active {
    display: block;
}

/* Card Styles */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.card h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 1rem;
    text-align: center;
}

.card p {
    color: #718096;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Configuration Section */
.config-section {
    margin-bottom: 2rem;
}

.config-item {
    margin-bottom: 1.5rem;
}

.config-item label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.config-item label i {
    color: #3182ce;
    font-size: 1.2rem;
}

.config-item input[type="number"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #374151;
}

.config-item input[type="number"]:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.config-item input[type="number"]:hover {
    border-color: #9ca3af;
}

/* Exam Info */
.exam-info {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e5e7eb;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: #4a5568;
    font-weight: 500;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-item i {
    color: #3182ce;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    justify-content: center;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #3182ce;
    color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover:not(:disabled) {
    background-color: #2c5aa0;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: #f9fafb;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.btn-success {
    background-color: #059669;
    color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-success:hover:not(:disabled) {
    background-color: #047857;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

/* Quiz Screen Styles */
.quiz-header {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #3182ce;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
}

.timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #dc2626;
    font-size: 1.1rem;
    font-weight: 600;
    background: #fef2f2;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

/* Question Card */
.question-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.question-content {
    margin-bottom: 2rem;
}

.question-image {
    text-align: center;
    margin-bottom: 1.5rem;
}

.question-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.question-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a202c;
    line-height: 1.5;
    text-align: center;
    margin-bottom: 0.5rem;
}

/* Options */
.options-container {
    margin-bottom: 2rem;
}

.option {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.option:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

.option.selected {
    background: #eff6ff;
    border-color: #3182ce;
    color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #3182ce;
}

.option-text {
    font-weight: 500;
    flex: 1;
    font-size: 1rem;
    color: #374151;
}

/* Question Actions */
.question-actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

/* Results Screen */
.results-header {
    background: #ffffff;
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.results-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 2rem;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #3182ce;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 700;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.score-details {
    text-align: left;
}

.score-details p {
    font-size: 1.2rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.pass-status {
    font-weight: 700;
    font-size: 1.3rem !important;
}

.pass-status.pass {
    color: #38a169;
}

.pass-status.fail {
    color: #e53e3e;
}

/* Results Tabs */
.results-tabs {
    display: flex;
    background: #f9fafb;
    border-radius: 8px;
    padding: 0.25rem;
    margin-bottom: 2rem;
    border: 1px solid #e5e7eb;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.tab-btn:hover {
    color: #374151;
    background: #ffffff;
}

.tab-btn.active {
    background: #3182ce;
    color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Summary Stats */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.stat-card.correct {
    border-left: 4px solid #38a169;
}

.stat-card.incorrect {
    border-left: 4px solid #e53e3e;
}

.stat-card.unanswered {
    border-left: 4px solid #ed8936;
}

.stat-card i {
    font-size: 2rem;
}

.stat-card.correct i {
    color: #38a169;
}

.stat-card.incorrect i {
    color: #e53e3e;
}

.stat-card.unanswered i {
    color: #ed8936;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
}

.stat-label {
    color: #718096;
    font-weight: 500;
}

/* Review Questions */
.review-question {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.review-question.correct {
    border-left: 4px solid #38a169;
}

.review-question.incorrect {
    border-left: 4px solid #e53e3e;
}

.review-question.unanswered {
    border-left: 4px solid #ed8936;
}

.review-question h4 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.review-question .review-image {
    text-align: center;
    margin-bottom: 1rem;
}

.review-question .review-image img {
    max-width: 200px;
    border-radius: 8px;
}

.review-answer {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
}

.review-answer.user-answer {
    background: #fed7d7;
    color: #c53030;
}

.review-answer.correct-answer {
    background: #c6f6d5;
    color: #2f855a;
}

.review-answer.user-correct {
    background: #c6f6d5;
    color: #2f855a;
}

.review-answer.unanswered {
    background: #fed7d7;
    color: #c53030;
}

.review-explanation {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fffaf0;
    border-left: 4px solid #ed8936;
    border-radius: 4px;
    color: #c05621;
}

.results-actions {
    text-align: center;
    margin-top: 2rem;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3182ce;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-spinner p {
    color: white;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    body, html {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        height: auto;
        touch-action: pan-y;
    }
    
    .login-container,
    .app-container,
    .main-content {
        touch-action: pan-y;
    }
    
    .login-container {
        padding: 1rem;
        min-height: 100vh;
        align-items: flex-start;
        padding-top: 2rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .login-card {
        padding: 2rem;
    }

    .header-content {
        padding: 0 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .header-actions {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-content {
        padding: 0.5rem;
        min-height: calc(100vh - 80px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .question-card {
        padding: 1rem;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .question-content {
        margin-bottom: 1rem;
        flex-shrink: 0;
    }

    .question-content h3 {
        font-size: 1.1rem;
        line-height: 1.4;
        margin-bottom: 1rem;
    }

    .question-image {
        margin-bottom: 1rem;
    }

    .question-image img {
        max-height: 150px;
        max-width: 100%;
    }

    .options-container {
        margin-bottom: 1rem;
        flex: 1;
        overflow-y: auto;
    }

    .option {
        padding: 0.75rem 1rem;
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }

    .option-text {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    .quiz-header {
        padding: 1rem;
        margin-bottom: 0.5rem;
    }

    .quiz-info {
        font-size: 0.9rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .timer {
        font-size: 1rem;
        padding: 0.4rem 0.6rem;
    }

    .score-display {
        flex-direction: column;
        gap: 1rem;
    }

    .score-details {
        text-align: center;
    }

    .question-actions {
        flex-direction: column;
        gap: 0.5rem;
        flex-shrink: 0;
        padding-top: 1rem;
        border-top: 1px solid #e5e7eb;
        margin-top: 1rem;
    }

    .summary-stats {
        grid-template-columns: 1fr;
    }

    .results-tabs {
        flex-direction: column;
    }

    .results-header {
        padding: 1.5rem;
    }

    .results-header h2 {
        font-size: 2rem;
    }

    .score-circle {
        width: 100px;
        height: 100px;
        font-size: 1.5rem;
    }

    /* Allow quiz screen to scroll properly on mobile */
    .quiz-screen {
        min-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
    }

    .quiz-screen .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .quiz-screen .question-card {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1rem;
    }

    .card h2 {
        font-size: 1.3rem;
    }

    .question-content h3 {
        font-size: 1rem;
        line-height: 1.3;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .question-card {
        padding: 0.75rem;
        max-height: calc(100vh - 100px);
    }

    .option {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .option-text {
        font-size: 0.85rem;
    }

    .quiz-header {
        padding: 0.75rem;
    }

    .timer {
        font-size: 0.9rem;
    }

    .question-image img {
        max-height: 120px;
    }

    /* More compact layout for very small screens */
    .question-content {
        margin-bottom: 0.75rem;
    }

    .question-actions {
        padding-top: 0.75rem;
        margin-top: 0.75rem;
    }

    .progress-bar {
        height: 6px;
        margin-bottom: 0.75rem;
    }
}

/* Portrait orientation specific optimizations */
@media (max-width: 768px) and (orientation: portrait) {
    .question-card {
        max-height: calc(100vh - 140px);
    }

    .options-container {
        max-height: calc(60vh - 200px);
        overflow-y: auto;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 1024px) and (orientation: landscape) and (max-height: 600px) {
    .question-card {
        max-height: calc(100vh - 80px);
        padding: 0.75rem;
    }

    .question-content h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .question-image img {
        max-height: 100px;
    }

    .options-container {
        max-height: calc(50vh);
        overflow-y: auto;
    }

    .option {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.4rem;
    }

    .quiz-header {
        padding: 0.5rem;
    }
}

/* RTL Support for Arabic */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .header-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .quiz-info {
    flex-direction: row-reverse;
}

[dir="rtl"] .option {
    flex-direction: row-reverse;
}

[dir="rtl"] .score-display {
    flex-direction: row-reverse;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #4c51bf;
    outline-offset: 2px;
}

.option:focus {
    outline: 2px solid #4c51bf;
    outline-offset: 2px;
}

/* Admin Dashboard Styles */
.admin-header {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    color: white;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.admin-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-header i {
    color: #fbbf24;
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
}

.admin-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.admin-section {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-header i {
    color: #667eea;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.card-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-actions {
    display: flex;
    gap: 0.75rem;
}

/* Form Styles */
.generate-form {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Table Styles */
.access-codes-table {
    overflow-x: auto;
}

.table-header,
.table-row {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 1.5fr 1fr 1fr 0.8fr 0.8fr 1fr;
    gap: 1rem;
    padding: 1rem;
    align-items: center;
}

.table-header {
    background: #f8fafc;
    border-radius: 8px;
    font-weight: 600;
    color: #374151;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.5rem;
}

.table-row {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.table-row:hover {
    background: #f8fafc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.col {
    font-size: 0.9rem;
}

.access-code {
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-weight: 700;
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: #1f2937;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-expired {
    background: #fee2e2;
    color: #991b1b;
}

.status-disabled {
    background: #f3f4f6;
    color: #6b7280;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive Design for Admin */
@media (max-width: 768px) {
    .admin-header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .admin-content {
        padding: 1rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table-header,
    .table-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .col {
        padding: 0.25rem 0;
        border-bottom: 1px solid #f3f4f6;
    }

    .col:last-child {
        border-bottom: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-actions {
        width: 100%;
        justify-content: space-between;
    }
} 

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
    transition: opacity 0.2s;
}

.modal-content {
    background-color: #fff;
    margin: 10vh auto;
    padding: 2.5rem 3rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    max-width: 900px;
    min-width: 600px;
    width: 60%;
    position: relative;
    animation: modalFadeIn 0.2s;
}

.modal .close {
    color: #888;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.modal .close:hover {
    color: #333;
}

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