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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f5f5f5;
}

/* Header Styles */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Hide header during quiz on mobile for app-like experience */
@media (max-width: 768px) {
    body.quiz-active header {
        display: none;
    }
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.company-logo {
    height: 60px;
    width: auto;
}

.logo-placeholder {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 0.5rem 1rem;
    background-color: #34495e;
    border-radius: 5px;
}

header h1 {
    font-size: 1.8rem;
}

/* Main Content */
main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 2rem;
}

.quiz-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.question-header {
    margin-bottom: 1.5rem;
}

.question-number {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.question-text {
    font-size: 1.3rem;
    color: #2c3e50;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.question-type {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background-color: #3498db;
    color: white;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Multiple Choice Styles */
.options-container {
    margin: 1.5rem 0;
}

.option {
    background-color: #ecf0f1;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.option:hover {
    background-color: #d5dbdb;
    border-color: #95a5a6;
}

.option.selected {
    background-color: #3498db;
    border-color: #2980b9;
    color: white;
}

.option.correct {
    background-color: #d4edda !important;
    border: 1px solid #27ae60 !important;
    color: #155724 !important;
}

.option.incorrect {
    background-color: #f8d7da !important;
    border: 1px solid #c0392b !important;
    color: #721c24 !important;
}

.option.correct-not-selected {
    background-color: #d4edda !important;
    border-color: #2ecc71 !important;
    color: #155724 !important;
}

.option.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-marker {
    width: 24px;
    height: 24px;
    border: 2px solid #7f8c8d;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option.selected .option-marker {
    border-color: #2980b9;
    background-color: #3498db;
}

.option.correct .option-marker {
    border-color: #27ae60 !important;
    background-color: #2ecc71 !important;
}

.option.incorrect .option-marker {
    border-color: #c0392b !important;
    background-color: #e74c3c !important;
}

.option.correct-not-selected .option-marker {
    border-color: #2ecc71 !important;
    background-color: #d4edda !important;
}

.option.selected .option-marker::after {
    content: '✓';
    color: white;
    font-weight: bold;
    font-size: 1rem;
}

/* Only show checkmark when user selected it - color will come from parent classes */
.option.selected.correct .option-marker::after,
.option.selected.incorrect .option-marker::after {
    content: '✓';
    color: white;
    font-weight: bold;
    font-size: 1rem;
}

/* No checkmark for correct-not-selected - user didn't select it */

/* Free Text Entry Styles */
.text-input-container {
    margin: 1.5rem 0;
}

.text-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

.text-input:focus {
    outline: none;
    border-color: #3498db;
}

.answer-comparison {
    margin: 0.25rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.user-answer, .correct-answer {
    margin-bottom: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.user-answer:last-child, .correct-answer:last-child {
    margin-bottom: 0;
}

.answer-comparison h3 {
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.answer-comparison p {
    margin: 0;
    padding: 1rem;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    line-height: 1.6;
    white-space: pre-wrap;
}

.user-answer p {
    border-left: 3px solid #3498db;
}

.correct-answer p {
    border-left: 3px solid #2ecc71;
}

.self-evaluation {
    margin-top: 1rem;
    padding: 1rem;
    background-color: white;
    border-radius: 8px;
}

.self-evaluation h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.1rem;
}

.evaluation-buttons {
    display: flex;
    gap: 1rem;
}

.eval-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.eval-btn.correct {
    background-color: #2ecc71;
    color: white;
}

.eval-btn.correct:hover {
    background-color: #27ae60;
}

.eval-btn.incorrect {
    background-color: #e74c3c;
    color: white;
}

.eval-btn.incorrect:hover {
    background-color: #c0392b;
}

/* Feedback Message */
.feedback-message {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.feedback-message.correct {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback-message.incorrect {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Buttons */
.button-container {
    margin-top: 2rem;
    display: flex;
    flex-direction: column; /* Stack vertically on desktop */
    gap: 1rem;
}

/* Desktop: Feedback in separate row */
#feedback-container:not(:empty) {
    margin-bottom: 1rem;
}

/* Desktop: Evaluation buttons in their own row */
.evaluation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #7f8c8d;
}

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

/* Results Page */
.results-container {
    text-align: center;
}

.results-header {
    margin-bottom: 2rem;
}

.results-header h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.score-display {
    font-size: 3rem;
    font-weight: bold;
    color: #3498db;
    margin: 2rem 0;
}

.pass-status {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.pass-status.passed {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.pass-status.failed {
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.results-details {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-align: left;
}

.results-details h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.results-details p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.restart-btn {
    margin-top: 2rem;
    background-color: #3498db;
    color: white;
}

.restart-btn:hover {
    background-color: #2980b9;
}

/* Content Pages Styles */
.content-page-text {
    line-height: 1.8;
    margin-top: 1.5rem;
}

.content-page-text h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.content-page-text h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.btn-link {
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.button-container-page {
    margin-top: 2rem;
}

/* Footer Styles */
footer {
    background-color: #2c3e50;
    color: white;
    padding: 1.5rem 2rem;
    margin-top: auto;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #3498db;
}

.separator {
    color: #7f8c8d;
    margin: 0 0.5rem;
}

.footer-promo {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #bdc3c7;
}

.promo-link {
    font-weight: 600;
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.promo-link:hover {
    color: #5dade2;
}

/* Hide footer during quiz */
body.quiz-active #page-footer {
    display: none;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Collapsible Sections */
.collapsible-section {
    margin: 2rem 0;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.collapsible-header {
    background-color: #f8f9fa;
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.collapsible-header:hover {
    background-color: #e9ecef;
}

.collapsible-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.collapsible-toggle {
    font-size: 1.5rem;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.collapsible-section.expanded .collapsible-toggle {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-section.expanded .collapsible-content {
    max-height: none;
    overflow: visible;
}

.collapsible-body {
    padding: 1.5rem;
    background-color: white;
}

.wrong-answer-item, .quiz-question-item {
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
    border-left: 4px solid #e74c3c;
    border-radius: 4px;
}

.quiz-question-item {
    border-left-color: #3498db;
}

.wrong-answer-item h4, .quiz-question-item h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
}

.wrong-answer-item p, .quiz-question-item p {
    margin: 0.25rem 0;
    color: #495057;
}

.wrong-answer-item .user-response {
    color: #e74c3c;
    font-weight: 500;
}

.wrong-answer-item .correct-response {
    color: #2ecc71;
    font-weight: 500;
}

/* Results Options Styling */
.results-options {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.results-option {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background-color: white;
    gap: 0.75rem;
}

.results-option .option-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #6c757d;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

.results-option .option-text {
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Correct and selected */
.results-option.correct-selected {
    background-color: #d4edda;
    border-color: #2ecc71;
}

.results-option.correct-selected .option-checkbox {
    background-color: #2ecc71;
    border-color: #2ecc71;
    color: white;
}

/* Incorrect but selected */
.results-option.incorrect-selected {
    background-color: #f8d7da;
    border-color: #e74c3c;
}

.results-option.incorrect-selected .option-checkbox {
    background-color: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

/* Correct but not selected */
.results-option.correct-not-selected {
    background-color: #d4edda;
    border-color: #2ecc71;
}

.results-option.correct-not-selected .option-checkbox {
    border-color: #2ecc71;
    color: #2ecc71;
}

.download-buttons {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-download {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-download.blank {
    background-color: #6c757d;
    color: white;
}

.btn-download.blank:hover {
    background-color: #5a6268;
}

.btn-download.filled {
    background-color: #28a745;
    color: white;
}

.btn-download.filled:hover {
    background-color: #218838;
}

/* Start Page Styles */
.start-page {
    max-width: 800px;
    margin: 0 auto;
}

.start-page h2 {
    color: #2c3e50;
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

.start-content {
    text-align: left;
}

.intro-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #495057;
    margin-bottom: 1.5rem;
}

.question-types {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.question-types li {
    margin: 0.75rem 0;
    font-size: 1rem;
    line-height: 1.6;
}

.info-box {
    background-color: #e7f3ff;
    border-left: 4px solid #3498db;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 4px;
}

.info-box h3 {
    color: #2c3e50;
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
}

.info-box ul {
    margin: 0;
    padding-left: 1.5rem;
}

.info-box li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.btn-large {
    font-size: 1.2rem;
    padding: 1rem 2.5rem;
}

/* Header with Download Buttons */
.collapsible-header-with-download {
    background-color: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.collapsible-header-with-download .collapsible-header {
    flex: 1;
    background-color: transparent;
    padding: 0.5rem 1rem;
}

.download-buttons-inline {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.download-buttons-inline .btn-download {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Results Page Buttons */
.results-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.results-buttons .btn {
    flex: 1;
    min-width: 200px;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.3rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    /* App-like mobile experience: full height layout during quiz */
    body.quiz-active {
        height: 100vh;
        overflow: auto; /* Allow scrolling */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    body.quiz-active main {
        min-height: 100dvh; /* Dynamic viewport height for iOS Safari address bar */
        margin: 0;
        padding: 0;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        background-color: #f5f5f5 !important;
        /* Removed transform to allow child elements with position:fixed to work relative to viewport */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    body.quiz-active .quiz-card {
        flex: 1;
        display: flex;
        flex-direction: column;
        border-radius: 0;
        padding: 1rem;
        margin: 0;
        padding-bottom: 180px; /* Space for sticky buttons and feedback */
        background-color: white !important; /* Ensure white background is visible */
        /* Removed transform to allow child elements with position:fixed to work relative to viewport */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        opacity: 0.9999; /* Force repaint */
    }
    
    /* Sticky button container at absolute bottom of viewport during quiz */
    /* Mobile-specific styles for fixed bottom button container */
    body.quiz-active .button-container {
        position: fixed !important; /* Force fixed positioning */
        left: 0;
        right: 0;
        bottom: 0; /* Absolute bottom of viewport */
        width: 100%;
        background: white !important;
        z-index: 100;
        margin: 0;
        border-top: 1px solid #ddd;
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0)); /* Add safe area padding at bottom for notches */
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        -webkit-transform: translateZ(0); /* Force GPU acceleration */
        transform: translateZ(0);
        will-change: transform;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Mobile: Button container keeps everything in one fixed area */
    body.quiz-active .button-container {
        flex-direction: column; /* Keep stacked even on mobile within fixed container */
    }
    
    /* Feedback container is now inside button container, above button */
    body.quiz-active #feedback-container:empty {
        display: none;
    }
    
    body.quiz-active #feedback-container:not(:empty) {
        margin-bottom: 1rem; /* Space between feedback and button */
    }
    
    body.quiz-active .feedback-message {
        margin: 0;
        border-radius: 8px;
    }
    
    /* Answer comparison should be in scrollable area, not fixed */
    body.quiz-active #answer-comparison-container {
        position: relative;
        margin: 0.25rem 0 1rem 0;
    }
    
    /* Self-evaluation in fixed footer */
    body.quiz-active .self-evaluation {
        margin: 0;
    }
    
    body.quiz-active .self-evaluation h3 {
        margin: 0 0 0.75rem 0;
        font-size: 1rem;
    }
    
    body.quiz-active .evaluation-buttons {
        display: flex;
        gap: 0.75rem;
    }
    
    body.quiz-active .eval-btn {
        flex: 1;
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    main {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    
    .quiz-card {
        padding: 1.5rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    /* Override desktop stacking - NOT needed on mobile for non-quiz-active states */
    /* Removed .button-container flex-direction override */
    
    /* Keep evaluation buttons horizontal on mobile when not in quiz-active */
    .evaluation-buttons {
        flex-direction: row; /* Override to keep horizontal */
    }
    
    .score-display {
        font-size: 2rem;
    }
    
    /* Make answer comparison stack on mobile */
    .answer-comparison {
        flex-direction: column;
        gap: 1rem;
    }
    
    .user-answer, .correct-answer {
        min-width: 100%;
    }
    
    /* Results page mobile improvements */
    .results-header h2 {
        font-size: 1.5rem;
    }
    
    .pass-status {
        font-size: 1.2rem;
        padding: 1rem;
    }
    
    .results-buttons .btn {
        min-width: 100%;
        width: 100%;
    }
    
    /* Collapsible sections mobile */
    .collapsible-header-with-download {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .collapsible-header-with-download .collapsible-header {
        padding: 0;
    }
    
    .collapsible-header h3 {
        font-size: 1rem;
    }
    
    .download-buttons-inline {
        flex-direction: column;
        width: 100%;
    }
    
    .download-buttons-inline .btn-download {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .download-buttons {
        flex-direction: column;
    }
    
    .btn-download {
        width: 100%;
        justify-content: center;
    }
    
    /* Ensure text wraps properly on mobile */
    .wrong-answer-item, .quiz-question-item {
        padding: 1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .wrong-answer-item h4, .quiz-question-item h4 {
        font-size: 1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .wrong-answer-item p, .quiz-question-item p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .results-option {
        padding: 0.75rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .results-option .option-text {
        font-size: 0.95rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
    }
    
    /* Ensure collapsible content shows all items */
    .collapsible-body {
        padding: 1rem;
    }
    
    .collapsible-section.expanded .collapsible-content {
        padding-bottom: 1rem;
    }
    
    /* Start page mobile */
    .start-page h2 {
        font-size: 1.8rem;
    }
    
    .btn-large {
        font-size: 1.1rem;
        padding: 0.9rem 2rem;
        width: 100%;
    }
}
