/**
 * Self-Test Quiz Styles
 * Modern, clean styling similar to NVISION quiz
 */

/* Quiz Wrapper */
.self-test-quiz-wrapper {
    position: relative;
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.quiz-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* Sidebar */
.quiz-sidebar {
    flex: 0 0 300px;
    padding: 2rem 1rem;
}

.quiz-main-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.4;
    transition: opacity 0.3s ease;
}

.quiz-label-text {
    display: block;
}

.quiz-label-text.hidden {
    display: none;
}

.quiz-label-text.opacity-0 {
    opacity: 0;
}

.quiz-label-text.opacity-100 {
    opacity: 1;
}

.quiz-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a56db;
    line-height: 1.2;
    transition: opacity 0.3s ease;
}

.quiz-title-text {
    display: block;
}

.quiz-title-text.hidden {
    display: none;
}

.quiz-title-text.opacity-0 {
    opacity: 0;
}

.quiz-title-text.opacity-100 {
    opacity: 1;
}

/* Quiz Content */
.quiz-content {
    flex: 1;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    min-height: 500px;
}

.quiz-swiper {
    width: 100%;
    height: auto;
}

.quiz-swiper .swiper-wrapper {
    align-items: stretch;
}

.quiz-swiper .swiper-slide {
    height: auto;
    display: flex;
    align-items: stretch;
}

/* Question Slide */
.quiz-question-slide {
    padding: 2rem 2.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.quiz-step-counter {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.quiz-question-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2rem;
    line-height: 1.3;
    display: block;
    width: 100%;
}

/* Ensure question title is always visible */
.quiz-question-title {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Answers */
.quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Radio answers with 2 options - display in 2 columns */
.quiz-answers-radios.quiz-answers-two-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.quiz-answers-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.quiz-answer-option {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.quiz-answer-option:hover {
    border-color: #1a56db;
    background: #f0f4ff;
}

.quiz-answer-option input[type="radio"],
.quiz-answer-option input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.quiz-answer-option input:checked + .quiz-answer-image-wrapper + .quiz-answer-text,
.quiz-answer-option input:checked ~ .quiz-answer-text {
    font-weight: 600;
}

.quiz-answer-option input[type="radio"]:checked,
.quiz-answer-option input[type="checkbox"]:checked {
    accent-color: #1a56db;
}

.quiz-answer-text {
    flex: 1;
    font-size: 1rem;
    color: #1e293b;
    line-height: 1.5;
}

/* Answer Options with Images */
.quiz-answer-with-image {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    overflow: hidden;
}

.quiz-answer-image-wrapper {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative;
    background: #f3f4f6;
}

.quiz-answer-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.quiz-answer-with-image:hover .quiz-answer-image {
    transform: scale(1.05);
}

.quiz-answer-with-image input[type="radio"],
.quiz-answer-with-image input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.quiz-answer-with-image input[type="radio"]:checked,
.quiz-answer-with-image input[type="checkbox"]:checked {
    background: #1a56db;
    border-color: #1a56db;
}

.quiz-answer-with-image .quiz-answer-text {
    padding: 1rem 1.25rem;
    margin: 0;
    text-align: center;
    font-weight: 500;
}

.quiz-answer-with-image input:checked ~ .quiz-answer-text,
.quiz-answer-with-image input:checked + .quiz-answer-image-wrapper + .quiz-answer-text {
    background: #f0f4ff;
    font-weight: 600;
}

.quiz-answer-with-image:has(input:checked) {
    border-color: #1a56db;
    border-width: 3px;
}

/* Answers grid when images are present */
.quiz-answers-with-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.quiz-answers-with-images.quiz-answers-radios {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.quiz-answers-with-images.quiz-answers-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

/* Yes/No Buttons - always 2 columns */
.quiz-yes-no-buttons {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
    margin-bottom: 2rem;
}

.quiz-yes-no-buttons .quiz-answer-option {
    justify-content: center;
    max-width: 100%;
}

/* Textarea Question */
.quiz-question-slide:has(.quiz-textarea-wrapper) .quiz-question-title {
    margin-bottom: 1.5rem;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.quiz-textarea-wrapper {
    margin-bottom: 2rem;
    margin-top: 0;
}

.quiz-textarea-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.2s ease;
}

.quiz-textarea-input:focus {
    outline: none;
    border-color: #1a56db;
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.quiz-textarea-input::placeholder {
    color: #9ca3af;
}


/* Yes Question Follow-up */
.quiz-yes-question {
    margin-top: 2rem;
    opacity: 0.3;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.quiz-yes-question:not(.quiz-yes-question-hidden) {
    opacity: 1;
    pointer-events: all;
}

.quiz-yes-question-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

.quiz-yes-question input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Next Button */
.quiz-next-button-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
}

.quiz-next-button {
    padding: 0.75rem 2rem;
    background: #1a56db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-next-button:hover {
    background: #1649c0;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.quiz-next-button:active {
    transform: translateY(0);
}

.quiz-next-button:disabled {
    background: #9ca3af;
    color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-next-button:disabled:hover {
    background: #9ca3af;
    transform: none;
    box-shadow: none;
}

/* Form Slide */
.quiz-form-slide {
    padding: 2rem 2.5rem;
    width: 100%;
}

.quiz-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    margin-bottom: 1rem;
}

.quiz-form-content {
    margin-bottom: 2rem;
    color: #4b5563;
    line-height: 1.6;
}

.quiz-form-content p {
    margin-bottom: 1rem;
}

.quiz-form-wrapper {
    margin: 0 auto;
}

.quiz-form-wrapper .hidden {
    display: none;
}

/* Hide Gravity Forms confirmation message immediately - we show our custom results instead */
.quiz-form-wrapper .gform_confirmation_message,
.quiz-form-wrapper .gform_confirmation_wrapper,
.quiz-form-wrapper .gform_confirmation {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Results Slide (deprecated - kept for backwards compatibility) */
.quiz-results-slide {
    padding: 2rem 2.5rem;
    width: 100%;
}

.quiz-results-slide.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Results Wrapper - standalone outside of slider */
.quiz-results-wrapper {
    width: 100%;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

.quiz-results-wrapper.hidden {
    display: none;
}

.quiz-results-content {
    max-width: 1500px;
    margin: 0 auto;
    text-align: center;
    width: 100%;
    padding: 2rem 2rem;
    box-sizing: border-box;
}

/* Override for confirmation page */
body.quiz-confirmation-active .quiz-results-content,
body:has(#lasikToolResults .quiz-result-content:not(.hidden)) .quiz-results-content {
    max-width: 1500px !important;
    width: 100% !important;
    margin: 0 auto;
}

.quiz-results-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.quiz-results-body {
    font-size: 1.125rem;
    color: #4b5563;
    line-height: 1.7;
}

.quiz-results-body p {
    margin-bottom: 1rem;
}

.quiz-results-body p:last-child {
    margin-bottom: 0;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Prevent horizontal overflow on quiz wrapper */
    .self-test-quiz-wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .quiz-container {
        flex-direction: column;
        padding: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .quiz-sidebar {
        flex: 0 0 auto;
        width: 100%;
        padding: 1.5rem 1rem;
        background: #f9fafb;
    }

    .quiz-title {
        font-size: 1.5rem;
    }

    .quiz-content {
        border-radius: 0;
        box-shadow: none;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .quiz-question-slide {
        padding: 1.5rem 1.25rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .quiz-question-title {
        font-size: 1.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* All answer choices in 1 column on mobile */
    .quiz-answers {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .quiz-answers-radios {
        grid-template-columns: 1fr !important;
        display: grid !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .quiz-answers-radios.quiz-answers-two-options {
        grid-template-columns: 1fr !important;
    }

    .quiz-answers-checkboxes {
        grid-template-columns: 1fr !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .quiz-answers-with-images {
        grid-template-columns: 1fr !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Answer options - constrain width and prevent overflow */
    .quiz-answer-option {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
        overflow: hidden;
    }

    .quiz-answer-text {
        min-width: 0 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
    }

    /* Hide images on mobile */
    .quiz-answer-image-wrapper {
        display: none !important;
    }

    .quiz-answer-with-image {
        flex-direction: row !important;
        align-items: center !important;
        padding: 1rem 1.25rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
        overflow: hidden;
    }

    .quiz-answer-with-image .quiz-answer-text {
        padding: 0 !important;
        text-align: left !important;
        min-width: 0 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
    }

    /* Yes/No buttons also in 1 column on mobile */
    .quiz-yes-no-buttons {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .quiz-yes-no-buttons .quiz-answer-option {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .quiz-form-slide {
        padding: 1.5rem 1.25rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* Prevent horizontal overflow on swiper */
    .quiz-swiper {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .quiz-swiper .swiper-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    .quiz-swiper .swiper-slide {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Swiper adjustments */
.quiz-swiper .swiper-slide {
    padding: 0;
}

/* Ensure forms are properly styled */
.quiz-form-wrapper .gform_wrapper {
    max-width: 100%;
}

.quiz-form-wrapper .gform_wrapper form {
    margin: 0;
}

/* Full Width Confirmation Styles */
/* Hide sidebar and quiz container when confirmation is shown */
body.quiz-confirmation-active .quiz-sidebar,
body.quiz-confirmation-active .quiz-container {
    display: none !important;
}

/* Results wrapper styling when active */
body.quiz-confirmation-active .quiz-results-wrapper {
    display: block !important;
}

body.quiz-confirmation-active .quiz-results-content {
    max-width: 1500px !important;
    margin: 0 auto;
}

/* Alternative approach using :has() selector (modern browsers) */
body:has(#lasikToolResults .quiz-result-content:not(.hidden)) .quiz-sidebar {
    display: none !important;
}

body:has(#lasikToolResults .quiz-result-content:not(.hidden)) .quiz-container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

body:has(#lasikToolResults .quiz-result-content:not(.hidden)) .quiz-content {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
}

body:has(#lasikToolResults .quiz-result-content:not(.hidden)) #lasikToolResults {
    max-width: 1500px !important;
    width: 100% !important;
    margin: 0 auto;
    padding: 2rem 2rem;
    box-sizing: border-box;
}

/* Mobile adjustments for full-width confirmation */
@media (max-width: 768px) {
    body.quiz-confirmation-active .quiz-results-wrapper,
    body:has(.quiz-results-wrapper:not(.hidden)) .quiz-results-wrapper {
        padding: 1rem 0.5rem;
    }

    body.quiz-confirmation-active .quiz-results-content,
    body:has(.quiz-results-wrapper:not(.hidden)) .quiz-results-content {
        padding: 1.5rem 1rem;
        max-width: 100% !important;
    }
}

/* Self-test quiz specific h4 styling */
.self-test-quiz-wrapper h4 {
    margin-top: 1em;
}

