* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: #f5f5f0;
    min-height: 100vh;
    padding: 0;
    color: #2c3e50;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Global Content Wrapper */
.content-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Navigation Styles are now inherited from styles.css */

.container {
    max-width: 900px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 40px 30px;
    border-bottom: 4px solid #3498db;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content > div:first-child {
    flex: 1;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.95;
    font-weight: 300;
}

.home-button {
    display: inline-block;
    padding: 10px 25px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.home-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.test-controls {
    padding: 40px 30px;
    background: #fafafa;
}

.course-selector {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.course-selector label {
    font-weight: 600;
    color: #2c3e50;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.course-selector select {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white;
    color: #2c3e50;
    cursor: pointer;
    min-width: 300px;
}

.course-selector select:focus {
    outline: none;
    border-color: #3498db;
}

.course-selector button {
    padding: 12px 30px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px; /* Touch-friendly minimum size */
}

.course-selector button:hover {
    background: #2980b9;
}

.test-container {
    padding: 30px;
    background: #fafafa;
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
}

.test-info h2 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.question-counter {
    color: #7f8c8d;
    font-size: 0.95rem;
}

.timer {
    background: #ecf0f1;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    color: #2c3e50;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.question-container {
    margin-bottom: 30px;
}

.question {
    background: white;
    padding: 25px;
    border-radius: 6px;
    border-left: 5px solid #3498db;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.question-text {
    font-size: 1.15rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.options {
    list-style: none;
}

.option {
    padding: 15px 20px;
    margin: 12px 0;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px; /* Touch-friendly minimum size */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.option span {
    flex: 1;
}

.option:hover {
    background: #f0f7ff;
    border-color: #3498db;
}

.option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3498db;
}

.option.selected {
    background: #e8f4f8;
    border-color: #3498db;
    font-weight: 600;
}

.option.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.test-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
}

.test-actions button {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#prevBtn, #nextBtn {
    background: #95a5a6;
    color: white;
}

#prevBtn:hover:not(:disabled), #nextBtn:hover {
    background: #7f8c8d;
}

#prevBtn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

#submitBtn {
    background: #27ae60;
    color: white;
}

#submitBtn:hover {
    background: #229954;
}

.results-container {
    padding: 40px 30px;
    background: #fafafa;
}

.results-container h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.score-display {
    text-align: center;
    margin-bottom: 40px;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 auto 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.score-text {
    font-size: 1.2rem;
    color: #34495e;
    font-weight: 600;
}

.wrong-answers {
    margin-top: 40px;
}

.wrong-answers h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.wrong-answer-item {
    background: white;
    padding: 20px;
    margin: 15px 0;
    border-radius: 6px;
    border-left: 5px solid #e74c3c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.wrong-answer-item .question-text {
    color: #2c3e50;
    margin-bottom: 15px;
}

.wrong-answer-item .explanation {
    background: #fff3cd;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #ecf0f1;
}

.results-actions button {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.results-actions button:first-child {
    background: #3498db;
    color: white;
}

.results-actions button:first-child:hover {
    background: #2980b9;
}

.results-actions button:last-child {
    background: #95a5a6;
    color: white;
}

.results-actions button:last-child:hover {
    background: #7f8c8d;
}

footer {
    background: #2c3e50;
    padding: 25px;
    text-align: center;
    color: #ecf0f1;
    border-top: 3px solid #3498db;
}

footer p {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

footer strong {
    color: #3498db;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

footer b {
    color: #0de546;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.about-link-footer {
    display: inline-block;
    margin-top: 15px;
    color: #3498db;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: color 0.3s ease;
    padding: 8px 15px;
    border-radius: 6px;
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.about-link-footer:hover {
    color: #2980b9;
    background: rgba(52, 152, 219, 0.15);
}

/* Tablet styles */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
    
    .test-container {
        padding: 25px;
    }
    
    .results-container {
        padding: 35px 25px;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    body {
        padding: 10px 5px;
        font-size: 0.95rem;
    }
    
    /* Navigation styles are inherited from styles.css */
    
    .container {
        max-width: 100%;
        border-radius: 4px;
    }
    
    header {
        padding: 25px 15px;
    }
    
    header h1 {
        font-size: 1.6rem;
        line-height: 1.3;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .header-content > div:first-child {
        width: 100%;
    }

    .home-button {
        width: 100%;
        max-width: 200px;
        text-align: center;
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .test-controls {
        padding: 30px 20px;
    }

    .course-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .course-selector label {
        font-size: 0.95rem;
    }

    .course-selector select {
        min-width: 100%;
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .course-selector button {
        width: 100%;
        padding: 12px 20px;
    }

    .test-container {
        padding: 20px 15px;
    }

    .test-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
        padding-bottom: 15px;
    }
    
    .test-info h2 {
        font-size: 1.3rem;
    }
    
    .question-counter {
        font-size: 0.9rem;
    }
    
    .timer {
        padding: 8px 15px;
        font-size: 0.9rem;
        width: 100%;
        text-align: center;
    }

    .question {
        padding: 20px 15px;
    }
    
    .question-text {
        font-size: 1.05rem;
        margin-bottom: 15px;
        line-height: 1.5;
    }

    .option {
        padding: 12px 15px;
        margin: 10px 0;
        font-size: 0.95rem;
    }
    
    .option input[type="radio"] {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }

    .test-actions {
        flex-direction: column;
        gap: 10px;
    }

    .test-actions button {
        width: 100%;
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .results-container {
        padding: 30px 20px;
    }
    
    .results-container h2 {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
        font-size: 2rem;
    }
    
    .score-text {
        font-size: 1.1rem;
    }
    
    .wrong-answers h3 {
        font-size: 1.2rem;
    }
    
    .wrong-answer-item {
        padding: 15px;
        margin: 12px 0;
    }
    
    .wrong-answer-item .question-text {
        font-size: 1rem;
    }
    
    .wrong-answer-item .explanation {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .results-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .results-actions button {
        width: 100%;
        padding: 12px 20px;
    }
    
    footer {
        padding: 20px 15px;
    }
    
    footer p {
        font-size: 0.9rem;
    }
}

/* Small mobile styles */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    header {
        padding: 20px 12px;
    }
    
    header h1 {
        font-size: 1.4rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .home-button {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .test-controls {
        padding: 25px 15px;
    }
    
    .course-selector select {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .course-selector button {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    .test-container {
        padding: 15px 12px;
    }
    
    .test-info h2 {
        font-size: 1.2rem;
    }
    
    .question {
        padding: 15px 12px;
    }
    
    .question-text {
        font-size: 1rem;
    }
    
    .option {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .test-actions button {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    .results-container {
        padding: 25px 15px;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
        font-size: 1.8rem;
    }
    
    .score-text {
        font-size: 1rem;
    }
    
    .wrong-answer-item {
        padding: 12px;
    }
    
    .wrong-answer-item .question-text {
        font-size: 0.95rem;
    }
    
    .wrong-answer-item .explanation {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* Dark Mode Styles for Test Page */
body.dark-mode {
    background: #0d1117;
    color: #e0e6ed;
}

body.dark-mode .container {
    background-color: #161b22;
    border-color: #30363d;
}

body.dark-mode header {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #21262d 100%);
    border-bottom-color: #58a6ff;
}

body.dark-mode header h1 {
    color: #e0e6ed;
}

body.dark-mode .subtitle {
    color: #8b949e;
}

body.dark-mode .home-button {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
    border-color: rgba(88, 166, 255, 0.3);
}

body.dark-mode .home-button:hover {
    background: rgba(88, 166, 255, 0.25);
    border-color: rgba(88, 166, 255, 0.5);
}

body.dark-mode .test-controls {
    background: linear-gradient(to bottom, #0d1117, #161b22);
}

body.dark-mode .course-selector label {
    color: #e0e6ed;
}

body.dark-mode select,
body.dark-mode input[type="search"] {
    background-color: #0d1117;
    color: #e0e6ed;
    border-color: #30363d;
}

body.dark-mode select:focus,
body.dark-mode input[type="search"]:focus {
    border-color: #58a6ff;
}

body.dark-mode .test-info {
    background-color: #0d1117;
    border-color: #30363d;
}

body.dark-mode .test-info h2 {
    color: #e0e6ed;
}

body.dark-mode .question {
    background-color: #161b22;
    border-color: #30363d;
}

body.dark-mode .question-text {
    color: #e0e6ed;
}

body.dark-mode .option {
    background-color: #0d1117;
    border-color: #30363d;
    color: #e0e6ed;
}

body.dark-mode .option:hover {
    background-color: #161b22;
    border-color: #58a6ff;
}

body.dark-mode .option.selected {
    background-color: #0969da;
    border-color: #0969da;
}

body.dark-mode .option.correct {
    background-color: #238636;
    border-color: #238636;
}

body.dark-mode .option.incorrect {
    background-color: #da3633;
    border-color: #da3633;
}

body.dark-mode .test-actions button {
    background: linear-gradient(135deg, #0969da 0%, #033d8b 100%);
    color: #e0e6ed;
    border-color: #033d8b;
}

body.dark-mode .test-actions button:hover {
    background: linear-gradient(135deg, #033d8b 0%, #022663 100%);
    border-color: #022663;
}

body.dark-mode .test-actions button:disabled {
    background: linear-gradient(135deg, #30363d 0%, #21262d 100%);
    border-color: #21262d;
    color: #6e7681;
}

body.dark-mode .results-container {
    background-color: #161b22;
}

body.dark-mode .score-circle {
    background: linear-gradient(135deg, #238636 0%, #1a6e2f 100%);
    color: #e0e6ed;
    border-color: #238636;
}

body.dark-mode .score-text {
    color: #e0e6ed;
}

body.dark-mode .wrong-answers {
    background-color: #0d1117;
}

body.dark-mode .wrong-answers h3 {
    color: #e0e6ed;
}

body.dark-mode .wrong-answer-item {
    background-color: #161b22;
    border-color: #30363d;
}

body.dark-mode .wrong-answer-item .question-text {
    color: #e0e6ed;
}

body.dark-mode .wrong-answer-item .user-answer,
body.dark-mode .wrong-answer-item .correct-answer {
    color: #8b949e;
}

body.dark-mode .wrong-answer-item .explanation {
    background-color: #0d1117;
    border-color: #30363d;
    color: #c9d1d9;
}

body.dark-mode .results-actions button {
    background: linear-gradient(135deg, #0969da 0%, #033d8b 100%);
    color: #e0e6ed;
    border-color: #033d8b;
}

body.dark-mode .results-actions button:hover {
    background: linear-gradient(135deg, #033d8b 0%, #022663 100%);
    border-color: #022663;
}

body.dark-mode footer {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    border-top-color: #58a6ff;
    color: #e0e6ed;
}

body.dark-mode .about-link-footer {
    color: #58a6ff;
}

body.dark-mode .about-link-footer:hover {
    color: #79c0ff;
}

