@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    font-weight: 600;
}

.container {
    max-width: 850px;
    margin: auto;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.sidebar {
    position: fixed;
    top: 60px;
    left: 20px;
    width: 200px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 1px solid rgba(255,255,255,0.3);
    color: #333;
    padding: 12px;
    border-radius: 15px;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    z-index: 1000;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    direction: ltr;
}

.sidebar button {
    flex: 1 1 16%;
    margin: 3px;
    padding: 8px 6px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    min-width: 30px;
    height: 32px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    direction: ltr;
    text-align: center;
}

.sidebar button.answered {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
}

.sidebar button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    background: linear-gradient(145deg, #f5f5f5, #e8e8e8);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
    background: linear-gradient(45deg, #667eea, #764ba2);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
}

.question {
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.question p {
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 15px;
    line-height: 1.6;
    text-align: left;
    direction: ltr;
    padding: 10px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.options {
    margin-top: 15px;
    direction: ltr;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 10px;
    padding: 12px 15px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    text-align: left;
    direction: ltr;
}

label:hover {
    background: linear-gradient(145deg, #f0f2ff, #e6e9ff);
    border-color: #667eea;
    transform: translateX(5px);
}

label input[type="radio"] {
    margin-right: 10px;
    margin-left: 0;
}

button {
    display: block;
    width: 100%;
    padding: 15px;
    background: linear-gradient(145deg, #007BFF, #0056b3);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

button:hover {
    background: linear-gradient(145deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
}

#endTestButton {
    margin-top: 20px;
    background: linear-gradient(145deg, #DC3545, #c82333);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

#endTestButton:hover {
    background: linear-gradient(145deg, #c82333, #a71e2a);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
}

#result {
    margin-top: 30px;
    font-weight: bold;
    text-align: center;
    font-size: 20px;
    padding: 20px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

#timer {
    position: fixed;
    top: 15px;
    right: 15px;
    background: linear-gradient(145deg, #007BFF, #0056b3);
    padding: 15px 20px;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: white;
    box-shadow: 0 5px 20px rgba(0, 123, 255, 0.3);
    z-index: 1001;
    border: 2px solid rgba(255,255,255,0.2);
}

.timer-warning {
    background: linear-gradient(145deg, #dc3545, #c82333) !important;
    animation: pulse 1s infinite;
    box-shadow: 0 5px 20px rgba(220, 53, 69, 0.4) !important;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.hidden {
    display: none;
}

.fixed-content {
    margin-bottom: 20px;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    background: linear-gradient(145deg, #e9ecef, #dee2e6);
    border-radius: 15px;
    margin: 25px 0;
    height: 25px;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.3);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049, #66bb6a);
    border-radius: 15px;
    transition: width 0.5s ease;
    position: relative;
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
    color: #333;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

/* Enhanced Question Navigation */
.question-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 15px;
}

.nav-button {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    width: auto;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.prev-button {
    background-color: #6c757d;
    color: white;
}

.prev-button:hover {
    background-color: #5a6268;
}

.prev-button:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.next-button {
    background-color: #007BFF;
    color: white;
}

.next-button:hover {
    background-color: #0056b3;
}

/* Enhanced Timer */
#timer {
    position: fixed;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #007BFF, #0056b3);
    padding: 15px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 16px;
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    min-width: 150px;
    text-align: center;
}

.timer-warning {
    background: linear-gradient(135deg, #dc3545, #c82333) !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        margin-bottom: 20px;
        max-height: 150px;
        padding: 5px;
    }
    
    .sidebar button {
        flex: 1 1 12%;
        margin: 1px;
        padding: 4px 2px;
        font-size: 11px;
        min-width: 24px;
        height: 24px;
    }
    
    .container {
        margin: 10px;
        padding: 15px;
    }
    
    #timer {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 20px;
        display: block;
    }
    
    .question-nav {
        flex-direction: column;
    }
    
    .nav-button {
        width: 100%;
        margin: 5px 0;
    }
}

/* Question Animation */
.question {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Enhanced Results */
.result-card {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    text-align: center;
    margin-top: 30px;
    border: 1px solid rgba(255,255,255,0.3);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* Explanation Styles */
.explanation-card {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    padding: 25px;
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.3);
}

.explanation-question h3 {
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 1.4em;
    color: #333;
    margin-bottom: 15px;
    direction: ltr;
    text-align: left;
}

.explanation-options {
    margin: 15px 0;
    direction: ltr;
    text-align: left;
}

.explanation-option {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    border: 2px solid #e9ecef;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
}

.correct-option {
    background: linear-gradient(145deg, #d4edda, #c3e6cb);
    border-color: #28a745;
    color: #155724;
    position: relative;
}

.incorrect-option {
    background: linear-gradient(145deg, #f8d7da, #f5c6cb);
    border-color: #dc3545;
    color: #721c24;
    position: relative;
}

.explanation-box {
    background: linear-gradient(145deg, #f1f8ff, #e3f0ff);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid #b8daff;
}

.explanation-box h4 {
    color: #0056b3;
    margin-bottom: 15px;
    font-weight: 700;
}

.rule-explanation {
    font-size: 1.1em;
    line-height: 1.6;
    color: #333;
    direction: ltr;
    text-align: left;
    margin-bottom: 20px;
}

.user-answer-status {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    border: 1px solid #e9ecef;
    direction: ltr;
    text-align: left;
}

.user-answer-status p {
    margin: 8px 0;
}

.user-answer-status .correct {
    color: #28a745;
    font-weight: 700;
}

.user-answer-status .incorrect {
    color: #dc3545;
    font-weight: 700;
}

.explanations-header {
    text-align: center;
    margin-bottom: 30px;
}

.explanations-header h2 {
    font-size: 2em;
    color: #333;
    margin-bottom: 10px;
    font-weight: 700;
}

.explanations-header p {
    color: #666;
    font-size: 1.2em;
}

.explanation-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 25px 0;
}

.explanation-counter {
    font-size: 1.2em;
    font-weight: 600;
    color: #555;
}

.close-button {
    background: linear-gradient(145deg, #6c757d, #5a6268);
    margin-top: 20px;
    color: white;
    font-size: 1.1em;
}

.close-button:hover {
    background: linear-gradient(145deg, #5a6268, #495057);
}

.review-button {
    margin-top: 25px;
    background: linear-gradient(145deg, #17a2b8, #138496);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.3);
}

.review-button:hover {
    background: linear-gradient(145deg, #138496, #117a8b);
    box-shadow: 0 8px 25px rgba(23, 162, 184, 0.4);
}


.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

.result-details {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 25px;
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.congratulations {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(145deg, #e3f2fd, #bbdefb);
    border-radius: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #1565c0;
    border: 2px solid rgba(21, 101, 192, 0.1);
}

.score-excellent { 
    background: linear-gradient(135deg, #28a745, #20c997);
    box-shadow: 0 10px 30px rgba(40, 167, 69, 0.3);
}
.score-good { 
    background: linear-gradient(135deg, #007bff, #6610f2);
    box-shadow: 0 10px 30px rgba(0, 123, 255, 0.3);
}
.score-average { 
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    box-shadow: 0 10px 30px rgba(255, 193, 7, 0.3);
}
.score-poor { 
    background: linear-gradient(135deg, #dc3545, #e83e8c);
    box-shadow: 0 10px 30px rgba(220, 53, 69, 0.3);
}

/* Welcome Section */
.start-section {
    text-align: center;
}

.welcome-card {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    margin: 20px 0;
    border: 1px solid rgba(255,255,255,0.3);
}

.welcome-card h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 2em;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
}

.developer-credit {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid #667eea;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.developer-credit p {
    margin: 0;
    font-size: 16px;
    color: #495057;
    text-align: center;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
}

.developer-credit strong {
    color: #667eea;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.exam-info {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.info-item {
    background: linear-gradient(145deg, #e3f2fd, #bbdefb);
    padding: 20px;
    border-radius: 15px;
    min-width: 150px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.info-item .icon {
    font-size: 2em;
    display: block;
    margin-bottom: 10px;
}

.instructions {
    background: linear-gradient(145deg, #fff3e0, #ffe0b2);
    padding: 25px;
    border-radius: 15px;
    margin: 25px 0;
    text-align: right;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.instructions h3 {
    color: #e65100;
    margin-bottom: 15px;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(230, 81, 0, 0.1);
}

.instructions li:before {
    content: "✓ ";
    color: #4caf50;
    font-weight: bold;
    margin-left: 10px;
}

.button-icon {
    margin-left: 10px;
    font-size: 1.2em;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-card {
    animation: fadeIn 0.6s ease;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Registration Form Styles */
.registration-form {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 12px;
    margin: 20px 0;
    border: 2px solid #dee2e6;
}

.registration-form h3 {
    color: #495057;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.2em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 1em;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group input:invalid {
    border-color: #dc3545;
}

.form-group input:valid {
    border-color: #28a745;
}

.student-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    border: 1px solid #90caf9;
}

.student-info p {
    margin: 5px 0;
    font-size: 1.1em;
    color: #1565c0;
}

.final-instructions {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 2px solid #ffc107;
}

.final-instructions h3 {
    color: #856404;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.final-instructions ul {
    margin: 0;
    padding-right: 20px;
    color: #856404;
}

.final-instructions li {
    margin-bottom: 8px;
    font-weight: 500;
}

#backButton {
    background: linear-gradient(145deg, #6c757d, #5a6268);
    margin-top: 10px;
    padding: 12px 25px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
    margin-left: 10px;
}

#backButton:hover {
    background: linear-gradient(145deg, #5a6268, #495057);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Visitor Link Styles */
.admin-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(145deg, #17a2b8, #138496);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    font-size: 14px;
}

.admin-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
    text-decoration: none;
    color: white;
}

/* Responsive Design for Registration */
@media (max-width: 768px) {
    .form-group input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .student-info {
        padding: 12px;
    }
    
    .final-instructions {
        padding: 15px;
    }
    
    #backButton {
        width: 100%;
        margin: 10px 0;
    }
}

/* Additional Result Page Styles */
.student-result-info {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #c3e6cb;
}

.student-result-info p {
    margin: 5px 0;
    font-size: 1.1em;
    color: #155724;
}

.action-buttons-result {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.admin-button {
    background: linear-gradient(145deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.admin-button:hover {
    background: linear-gradient(145deg, #20c997, #17a2b8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: white;
}

@media (max-width: 768px) {
    .action-buttons-result {
        flex-direction: column;
        align-items: center;
    }
    
    .review-button,
    .admin-button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}
