/* ==========================================================================
   KE FAQ Widget (ke-faq) — v0.18.0
   BEM: .ke-faq / .ke-faq__items / .ke-faq-item / .ke-faq-question / .ke-faq-answer
   ========================================================================== */

/* --------------------------------------------------------------------------
   FAQ Wrapper
   -------------------------------------------------------------------------- */

.ke-faq {
    position: relative;
}

.ke-faq__items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --------------------------------------------------------------------------
   FAQ Item
   -------------------------------------------------------------------------- */

.ke-faq-item {
    background-color: var(--ke-surface, #fff);
    border: 1px solid var(--ke-border, #e5e7eb);
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.ke-faq-item:focus-within {
    box-shadow: 0 0 0 2px rgba(var(--ke-primary-rgb, 59, 130, 246), 0.3);
}

/* --------------------------------------------------------------------------
   FAQ Question Button
   -------------------------------------------------------------------------- */

.ke-faq-question {
    /* Button-Reset */
    all: unset;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 16px 20px;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
    line-height: 1.4;
    color: var(--ke-text, #111827);
    background-color: transparent;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.ke-faq-question:hover {
    color: var(--ke-primary, #3b82f6);
}

.ke-faq-question:focus-visible {
    outline: 2px solid var(--ke-primary, #3b82f6);
    outline-offset: -2px;
}

/* Static variant for grid layout (not a real button) */
.ke-faq-question--static {
    cursor: default;
}

.ke-faq-question--static:hover {
    color: inherit;
}

.ke-faq-question__text {
    flex: 1;
}

/* --------------------------------------------------------------------------
   FAQ Question Icon
   -------------------------------------------------------------------------- */

.ke-faq-question__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--ke-text-muted, #6b7280);
    transition: transform 0.3s ease, color 0.2s ease;
}

.ke-faq-question__icon svg {
    width: 100%;
    height: 100%;
}

/* Chevron: rotiert 180° wenn aktiv */
.ke-faq--icon-chevron .ke-faq-item--active .ke-faq-question__icon {
    transform: rotate(180deg);
}

/* Plus-Minus: Plus rotiert auf 45° → wird zum X / Minus-Effekt */
.ke-faq--icon-plus-minus .ke-faq-item--active .ke-faq-question__icon .ke-faq-icon--plus {
    transform: rotate(45deg);
}

/* Active state: Icon-Farbe */
.ke-faq-item--active .ke-faq-question {
    color: var(--ke-primary, #3b82f6);
}

.ke-faq-item--active .ke-faq-question__icon {
    color: var(--ke-primary, #3b82f6);
}

/* --------------------------------------------------------------------------
   FAQ Answer — Collapse/Expand
   -------------------------------------------------------------------------- */

.ke-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    background-color: transparent;
}

/* Geöffnet (via JS oder initial active) */
.ke-faq-answer--visible,
.ke-faq-item--active .ke-faq-answer {
    max-height: 2000px; /* Ausreichend groß für langen Content */
}

/* Setzt hidden-Attribut außer Kraft wenn JS noch nicht geladen ist */
.ke-faq-answer[hidden] {
    display: block; /* CSS übernimmt Sichtbarkeit via max-height */
    max-height: 0;
}

.ke-faq-answer__content {
    padding: 0 20px 20px;
    line-height: 1.65;
    color: var(--ke-text, #374151);
}

.ke-faq-answer__content > *:first-child {
    margin-top: 0;
}

.ke-faq-answer__content > *:last-child {
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Grid Layout
   -------------------------------------------------------------------------- */

.ke-faq--layout-grid .ke-faq__items {
    display: grid;
    grid-template-columns: repeat(var(--ke-faq-grid-columns, 2), 1fr);
    column-gap: 24px;
    row-gap: 24px;
}

/* Im Grid: Antwort immer sichtbar, kein Collapse */
.ke-faq--layout-grid .ke-faq-answer {
    max-height: none;
    overflow: visible;
}

/* Im Grid: Antwort-Padding direkt (keine separate question-Trennung nötig) */
.ke-faq--layout-grid .ke-faq-answer__content {
    padding-top: 8px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
    .ke-faq--layout-grid .ke-faq__items {
        grid-template-columns: 1fr;
    }
}

