:root {
    --quiz-page-bg: #f3f4f6;
    --quiz-card-bg: #ffffff;
    --quiz-button-color: #1e3a8a;
    --quiz-button-color-hover: #1e40af;
    --quiz-border-color: #d5dbe8;
    --quiz-muted: #64748b;
    --quiz-focus-ring: 0 0 0 4px rgba(37, 99, 235, 0.15);
    --quiz-form-gap: 25px;
    --error-color: #c0392b;
    --success-color: #28a745;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--quiz-page-bg);
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top */
    padding: 40px 24px;
    min-height: 100vh;
    box-sizing: border-box;
    line-height: 1.6;
}

.quiz-container {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    background-color: var(--quiz-card-bg);
    padding: 36px 40px;
    border-radius: 16px;
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.12);
}

.card {
    border: 1px solid #e1e4e8;
    border-radius: 10px;
    padding: 20px;
    background-color: #fff;
    margin-bottom: 25px;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
}

.viewer-language-switcher {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.viewer-language-switcher label {
    font-weight: 600;
    color: #34495e;
}

.viewer-language-switcher select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #2c3e50;
}

.lang-button {
    background-color: #ecf0f1;
    color: #34495e;
    border: 1px solid #bdc3c7;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.lang-button.active {
    background-color: #27ae60;
    color: white;
    border-color: #27ae60;
}


h1 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    color: #0f172a;
}

/* Quiz Description */
.quiz-intro-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.provider-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.provider-logo-wrapper {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.provider-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.provider-name {
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.provider-tagline {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.provider-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    font-size: 14px;
}

.provider-contacts a {
    color: #2563eb;
    text-decoration: none;
    background: #eff6ff;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #dbeafe;
}

.provider-contacts a:hover {
    background: #dbeafe;
}

.quiz-description {
    background-color: #f8fafc;
    border-left: 4px solid #93c5fd;
    border-radius: 10px;
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    color: #555;
}

.policy-agreement {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #2c3e50;
}

.policy-agreement input {
    margin-top: 4px;
}

.policy-agreement a {
    color: var(--quiz-button-color);
}

.start-quiz-button {
    width: 100%;
    background-color: var(--quiz-button-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    cursor: pointer;
    min-height: 44px;
    box-shadow: 0 12px 20px rgba(30, 58, 138, 0.2);
    transition: all 0.2s ease;
}

.start-quiz-button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.start-quiz-button:not(:disabled):hover {
    background-color: var(--quiz-button-color-hover);
    transform: translateY(-1px);
}

.intro-error {
    color: var(--error-color);
    font-size: 14px;
    margin: 0;
}

/* Payment Placeholder */
.payment-placeholder {
    border: 1px solid #b3e5fc;
    background-color: #f4fbff;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}
.payment-placeholder h2 {
    color: #1e88e5;
    margin-top: 0;
}
.payment-placeholder p {
    margin-bottom: 15px;
    color: #2c3e50;
}
.pay-button {
    width: auto;
    background-color: var(--quiz-button-color);
    padding: 10px 25px;
    font-size: 16px;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.pay-button:hover {
    background-color: var(--quiz-button-color-hover);
}
.payment-note {
    font-size: 12px;
    color: #777;
    margin-top: 10px;
}

.info-badge {
    display: inline-block;
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 14px;
}

.muted {
    color: #777;
    margin: 0 0 8px;
}

.quiz-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}


/* Quiz Form and Questions */
.form-group {
    margin-bottom: var(--quiz-form-gap);
}

.form-section {
    margin-bottom: 24px;
}

.section-helper {
    margin: 0 0 16px;
    color: #6b7280;
    font-size: 14px;
}

.question-card {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #0f172a;
}

.section-title {
    margin: 0 0 14px;
    padding: 0 0 10px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
    color: #1e293b;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea,
select { /* Added select for consistency */
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--quiz-border-color);
    border-radius: 12px;
    background: #fff;
    box-sizing: border-box;
    font-size: 16px;
    color: #0f172a;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    border-color: #2563eb;
    box-shadow: var(--quiz-focus-ring);
    outline: none;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.quiz-info-text {
    padding: 12px;
    background-color: #f8f9fb;
    border: 1px solid #e3e6ea;
    border-radius: 6px;
    color: #4a4f55;
    font-size: 15px;
    line-height: 1.5;
}

.choice-option {
    margin-bottom: 10px;
    position: relative;
}

.choice-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-option label {
    margin: 0;
    font-weight: 500;
    min-height: 48px;
    border-radius: 12px;
    border: 1px solid var(--quiz-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}


.choice-option label:hover,
.choice-option input:focus + label {
    border-color: #93c5fd;
}
.radio-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.checkbox-options-list {
    display: grid;
    gap: 0.75rem;
}

.choice-option input[type="radio"] + label {
    justify-content: center;
    font-weight: 600;
}

.choice-option input[type="radio"]:checked + label {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: #fff;
    box-shadow: none;
}

.choice-option input[type="checkbox"] + label::after {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    flex-shrink: 0;
}

.choice-option input[type="checkbox"]:checked + label {
    background: #eff6ff;
    border-color: #1e3a8a;
    color: #1e3a8a;
}

.choice-option input[type="checkbox"]:checked + label::after {
    background: #1e3a8a;
    border-color: #1e3a8a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.file-upload-zone {
    min-height: 118px;
    border: 2px dashed #3b82f6;
    border-radius: 14px;
    background: #f8fbff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    color: #1e3a8a;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    padding: 14px;
}

.file-upload-zone:hover,
.file-upload-zone:focus-within {
    background: #eaf2ff;
    box-shadow: var(--quiz-focus-ring);
}

.file-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
}

.file-upload-icon svg {
    width: 100%;
    height: 100%;
}

.file-upload-text {
    font-weight: 600;
}

/* Tab/Step Styles */
.quiz-tab {
    /* Initially hidden by JS */
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
}
.quiz-tab:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

/* Navigation Buttons */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.navigation-buttons button {
    width: auto;
    padding: 10px 25px;
    background-color: var(--quiz-button-color);
    color: #fff;
    border: none;
    border-radius: 6px;
}
.navigation-buttons button:hover {
    background-color: var(--quiz-button-color-hover);
}
.navigation-buttons button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}
#prev-tab-button {
    background-color: #95a5a6;
}
#prev-tab-button:hover:not(:disabled) {
     background-color: #7f8c8d;
}

/* Submit Button */
button[type="submit"] {
    width: 100%;
    min-height: 46px;
    padding: 13px;
    background-color: var(--quiz-button-color);
    color: white;
    border: none;
    border-radius: 12px;
   font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(30, 58, 138, 0.24);
    transition: all 0.2s;
    margin-top: 30px; /* Increased margin */
}

button[type="submit"]:hover {
    background-color: var(--quiz-button-color-hover);
    transform: translateY(-1px);
    box-shadow: 0 16px 26px rgba(30, 58, 138, 0.3);
}

button[type="submit"]:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}


/* Thank You / Error Messages */
#thank-you-message {
    text-align: center;
    padding: 40px 0;
}
#thank-you-message h2 {
    color: #27ae60;
}

.error-message {
    color: var(--error-color);
    background-color: #fff5f5;
    border: 1px solid var(--error-color);
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    text-align: center;
}

.success-message {
    color: var(--success-color);
    background-color: #d4edda;
    border: 1px solid var(--success-color);
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    text-align: center;
}

.result-card {
    margin-top: 16px;
    border: 1px solid #e1e4e8;
    background: #f9fafb;
}

.result-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 12px;
}

.result-label {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #1a1f36;
}

.result-score {
    margin: 0;
    color: #4b5563;
    font-weight: 600;
}

.result-description {
    margin: 0;
    color: #374151;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.email-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
}

.email-row input {
    width: 100%;
}

.secondary-action {
    background-color: #eef2ff;
    color: #3b1eff;
    border: 1px solid #d4d9ff;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.secondary-action:hover {
    background-color: #e0e7ff;
}

.report-status {
    margin: 0;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    body {
        padding: 24px 16px;
        align-items: stretch;
    }
    .quiz-container {
        padding: 24px 20px;
        border-radius: 12px;
    }
    h1 {
        font-size: 24px;
    }
    :root {
        --quiz-form-gap: 18px;
    }
    .choice-option {
        margin-bottom: 8px;
    }
    .radio-options-grid {
        grid-template-columns: 1fr;
    }
    .quiz-description {
        margin-bottom: 20px;
    }

    .file-upload-zone {
        min-height: 104px;
        padding: 12px;
    }

    .file-upload-icon {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 16px 12px;
    }
    .quiz-container {
        padding: 20px 16px;
    }
    button[type="submit"] {
        font-size: 15px;
        padding: 12px;
    }
    .quiz-description {
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    body {
        background-color: #fff;
        padding: 0;
        margin: 0;
    }
    .quiz-container {
        box-shadow: none;
        border: none;
        max-width: 100%;
        padding: 0;
    }
    .language-switcher,
    .viewer-language-switcher,
    .pay-button,
    button[type="submit"],
    .navigation-buttons,
    .error-message {
        display: none !important; /* Hide all interactive elements */
    }
    .quiz-description {
        border: none;
        padding: 0;
        margin-bottom: 20px;
    }
    h1 {
        font-size: 24px;
    }
    .card {
        border: none;
        box-shadow: none;
        padding: 0;
    }
    .payment-placeholder {
         border: 1px solid #ccc;
         background: #f9f9f9;
         padding: 15px;
         text-align: left;
    }
    .payment-placeholder h2 {
         font-size: 18px;
    }
    .payment-note {
        display: none;
    }
    .quiz-tab {
        display: block !important; /* Show all tabs */
        border-top: 1px solid #eee;
        padding-top: 15px;
        margin-top: 15px;
        page-break-inside: avoid;
    }
    .form-group {
        page-break-inside: avoid;
    }
}


.legal-modal.hidden {
    display: none;
}

.legal-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
}

.legal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
}

.legal-modal-dialog {
    position: relative;
    max-width: 640px;
    margin: 8vh auto;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
}

.legal-consent-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.legal-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
