/* Quiz Styles */
body .quiz-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative; /* For absolute positioned elements */
}

.quiz-screen {
    display: none;
    padding: 30px;
}

.quiz-screen.active {
    display: block;
}

.quiz-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.quiz-description {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 30px;
    color: #666;
}

.quiz-progress {
    height: 8px;
    background: #f1f1f1;
    margin-bottom: 25px;
    border-radius: 4px;
    overflow: hidden;
}

.quiz-progress-bar {
    height: 100%;
    background: #4a90e2;
    width: 0;
    transition: width 0.3s ease;
}

.quiz-question {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 20px;
    color: #333;
    word-wrap: break-word; /* Handle long words */
}

.quiz-instructions {
    color: #666;
    margin-bottom: 15px;
}

.quiz-options {
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.quiz-option-placeholder {
    width: 100%;
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
}

/* Base styles for all options */
.quiz-option {
    border: 2px solid #eee;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: calc(50% - 10px);
    box-sizing: border-box;
    word-wrap: break-word;
    position: relative;
    background: #f9f9f9;
    text-align: left;
}

.quiz-option:hover {
    border-color: #4a90e2;
    background: #f5f8ff;
}

.quiz-option.selected {
    border-color: #4a90e2;
    background: #ecf3fe;
}

/* Single-select option styles */
.quiz-option:not(.quiz-multi-option) {
    padding: 15px 20px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.quiz-option:not(.quiz-multi-option):hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.quiz-option:not(.quiz-multi-option).selected {
    color: #4a90e2;
    font-weight: 500;
    transform: translateY(-2px);
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.15);
}

.quiz-option .option-text {
    text-align: left;
    width: 100%;
}

/* Multi-select option styles */
.quiz-multi-option {
    display: flex;
    align-items: flex-start;
    padding: 15px 18px;
    position: relative;
    border-color: #ddd;
    border-width: 2px;
    border-style: solid;
    margin-bottom: 5px;
    transition: all 0.2s ease;
}

.quiz-multi-option:hover {
    border-color: #4a90e2;
    background: #f5f8ff;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.quiz-multi-option.selected {
    border-color: #4a90e2;
    background: #ecf3fe;
}

.quiz-multi-option .checkbox-indicator {
    width: 24px;
    height: 24px;
    border: 2px solid #999;
    border-radius: 4px;
    margin-right: 15px;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: all 0.15s ease-in-out;
}

.quiz-multi-option:hover .checkbox-indicator {
    transform: scale(1.05);
    border-color: #4a90e2;
    background-color: #f0f7ff;
}

.quiz-multi-option:active .checkbox-indicator {
    transform: scale(0.95);
}

.quiz-multi-option.selected .checkbox-indicator {
    border-color: #4a90e2;
    background-color: #4a90e2;
    box-shadow: 0 1px 4px rgba(74,144,226,0.4);
}

.quiz-multi-option.selected .checkbox-indicator:after {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    animation: checkmark 0.2s ease-in-out;
}

@keyframes checkmark {
    0% { opacity: 0; transform: scale(0.5) rotate(45deg); }
    100% { opacity: 1; transform: scale(1) rotate(45deg); }
}

.quiz-multi-option .option-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.4;
    padding-top: 3px;
    text-align: left;
}

/* Add multi-select label to make it extra clear */
.quiz-options.multi-select-mode {
    position: relative;
    padding-top: 15px;
    border-top: 2px dashed #d5e5f9;
    border-bottom: 2px dashed #d5e5f9;
    padding-bottom: 15px;
    margin-top: 15px;
}

/* Remove the SELECT MULTIPLE label */
.quiz-options.multi-select-mode:before {
    display: none;
}

.quiz-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    position: relative;
    min-width: 200px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-top: 10px;
}

.quiz-btn:hover {
    background: #3a80d2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.quiz-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Highlight style for when options are selected */
.quiz-btn-highlight {
    background: #3a80d2;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
    transform: translateY(-1px);
}

.quiz-btn-highlight:hover {
    background: #2a70c2;
    box-shadow: 0 3px 10px rgba(74, 144, 226, 0.4);
}

/* Help text styles */
.quiz-help-text {
    font-size: 14px;
    color: #666;
    background: #f5f8ff;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 3px solid #4a90e2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#multi-select-help {
    color: #4a6891;
    background: #f0f7ff;
    border-left-color: #5d9cec;
}

#multi-select-help strong {
    color: #3a7cd5;
    font-weight: 600;
}

.quiz-email-form {
    margin-top: 20px;
    margin-bottom: 30px;
}

.quiz-email-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    box-sizing: border-box; /* Ensure proper sizing */
}

.quiz-results {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    margin-top: 20px;
}

.quiz-offer {
    margin-top: 30px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    overflow: hidden;
}

.quiz-offer-image {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%; /* Prevent image overflow */
}

.quiz-offer-content {
    padding: 20px;
    text-align: center; /* Center all content in the offer box */
}

.quiz-offer-headline {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    word-wrap: break-word; /* Handle long words */
    text-align: center; /* Center the headline */
}

.quiz-offer-description {
    margin-bottom: 20px;
    color: #666;
    text-align: center; /* Center the description */
}

.quiz-offer-btn {
    display: inline-block;
    background: #4a90e2;
    color: white;
    padding: 15px 30px;
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin: 0 auto;
    text-align: center;
    min-width: 200px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.quiz-offer-btn:hover {
    background: #3a80d2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.quiz-error {
    color: #e74c3c;
    margin-top: 10px;
}

/* Email detected banner */
#email-detected-message {
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Loading Spinner (as a fallback to the inline styles) */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(74, 144, 226, 0.3);
    border-radius: 50%;
    border-top-color: #4a90e2;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Styles */
@media screen and (max-width: 768px) {
    .quiz-screen {
        padding: 20px;
    }
    
    .quiz-title {
        font-size: 20px;
    }
    
    .quiz-btn {
        padding: 14px 25px;
        font-size: 16px;
        width: 100%;
        min-width: 0; /* Reset min-width for mobile */
    }
    
    .quiz-offer-btn {
        padding: 14px 25px;
        font-size: 16px;
        width: 100%;
        min-width: 0; /* Reset min-width for mobile */
    }
    
    .quiz-option {
        padding: 12px;
        width: 100%;
    }
    
    .quiz-options {
        flex-direction: column;
        gap: 10px;
    }

    .quiz-multi-option {
        padding: 12px;
    }
    
    .quiz-multi-option .checkbox-indicator {
        width: 22px;
        height: 22px;
        margin-right: 12px;
    }
    
    .quiz-options.multi-select-mode:before {
        font-size: 12px;
        padding: 4px 10px;
        top: -25px;
    }
}

@media screen and (max-width: 480px) {
    .quiz-screen {
        padding: 15px;
    }
    
    .quiz-title {
        font-size: 18px;
    }
    
    .quiz-question {
        font-size: 16px;
    }
    
    .quiz-description {
        font-size: 14px;
    }

    .quiz-offer-headline {
        font-size: 18px;
    }

    .quiz-offer-content {
        padding: 15px;
    }
    
    #email-detected-message {
        font-size: 14px;
        padding: 8px;
    }
}

/* Fixed positioning for potential bottom action buttons */
.quiz-fixed-bottom {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

/* Fallback styles for browsers that don't support modern CSS */
.no-flexbox .quiz-options {
    overflow: hidden;
}

.no-flexbox .quiz-option {
    float: left;
    margin-right: 2%;
    width: 48%;
}

@supports not (display: flex) {
    .quiz-options {
        overflow: hidden;
    }
    
    .quiz-option {
        float: left;
        margin-right: 2%;
        width: 48%;
    }
}

/* Fix for IE and older browsers */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .quiz-options {
        display: block;
        overflow: hidden;
    }
    
    .quiz-option {
        float: left;
        margin-right: 2%;
        width: 48%;
    }
}

/* Additional accessibility focus styles */
.quiz-option:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.4);
}

/* Make single-select options more interactive */
.quiz-option:not(.quiz-multi-option) {
    padding-left: 50px;
    transition: all 0.15s ease-in-out;
}

.quiz-option:not(.quiz-multi-option):hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Multi-select question mode */
.multi-select-question #question-instructions {
    display: none; /* Hide the select all that apply block */
}

.quiz-offer-separator {
    margin: 30px 0;
    border-top: 1px solid #e1e1e1;
}

/* Post-offers navigation section */
.post-offers-section {
    margin-top: 40px;
    text-align: center;
    padding: 25px;
    border-top: 2px solid #e1e1e1;
    background-color: #f9f9f9;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    clear: both; /* Ensure it clears any floated elements */
    position: relative; /* Establish position context */
    z-index: 2; /* Ensure it's above other elements */
}

.post-offers-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 20px;
    color: #333;
}

#send-offers-btn {
    margin-bottom: 15px;
    min-width: 220px;
    padding: 15px 30px;
}

#skip-offers-link {
    color: #4a90e2;
    text-decoration: underline;
    font-size: 15px;
    display: inline-block;
    margin-top: 15px;
    padding: 5px;
}

#skip-offers-link:hover {
    color: #3a80d2;
    text-decoration: underline;
}

/* Text input question styles */
.quiz-text-input-container {
    width: 100%;
    margin: 15px 0;
}

.quiz-text-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.quiz-text-input:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.text-input-question .quiz-text-input-container {
    max-width: 500px;
    margin: 20px auto;
}
