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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Header and Navigation */
header {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Main Content */
main {
    min-height: calc(100vh - 200px);
}

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

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #40e0d0 0%, #20b2aa 100%);
    color: white;
    text-align: center;
    padding: 4rem 2rem;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

/* Buttons */
.cta-button {
    display: inline-block;
    background-color: #e74c3c;
    color: white;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.cta-button:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

.btn-secondary {
    display: inline-block;
    background-color: #95a5a6;
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-secondary:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Content Section */
.content {
    background-color: white;
    padding: 3rem 0;
}

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

.first-aid-topic {
    background-color: #fff;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #e74c3c;
}

.first-aid-topic h3 {
    color: #e74c3c;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.first-aid-topic p {
    margin-bottom: 1rem;
    color: #555;
}

.steps {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 5px;
    margin-top: 1rem;
}

.steps h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.steps ol,
.steps ul {
    margin-left: 1.5rem;
    color: #555;
}

.steps li {
    margin-bottom: 0.5rem;
}

.steps ul {
    margin-top: 0.5rem;
}

.steps strong {
    color: #2c3e50;
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, #40e0d0 0%, #20b2aa 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

.cta-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-section p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* Quiz Styles */
.quiz-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
}

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

.quiz-section.hidden {
    display: none;
}

.name-warning {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    color: #856404;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

.name-warning.hidden {
    display: none;
}

.quiz-section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center;
}

#quiz-intro {
    text-align: center;
}

#quiz-intro p {
    margin-bottom: 2rem;
    color: #555;
    font-size: 1.1rem;
}

#quiz-intro .quiz-info {
    justify-content: center;
    margin-bottom: 2rem;
}

.quiz-info {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.info-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-field label {
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

.required {
    color: #e74c3c;
}

.info-field input[type="text"] {
    padding: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.info-field input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
}

.info-field input[type="text"]:invalid:not(:placeholder-shown),
.info-field input[type="text"].error {
    border-color: #e74c3c;
}

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

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    width: 0%;
    transition: width 0.3s ease;
}

.question-counter {
    text-align: center;
    color: #7f8c8d;
    font-weight: 500;
}

#question-container {
    margin-bottom: 2rem;
}

.question {
    margin-bottom: 1.5rem;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.answer-option {
    display: block;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background-color: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.answer-option:hover {
    background-color: #e8f4f8;
    border-color: #3498db;
}

.answer-option input[type="radio"] {
    margin-right: 0.75rem;
    cursor: pointer;
}

.answer-option.selected {
    background-color: #d5e8f4;
    border-color: #3498db;
}

.answer-option.correct {
    background-color: #d4edda;
    border-color: #28a745;
}

.answer-option.incorrect {
    background-color: #f8d7da;
    border-color: #dc3545;
}

.quiz-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.quiz-actions button {
    flex: 1;
}

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

.certificate-container {
    margin-bottom: 2rem;
}

.certificate-container.hidden {
    display: none;
}

.certificate {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 8px solid #2c3e50;
    border-radius: 10px;
    padding: 3rem;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
}

.certificate::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 2px solid #e74c3c;
    border-radius: 5px;
    pointer-events: none;
}

.certificate-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 3px solid #2c3e50;
    padding-bottom: 1rem;
}

.certificate-header h1 {
    font-size: 2.2rem;
    color: #2c3e50;
    margin: 0;
    font-weight: bold;
}

.certificate-body {
    text-align: left;
    margin: 2rem 0;
    padding: 1rem 0;
}

.certificate-text {
    font-size: 1rem;
    color: #34495e;
    margin: 0.8rem 0;
    line-height: 1.6;
}

.certificate-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin: 1rem 0;
    padding: 0.5rem 0;
    border-bottom: 2px solid #2c3e50;
    min-height: 2rem;
    text-align: center;
}

.certificate-list {
    margin: 1rem 0;
    padding-left: 2rem;
    color: #34495e;
    line-height: 1.8;
}

.certificate-list li {
    margin: 0.5rem 0;
}

.certificate-disclaimer {
    font-size: 0.9rem;
    color: #7f8c8d;
    font-style: italic;
    margin: 1.5rem 0;
    text-align: center;
    line-height: 1.6;
}

.certificate-footer {
    text-align: left;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid #2c3e50;
}

.certificate-date-label {
    font-size: 1rem;
    color: #34495e;
    margin-bottom: 0.5rem;
}

.certificate-date-label span {
    border-bottom: 1px solid #2c3e50;
    padding: 0 1rem;
    display: inline-block;
    min-width: 200px;
}

.certificate-signature {
    font-size: 1rem;
    color: #34495e;
    margin-top: 1rem;
}

.signature-name {
    text-decoration: underline;
}

.score-display {
    margin-bottom: 2rem;
}

.try-again-message {
    margin: 1.5rem 0;
    padding: 1rem;
    color: #000000;
    font-size: 1.1rem;
    font-weight: 600;
}

.try-again-message.hidden {
    display: none;
}

.try-again-message p {
    margin: 0;
}

.certificate-actions {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .certificate-container,
    .certificate-container * {
        visibility: visible;
    }
    
    .certificate-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    .certificate {
        background: white;
        border: 8px solid #2c3e50;
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    .certificate-actions {
        display: none;
    }
    
    header,
    footer,
    .quiz-section h2,
    .score-display,
    #results-feedback,
    .results-actions,
    .try-again-message {
        display: none;
    }
    
    @page {
        margin: 0.5in;
        size: letter;
    }
}

.score-text {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.score-percentage {
    font-size: 3rem;
    font-weight: bold;
    color: #3498db;
}

#results-feedback {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 5px;
    text-align: left;
}

.feedback-item {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: white;
    border-radius: 5px;
    border-left: 4px solid #3498db;
}

.feedback-item.correct {
    border-left-color: #28a745;
}

.feedback-item.incorrect {
    border-left-color: #dc3545;
}

.feedback-question {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.feedback-answer {
    color: #555;
    margin-top: 0.5rem;
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.results-actions a,
.results-actions button {
    min-width: 150px;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

footer p {
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .content h2 {
        font-size: 1.5rem;
    }

    .first-aid-topic {
        padding: 1.5rem;
    }

    .quiz-container {
        padding: 1rem;
    }

    .quiz-section {
        padding: 1.5rem;
    }

    .quiz-actions {
        flex-direction: column;
    }

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

    .quiz-info {
        flex-direction: column;
        gap: 1rem;
    }

    .info-field {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .info-field input[type="text"] {
        width: 100%;
    }

    .certificate {
        padding: 2rem 1.5rem;
    }

    .certificate-header h1 {
        font-size: 1.8rem;
    }

    .certificate-name {
        font-size: 1.3rem;
        min-width: auto;
        width: 100%;
    }

    .certificate-text {
        font-size: 0.9rem;
    }

    .certificate-list {
        padding-left: 1.5rem;
    }

    .certificate-date-label span {
        min-width: 150px;
    }
}

