/**
 * FAQ Styles
 * @version 2.5.0
 */

/* BASE STYLES */
:root {
    --sqo-faq-spacing: 1rem;
    --sqo-faq-border-radius: 8px;
    --sqo-faq-transition: 0.3s ease;
}

.sqo-faq-wrapper {
    margin: 0; /* Padding läggs inline via shortcode: 60px 0 */
}

.sqo-faq-intro {
    margin-bottom: calc(var(--sqo-faq-spacing) * 1.5);
    line-height: 1.6;
}

/* FAQ Title - h2 som visas om title-parameter finns */
.sqo-faq-title {
    font-size: 3rem;
    font-weight: 800;
    margin: 0 0 2rem 0;
    text-align: center;
    color: #000;
}

.sqo-faq-theme-dark .sqo-faq-title {
    color: #fff;
}

.sqo-faq-theme-sqo .sqo-faq-title {
    max-width: var(--sqo-faq-width);
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.sqo-faq-items {
    display: flex;
    flex-direction: column;
    gap: var(--sqo-faq-spacing);
}

.sqo-faq-item {
    border-radius: var(--sqo-faq-border-radius);
    overflow: hidden;
}

.sqo-faq-question {
    width: 100%;
    padding: 1.25rem 1.5rem;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.4;
    transition: all var(--sqo-faq-transition);
}

.sqo-faq-question:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.2);
}

.sqo-faq-question-text {
    flex: 1;
}

.sqo-faq-icon {
    width: 12px;
    height: 12px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--sqo-faq-transition);
    flex-shrink: 0;
    opacity: 0.7;
}

.sqo-faq-item.is-open .sqo-faq-icon {
    transform: rotate(-135deg);
}

.sqo-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--sqo-faq-transition);
}

.sqo-faq-item.is-open .sqo-faq-answer {
    max-height: none;
}

.sqo-faq-answer-content {
    padding: 1.5rem;
    line-height: 1.7;
}

.sqo-faq-answer-content p:first-child {
    margin-top: 0;
}

.sqo-faq-answer-content p:last-child {
    margin-bottom: 0;
}

/* THEME: LIGHT */
.sqo-faq-theme-light .sqo-faq-item {
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.sqo-faq-theme-light .sqo-faq-question {
    background: #f9fafb;
    color: #1f2937;
}

.sqo-faq-theme-light .sqo-faq-question:hover {
    background: #f3f4f6;
}

.sqo-faq-theme-light .sqo-faq-answer-content {
    background: #ffffff;
    color: #4b5563;
}

/* THEME: DARK */
.sqo-faq-theme-dark .sqo-faq-item {
    border: 1px solid #1a1a1a;
    background: #000000;
}

.sqo-faq-theme-dark .sqo-faq-question {
    background: #1a1a1a;
    color: #ffffff;
}

.sqo-faq-theme-dark .sqo-faq-question:hover {
    background: #2a2a2a;
}

.sqo-faq-theme-dark .sqo-faq-answer-content {
    background: #000000;
    color: #e5e5e5;
}

/* THEME: SQO */

/* 
 * ÄNDRA BREDD HÄR:
 * Ändra --sqo-faq-width för att justera bredden på FAQ-listan
 * Exempel: 600px, 50%, 60%, 1000px etc.
 */
.sqo-faq-theme-sqo {
    --sqo-faq-width: 800px;
}

/* Lista centrerad med variabel bredd */
.sqo-faq-theme-sqo .sqo-faq-items {
    max-width: var(--sqo-faq-width);
    margin: 0 auto;
    gap: 0;
}

/* Wrapper: bryter ut till fullbredd */
.sqo-faq-theme-sqo .sqo-faq-item-wrapper {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background: transparent;
    transition: background 0.3s ease;
}

/* Aktiv = SVART */
.sqo-faq-theme-sqo .sqo-faq-item-wrapper.is-open {
    background: #000000;
}

/* Item: återgår till listans bredd */
.sqo-faq-theme-sqo .sqo-faq-item {
    max-width: var(--sqo-faq-width);
    margin: 0 auto;
    background: transparent;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid #e5e5e5;  /* Border på item istället */
}

.sqo-faq-theme-sqo .sqo-faq-item-wrapper:last-child .sqo-faq-item {
    border-bottom: none;
}

/* Fråga */
.sqo-faq-theme-sqo .sqo-faq-question {
    background: transparent;
    color: #000000;
    padding: 1.5rem 1.5rem 1.5rem 1rem;
}

/* INGEN hover-effekt */

/* Aktiv fråga = VIT text */
.sqo-faq-theme-sqo .sqo-faq-item-wrapper.is-open .sqo-faq-question {
    color: #ffffff;
}

/* INGEN hover-effekt när aktiv heller */

/* Q-ikon */
.sqo-faq-theme-sqo .sqo-faq-question::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    margin-right: 1rem;
    background-color: #000000;
    background-image: url('../images/q-logo-inverse.svg');
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
    transition: all 0.3s ease;
}

.sqo-faq-theme-sqo .sqo-faq-item-wrapper.is-open .sqo-faq-question::before {
    background-color: #ffffff;
    background-image: url('../images/q-logo.svg');
}

/* Chevron */
.sqo-faq-theme-sqo .sqo-faq-icon {
    opacity: 1;
    color: #000000;
}

.sqo-faq-theme-sqo .sqo-faq-item-wrapper.is-open .sqo-faq-icon {
    color: #ffffff;
}

/* Svar */
.sqo-faq-theme-sqo .sqo-faq-answer {
    background: transparent;
}

.sqo-faq-theme-sqo .sqo-faq-answer-content {
    background: transparent;
    color: #333333;
    padding: 1.5rem 1.5rem 1.5rem 4.5rem;
}

/* Aktiv svar = VIT text */
.sqo-faq-theme-sqo .sqo-faq-item-wrapper.is-open .sqo-faq-answer-content {
    color: #ffffff;
}

.sqo-faq-theme-sqo .sqo-faq-answer-content a {
    color: #000000;
}

.sqo-faq-theme-sqo .sqo-faq-item-wrapper.is-open .sqo-faq-answer-content a {
    color: #ffffff;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .sqo-faq-theme-sqo {
        --sqo-faq-width: 90%;
    }
}

@media (max-width: 768px) {
    .sqo-faq-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .sqo-faq-question {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
    
    .sqo-faq-answer-content {
        padding: 1.25rem;
    }
    
    .sqo-faq-theme-sqo {
        --sqo-faq-width: 95%;
    }
    
    .sqo-faq-theme-sqo .sqo-faq-question {
        padding: 1.25rem 1rem 1.25rem 0.75rem;
    }
    
    .sqo-faq-theme-sqo .sqo-faq-question::before {
        width: 40px;
        height: 40px;
        margin-right: 0.75rem;
    }
    
    .sqo-faq-theme-sqo .sqo-faq-answer-content {
        padding: 1.25rem 1rem 1.25rem 3.5rem;
    }
    
    /* Bättre focus för mobil */
    .sqo-faq-question:focus {
        box-shadow: inset 0 0 0 1px rgba(0,0,0,0.3);
    }
}

/* ERROR */
.sqo-faq-error,
.sqo-faq-empty {
    padding: 1rem 1.5rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
}

/* ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}