/* =============================================================================
   Divi FAQ Module – Frontend Styles
   ============================================================================= */

/* ── Module wrapper ─────────────────────────────────────────────────────────── */
.dfaq-module {
    width: 100%;
    margin-bottom: 1.5em;
}

.dfaq-module__title {
    margin-top: 0;
    margin-bottom: .75em;
}

/* ── List ───────────────────────────────────────────────────────────────────── */
.dfaq-module__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ── Item wrapper ───────────────────────────────────────────────────────────── */
.dfaq-item {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color .2s ease;
}

.dfaq-item:last-child {
    margin-bottom: 0;
}

/* ── Question / Header ──────────────────────────────────────────────────────── */
.dfaq-item__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background-color: #f4f4f4;
    color: #333;
    cursor: pointer;
    user-select: none;
    transition: background-color .2s ease, color .2s ease;
    margin: 0;
    font-weight: 600;
    line-height: 1.4;
}

.dfaq-item__header:hover {
    background-color: #e8e8e8;
}

.dfaq-item__header:focus {
    outline: 3px solid #2ea3f2;
    outline-offset: -3px;
}

.dfaq-item__title {
    flex: 1;
    padding-right: 12px;
}

/* ── Icon ───────────────────────────────────────────────────────────────────── */
.dfaq-item__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    transition: transform .25s ease;
}

.dfaq-item__icon svg {
    display: block;
    transition: transform .25s ease;
}

/* ── Open state ─────────────────────────────────────────────────────────────── */
.dfaq-item--open > .dfaq-item__header {
    background-color: #2ea3f2;
    color: #fff;
}

.dfaq-item--open > .dfaq-item__header:hover {
    background-color: #1a8fd1;
}

.dfaq-item--open .dfaq-item__icon svg {
    transform: rotate(180deg);
}

/* ── Answer / Body ──────────────────────────────────────────────────────────── */
.dfaq-item__body {
    display: block;
    overflow: hidden;
    background-color: #fff;
    margin: 0;
    /* max-height animation handled by JS */
    max-height: 0;
    transition: max-height .35s ease;
}

.dfaq-item__body:not([hidden]) {
    max-height: 2000px; /* large enough for any content */
}

.dfaq-item__body[hidden] {
    display: none !important; /* initial no-JS hide */
}

.dfaq-item__content {
    padding: 16px 18px;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.dfaq-item__content p:first-child { margin-top: 0; }
.dfaq-item__content p:last-child  { margin-bottom: 0; }

/* ── Animation – JS-driven smooth expand ────────────────────────────────────── */
.dfaq-item__body.dfaq-animating {
    display: block !important;
    overflow: hidden;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media ( max-width: 768px ) {
    .dfaq-item__header {
        padding: 12px 14px;
    }
    .dfaq-item__content {
        padding: 14px;
    }
}

/* ── Reduced-motion preference ───────────────────────────────────────────────── */
@media ( prefers-reduced-motion: reduce ) {
    .dfaq-item__body,
    .dfaq-item__icon svg {
        transition: none;
    }
}
