/**
 * Quiz Funnels CSS
 * Styles for interactive quiz blocks across recipe pages
 */

/* ===== QUIZ FUNNEL BLOCK STYLES ===== */
.quiz-funnel {
    background: linear-gradient(135deg, #fff5f5 0%, #fef7ff 100%);
    border: 2px solid #f8e8ff;
    border-radius: 16px;
    padding: 24px;
    margin: 32px 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(234, 88, 12, 0.1);
    transition: all 0.3s ease;
}

.quiz-funnel:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(234, 88, 12, 0.15);
    border-color: #ea580c;
}

.quiz-funnel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ea580c, #dc2626, #ea580c);
    border-radius: 16px 16px 0 0;
}

/* ===== QUIZ HEADER & CONTENT ===== */
.quiz-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.quiz-emoji {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
    animation: gentle-bounce 2s ease-in-out infinite;
}

@keyframes gentle-bounce {
    0%, 20%, 50%, 80%, 100% { 
        transform: translateY(0); 
    }
    40% { 
        transform: translateY(-4px); 
    }
    60% { 
        transform: translateY(-2px); 
    }
}

.quiz-content {
    flex: 1;
}

.quiz-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ea580c, #dc2626);
    color: white;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.quiz-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.quiz-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0 0 20px 0;
    line-height: 1.4;
}

/* ===== QUIZ CTA BUTTON ===== */
.quiz-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(234, 88, 12, 0.3);
    position: relative;
    overflow: hidden;
}

.quiz-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.quiz-cta:hover::before {
    left: 100%;
}

.quiz-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.4);
}

.quiz-cta:active {
    transform: translateY(0);
}

.quiz-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.quiz-cta:hover .quiz-arrow {
    transform: translateX(2px);
}

/* ===== QUESTION-ONLY MODE STYLES ===== */
.quiz-question-only-wrapper {
    margin: 32px 0;
}

.question-only-options-box {
    background: linear-gradient(135deg, #fff5f5 0%, #fef7ff 100%);
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.question-only-options-box:hover {
    border-color: #ea580c;
    box-shadow: 0 4px 16px rgba(234, 88, 12, 0.1);
}

.question-only-text {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 18px;
    line-height: 1.4;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lightbulb-icon {
    color: #ea580c;
    font-size: 22px;
    flex-shrink: 0;
}

.question-only-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.question-only-option {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #333;
    font-size: 16px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 12px;
}

.question-only-option:hover {
    background: #fff5f5;
    border-color: #ea580c;
    transform: translateX(2px);
}

.question-only-option.selected {
    background: linear-gradient(135deg, #ea580c, #dc2626);
    color: white;
    border-color: #ea580c;
}

/* Radio button styles */
.radio-button {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #e9ecef;
    background: white;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.question-only-option:hover .radio-button {
    border-color: #ea580c;
}

.question-only-option.selected .radio-button {
    border-color: white;
    background: white;
}

.radio-inner {
    width: 8px;
    height: 8px;
    background: transparent;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: all 0.3s ease;
}

.question-only-option.selected .radio-inner {
    background: #ea580c;
    transform: translate(-50%, -50%) scale(1);
}

.option-text {
    flex: 1;
}

/* Enhanced mobile styles */
@media (max-width: 768px) {
    .quiz-question-only-wrapper {
        margin: 24px 0;
    }

    .question-only-options-box {
        padding: 18px;
    }

    .question-only-text {
        font-size: 18px !important;
        font-weight: 700 !important;
    }

    .question-only-option {
        padding: 16px 16px;
        font-size: 15px;
        font-weight: 500;
        /* Better touch targets */
        min-height: 48px;
    }
    
    .radio-button {
        width: 18px;
        height: 18px;
    }
    
    .radio-inner {
        width: 6px;
        height: 6px;
    }
}

/* Disable animations when setting is off */
.no-animations .question-only-option:hover {
    transform: none;
}

/* Legacy support for old question-only blocks */
.quiz-question-only {
    background: linear-gradient(135deg, #fff5f5 0%, #fef7ff 100%);
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    transition: all 0.3s ease;
}

.quiz-question-only:hover {
    border-color: #ea580c;
    box-shadow: 0 4px 16px rgba(234, 88, 12, 0.1);
}

/* For inline questions in full quiz blocks */
.inline-question {
    margin-top: 20px;
}

.question-text {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 18px;
    line-height: 1.4;
    font-family: inherit;
}

.inline-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inline-option {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #333;
    font-size: 16px;
    line-height: 1.4;
}

.inline-option:hover {
    background: #fff5f5;
    border-color: #ea580c;
    transform: translateX(2px);
}

.inline-option.selected {
    background: linear-gradient(135deg, #ea580c, #dc2626);
    color: white;
    border-color: #ea580c;
}

/* Enhanced mobile styles for inline questions */
@media (max-width: 768px) {
    .question-text {
        font-size: 19px !important;
        font-weight: 700 !important;
    }

    .inline-option {
        padding: 16px 16px;
        font-size: 15px;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

/* ===== QUIZ MODAL STYLES ===== */
.quiz-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    backdrop-filter: blur(4px);
    /* Prevent clicks from going through */
    pointer-events: auto;
}

.quiz-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

/* Hide background content when modal is active */
body:has(.quiz-modal.active) .quiz-funnel,
body:has(.quiz-modal.active) .quiz-question-only {
    pointer-events: none;
}

/* Force modal to be on top */
.quiz-modal.active {
    z-index: 99999;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.quiz-modal-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.4s ease;
    /* Ensure content doesn't allow clicks to pass through */
    pointer-events: auto;
    z-index: 100000;
}

@keyframes slideIn {
    from { 
        transform: translateY(30px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

.quiz-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.quiz-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* ===== QUIZ QUESTIONS & OPTIONS ===== */
.quiz-question {
    margin-bottom: 24px;
}

.quiz-question h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 16px;
    line-height: 1.3;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #333;
}

.quiz-option:hover {
    background: #fff5f5;
    border-color: #ea580c;
    transform: translateX(4px);
}

.quiz-option.selected {
    background: linear-gradient(135deg, #ea580c, #dc2626);
    color: white;
    border-color: #ea580c;
}

/* ===== QUIZ PROGRESS BAR ===== */
.quiz-progress {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    margin-bottom: 24px;
    overflow: hidden;
}

.quiz-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ea580c, #dc2626);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ===== QUIZ NAVIGATION ===== */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
}

.quiz-nav-btn {
    background: #ea580c;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.quiz-nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.quiz-nav-btn:not(:disabled):hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.quiz-nav-btn .arrow {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.quiz-nav-btn:hover .arrow {
    transform: translateX(2px);
}

/* ===== EXIT-INTENT POPUP STYLES ===== */
.exit-intent-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
    pointer-events: auto;
}

.exit-intent-popup {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.4s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    z-index: 100000;
}

.exit-intent-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: 300;
    line-height: 1;
}

.exit-intent-close:hover {
    background: #f5f5f5;
    color: #333;
    transform: scale(1.1);
}

.exit-intent-content {
    margin-top: 8px;
}

/* Exit-intent specific quiz styles */
.exit-intent-popup .quiz-funnel {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.exit-intent-popup .quiz-funnel:hover {
    transform: none;
    box-shadow: none;
}

.exit-intent-popup .quiz-funnel::before {
    display: none;
}

.exit-intent-popup .quiz-header {
    text-align: center;
    margin-bottom: 24px;
}

.exit-intent-popup .quiz-emoji {
    font-size: 40px;
    margin-bottom: 16px;
}

.exit-intent-popup .quiz-title {
    font-size: 22px;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.exit-intent-popup .quiz-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 24px;
}

.exit-intent-popup .quiz-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    padding: 16px 32px;
    border-radius: 30px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.3);
    position: relative;
    overflow: hidden;
}

.exit-intent-popup .quiz-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(234, 88, 12, 0.4);
}

/* Exit-intent question-only styles */
.exit-intent-popup .question-only-options-box {
    background: none;
    border: none;
    padding: 0;
}

.exit-intent-popup .question-only-text {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 22px;
    text-align: center;
    color: #1a1a1a;
}

.exit-intent-popup .question-only-options {
    gap: 12px;
}

.exit-intent-popup .question-only-option {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #333;
    font-size: 16px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
}

.exit-intent-popup .question-only-option:hover {
    background: #fff5f5;
    border-color: #ea580c;
    transform: translateX(4px);
}

.exit-intent-popup .question-only-option.selected {
    background: linear-gradient(135deg, #ea580c, #dc2626);
    color: white;
    border-color: #ea580c;
}

.exit-intent-popup .radio-button {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #e9ecef;
    background: white;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.exit-intent-popup .question-only-option:hover .radio-button {
    border-color: #ea580c;
}

.exit-intent-popup .question-only-option.selected .radio-button {
    border-color: white;
    background: white;
}

.exit-intent-popup .radio-inner {
    width: 8px;
    height: 8px;
    background: transparent;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: all 0.3s ease;
}

.exit-intent-popup .question-only-option.selected .radio-inner {
    background: #ea580c;
    transform: translate(-50%, -50%) scale(1);
}

/* ===== MOBILE RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
    .quiz-funnel {
        margin: 24px 0;
        padding: 20px;
    }

    .quiz-header {
        gap: 12px;
    }

    .quiz-emoji {
        font-size: 28px;
    }

    .quiz-title {
        font-size: 16px;
    }

    .quiz-subtitle {
        font-size: 13px;
    }

    .quiz-cta {
        font-size: 13px;
        padding: 10px 20px;
    }

    .quiz-modal-content {
        padding: 24px;
        border-radius: 16px;
    }

    .quiz-question h3 {
        font-size: 18px;
    }

    .quiz-option {
        padding: 14px;
    }

    /* Exit-intent mobile styles */
    .exit-intent-popup {
        padding: 24px;
        border-radius: 16px;
        margin: 20px;
        width: calc(100% - 40px);
    }

    .exit-intent-close {
        font-size: 24px;
        width: 32px;
        height: 32px;
        top: 12px;
        right: 12px;
    }

    .exit-intent-popup .quiz-emoji {
        font-size: 32px;
        margin-bottom: 12px;
    }

    .exit-intent-popup .quiz-title {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .exit-intent-popup .quiz-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .exit-intent-popup .quiz-cta {
        font-size: 14px;
        padding: 14px 28px;
        border-radius: 25px;
    }

    .exit-intent-popup .question-only-text {
        font-size: 20px !important;
        font-weight: 700 !important;
        margin-bottom: 18px;
    }

    .exit-intent-popup .question-only-option {
        padding: 16px 18px;
        font-size: 15px;
        min-height: 52px;
    }

    .exit-intent-popup .radio-button {
        width: 20px;
        height: 20px;
    }

    .exit-intent-popup .radio-inner {
        width: 6px;
        height: 6px;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    .quiz-emoji {
        animation: none;
    }
    
    .quiz-funnel:hover {
        transform: none;
    }
    
    .quiz-cta:hover {
        transform: none;
    }
    
    .quiz-option:hover {
        transform: none;
    }

    .exit-intent-overlay,
    .exit-intent-popup {
        animation: none;
    }
    
    .exit-intent-popup .question-only-option:hover {
        transform: none;
    }
    
    .exit-intent-popup .quiz-cta:hover {
        transform: none;
    }
}

/* Focus states for keyboard navigation */
.quiz-cta:focus,
.quiz-option:focus,
.quiz-nav-btn:focus {
    outline: 2px solid #ea580c;
    outline-offset: 2px;
}

.exit-intent-popup .quiz-cta:focus,
.exit-intent-popup .question-only-option:focus,
.exit-intent-close:focus {
    outline: 2px solid #ea580c;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .quiz-funnel {
        border-color: #000;
    }
    
    .quiz-option {
        border-color: #000;
    }
    
    .quiz-option.selected {
        background: #000;
        color: #fff;
    }

    .exit-intent-popup .question-only-option {
        border-color: #000;
    }
    
    .exit-intent-popup .question-only-option.selected {
        background: #000;
        color: #fff;
    }
}

/* Prevent body scroll when modals are active */
body:has(.exit-intent-overlay) {
    overflow: hidden;
}

/* ===== PRINT STYLES ===== */
@media print {
    .quiz-funnel,
    .quiz-modal,
    .exit-intent-overlay {
        display: none;
    }
}