/* Quiz Screen - Modern & Smooth CSS */

/* CSS Variables for consistent theming */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #ffffff;
    --surface: #f8fafc;
    --surface-hover: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--background);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.back-link:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* Main Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
}

/* Quiz Screen */
.quiz-screen {
    background: var(--background);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

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

/* Quiz Header */
.quiz-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.quiz-header::before {
    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 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.quiz-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.score-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.score-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

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

.score-label {
    display: block;
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.score-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
}

/* Question Container */
.question-container {
    padding: 2rem;
}

.question-number {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.question-number::before {
    content: '❓';
    font-size: 1rem;
}

.question {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    position: relative;
}

.question::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-hover));
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* Options */
.options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.option {
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.option::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--surface));
    transition: width 0.3s ease;
}

.option:hover {
    border-color: var(--primary-color);
    background: var(--surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.option:hover::before {
    width: 100%;
}

.option:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Option States */
.option.correct {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-color: var(--success-color);
    color: #166534;
    animation: correctPulse 0.6s ease-out;
}

.option.correct::after {
    content: '✓';
    position: absolute;
    left: 1rem;
    font-size: 1.25rem;
    color: var(--success-color);
    font-weight: bold;
}

.option.wrong {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    border-color: var(--error-color);
    color: #991b1b;
    animation: wrongShake 0.6s ease-out;
}

.option.wrong::after {
    content: '✗';
    position: absolute;
    left: 1rem;
    font-size: 1.25rem;
    color: var(--error-color);
    font-weight: bold;
}

.option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Next Button */
.next-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    position: relative;
    overflow: hidden;
    display: none;
    min-height: 56px;
}

.next-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.next-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

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

.next-btn.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

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

/* Result Screen */
.result-screen {
    background: var(--background);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    text-align: center;
    animation: slideUp 0.5s ease-out;
    display: none;
}

.result-container {
    padding: 3rem 2rem;
}

.result-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.result-score {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.result-message {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 500;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-item:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.result-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.result-buttons .btn {
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .quiz-header {
        padding: 1.5rem;
    }
    
    .quiz-title {
        font-size: 1.5rem;
    }
    
    .score-board {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .score-item {
        padding: 0.75rem;
    }
    
    .question-container {
        padding: 1.5rem;
    }
    
    .question {
        font-size: 1.1rem;
        padding: 1.25rem;
    }
    
    .option {
        padding: 1rem 1.25rem;
        min-height: 50px;
    }
    
    .result-container {
        padding: 2rem 1.5rem;
    }
    
    .result-score {
        font-size: 2.5rem;
    }
    
    .result-buttons {
        flex-direction: column;
    }
    
    .result-buttons .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 0.75rem;
    }
    
    .nav-brand {
        font-size: 1.25rem;
    }
    
    .container {
        padding: 0.75rem;
    }
    
    .quiz-header {
        padding: 1.25rem;
    }
    
    .quiz-title {
        font-size: 1.25rem;
    }
    
    .question-container {
        padding: 1.25rem;
    }
    
    .question {
        font-size: 1rem;
        padding: 1rem;
    }
    
    .option {
        padding: 0.875rem 1rem;
        min-height: 45px;
        font-size: 0.9rem;
    }
    
    .next-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        min-height: 50px;
    }
    
    .result-title {
        font-size: 1.75rem;
    }
    
    .result-score {
        font-size: 2rem;
    }
    
    .result-message {
        font-size: 1.1rem;
    }
    
    .stat-item {
        padding: 1.25rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(37, 99, 235, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Footer */
.footer {
    background: var(--background);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 3rem 0 2rem;
}

.footer-section {
    display: flex;
    flex-direction: column;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-icon {
    font-size: 1.5rem;
}

.footer-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--primary-color);
    transform: translateX(-2px);
}

.footer-text {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.btn-footer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-footer:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Footer Responsive */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 2rem 0 1.5rem;
    }
    
    .footer-logo {
        font-size: 1.1rem;
    }
    
    .logo-icon {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 1.5rem 0 1rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-logo {
        justify-content: center;
    }
    
    .btn-footer {
        width: 100%;
        max-width: 250px;
        margin: 0 auto;
    }
    
    .footer-bottom {
        padding: 1rem 0;
        font-size: 0.85rem;
    }
}

/* Print styles */
@media print {
    .header,
    .next-btn,
    .result-buttons,
    .footer {
        display: none;
    }
    
    .quiz-screen,
    .result-screen {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
