/**
 * WFAI Quiz Assessment - Public Styles
 * Version: 1.0.6
 * Fixes: Gleichmäßiger Spacing + Robustere Page Title Hiding
 */

/* ========================================
   SEITEN-CONTAINER FÜR QUIZ-SEITEN
   ======================================== */

/* Weißer Hintergrund für gesamte Content-Area */
body:has(.wfai-quiz-wrapper) main,
body:has(.wfai-quiz-wrapper) .wp-site-blocks {
    background: #ffffff !important;
    padding: 2rem 1rem !important;
    margin: 0 auto !important;
    max-width: 1400px !important;
}

/* Alle Elemente VOR dem Quiz schön zentrieren */
body:has(.wfai-quiz-wrapper) .wp-block-post-content > *:not(.wfai-quiz-wrapper) {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 2rem;
}

/* Headings schön zentrieren */
body:has(.wfai-quiz-wrapper) h1,
body:has(.wfai-quiz-wrapper) h2 {
    text-align: center;
    color: #1D1459;
    margin: 1rem auto;
}

/* Füge OBEN in der Datei hinzu: */
main:has(.wfai-quiz-wrapper) {
    padding: 0 !important;
}

/* ========================================
   HIDE PAGE TITLE & REDUCE TOP SPACING - FSE ROBUST
   ======================================== */

/* Hide page title - Multiple selectors for FSE themes */
.entry-content .wp-block-post-title,
body.page .wp-block-post-title,
.wp-site-blocks .wp-block-post-title {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ✅ SPEZIFISCH: Nur main die .wfai-quiz-wrapper ENTHÄLT */
main:has(.wfai-quiz-wrapper) {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* ✅ SPEZIFISCH: Nur direkte parent groups vom Quiz */

/* ========================================
   WRAPPER - KOMPAKT & OPTIMIERT
   ======================================== */

.wfai-quiz-wrapper {
    max-width: 1200px;
    width: 95%;
    margin: 0 auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(29, 20, 89, 0.08), 0 10px 20px rgba(29, 20, 89, 0.12);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

/* ✅ Spacer innerhalb Quiz verstecken */
.wfai-quiz-wrapper .wp-block-spacer {
    display: none !important;
}

@media (min-width: 1400px) {
    .wfai-quiz-wrapper {
        max-width: 1300px;
    }
}

/* ✅ SPEZIFISCH: Spacer NUR innerhalb vom Quiz-Container verstecken */
.wfai-quiz-wrapper .wp-block-spacer {
    display: none !important;
}

/* ========================================
   WRAPPER - GLEICHMÄSSIGER ABSTAND
   ======================================== */

.wfai-quiz-wrapper {
    max-width: 1100px;
    width: 100%;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(29, 20, 89, 0.08), 0 10px 20px rgba(29, 20, 89, 0.12);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

@media (min-width: 1400px) {
    .wfai-quiz-wrapper {
        max-width: 1200px;
    }
}

/* ========================================
   DSGVO NOTICE
   ======================================== */

.wfai-quiz-notice {
    background: #f8f9fa;
    border-left: 4px solid #1D1459;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2.5rem;
    border-radius: 6px;
}

.wfai-quiz-notice p {
    margin: 0;
    font-size: 0.95rem;
    color: #495057;
    line-height: 1.6;
}

/* ========================================
   LOADING STATE
   ======================================== */

.wfai-quiz-loading {
    text-align: center;
    padding: 3rem 0;
    color: #6c757d;
    font-size: 1rem;
}

/* ========================================
   QUIZ ANIMATION
   ======================================== */

.wfai-quiz-question {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   PROGRESS BAR
   ======================================== */

.wfai-quiz-progress {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    margin-bottom: 2.5rem;
    overflow: hidden;
}

.wfai-quiz-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1D1459 0%, #2D2479 100%);
    transition: width 0.4s ease;
    border-radius: 6px;
}

/* ========================================
   QUESTION DISPLAY
   ======================================== */

.wfai-quiz-question-number {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.wfai-quiz-question-text {
    font-size: 1.85rem;
    font-weight: 600;
    color: #1D1459;
    margin: 0 0 2.5rem 0;
    line-height: 1.3;
}

/* ========================================
   ANSWER OPTIONS
   ======================================== */

.wfai-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.wfai-quiz-option {
    display: flex;
    align-items: center;
    padding: 1.75rem 2.25rem;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 70px;
}

.wfai-quiz-option:hover {
    background: #e9ecef;
    border-color: #1D1459;
    transform: translateX(8px);
    box-shadow: 0 2px 8px rgba(29, 20, 89, 0.15);
}

.wfai-quiz-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.wfai-quiz-option input[type="radio"]:checked + .wfai-quiz-option-text {
    font-weight: 600;
}

.wfai-quiz-option input[type="radio"]:checked + .wfai-quiz-option-text::before {
    background: #1D1459;
    border-color: #1D1459;
}

.wfai-quiz-option input[type="radio"]:checked + .wfai-quiz-option-text::after {
    content: '';
    position: absolute;
    left: 11px;
    top: 7px;
    width: 8px;
    height: 14px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.wfai-quiz-option-text {
    flex: 1;
    font-size: 1.15rem;
    color: #495057;
    line-height: 1.6;
    padding-left: 2.75rem;
    position: relative;
}

.wfai-quiz-option-text::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    width: 26px;
    height: 26px;
    border: 2.5px solid #adb5bd;
    border-radius: 50%;
    background: white;
    transition: all 0.2s ease;
}

/* ========================================
   BUTTONS
   ======================================== */

.wfai-quiz-btn {
    display: block;
    width: 100%;
    padding: 1.5rem 3rem;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: #ffffff;
    background: #1D1459;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 8px rgba(29, 20, 89, 0.3);
    
    /* ✅ NEU: Text kann umbrechen */
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.5;
    min-height: 60px;
}

.wfai-quiz-btn:hover {
    background: #2D2479;
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(29, 20, 89, 0.4);
}

.wfai-quiz-btn:active {
    transform: translateY(0);
}

/* ========================================
   RESULT DISPLAY
   ======================================== */

.wfai-quiz-result-wrapper {
    animation: fadeIn 0.5s ease-in;
}

.wfai-quiz-score {
    text-align: center;
    padding: 1rem 0 3.5rem 0;  /* ← Nur 1rem oben, 3.5rem unten */
    border-bottom: 3px solid #e9ecef;
    margin-bottom: 3.5rem;
}

.wfai-quiz-score h2 {
    font-size: 2.25rem;
    font-weight: 600;
    color: #1D1459;
    margin: 0 0 1.5rem 0;
}

.wfai-quiz-score-number {
    font-size: 3.5rem;
    font-weight: 700;
    color: #1D1459;
}

.wfai-quiz-result-category {
    padding: 3rem;
    border-radius: 12px;
    margin-bottom: 3rem;
    border-left: 6px solid;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.wfai-quiz-result-category h3 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    word-wrap: break-word;
}

.wfai-quiz-result-category p {
    font-size: 1.2rem;
    line-height: 1.75;
    color: #495057;
    margin: 0;
    word-wrap: break-word;
}

/* ========================================
   RESULT CATEGORIES
   ======================================== */

.wfai-quiz-category-klassisch {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.wfai-quiz-category-klassisch h3 {
    color: #856404;
}

.wfai-quiz-category-uebergang {
    background: #d1ecf1;
    border-left-color: #17a2b8;
}

.wfai-quiz-category-uebergang h3 {
    color: #0c5460;
}

.wfai-quiz-category-ready {
    background: #d4edda;
    border-left-color: #28a745;
}

.wfai-quiz-category-ready h3 {
    color: #155724;
}

/* ========================================
   CTA SECTION
   ======================================== */

.wfai-quiz-cta {
    text-align: center;
    padding: 0.75rem 0 0 0;  /* ← Von 3rem auf 2rem reduziert */
}

.wfai-quiz-btn-primary {
    padding: 1.5rem 2rem;
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
    box-sizing: border-box;  /* ← WICHTIG! */
}

/* ========================================
   ERROR STATE
   ======================================== */

.wfai-quiz-error {
    padding: 3rem;
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    border-radius: 12px;
    color: #721c24;
    text-align: center;
    font-size: 1.15rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .wfai-quiz-btn-primary {
        padding: 0.875rem 1rem !important;
        font-size: 0.95rem !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 480px) {
    .wfai-quiz-btn-primary {
        padding: 0.75rem 0.875rem !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 1024px) {
    .wfai-quiz-wrapper {
        max-width: 95%;
        padding: 3rem 2.5rem;
        margin: 3rem auto; /* ✅ Weniger Margin auf Tablets */
    }
}

@media (max-width: 768px) {
    .wfai-quiz-wrapper {
        max-width: 95%;
        padding: 2.5rem 2rem;
        border-radius: 10px;
        margin: 2rem auto; /* ✅ Noch weniger auf Mobile */
    }
    
    .wfai-quiz-question-text {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .wfai-quiz-wrapper {
        max-width: 95%;
        padding: 2rem 1.5rem;
        border-radius: 8px;
        margin: 1.5rem auto; /* ✅ Minimal auf kleinen Screens */
    }
    
    .wfai-quiz-question-text {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .wfai-quiz-result-category {
        padding: 2rem 1.5rem;
    }
    
    .wfai-quiz-result-category h3 {
        font-size: 1.5rem;
    }
    
    .wfai-quiz-result-category p {
        font-size: 1rem;
    }
}
