/*
 * Engincakar FAQ Frontend Styles
 * v1.3 — Container constraint added for page-builder layouts where
 *        the_content auto-append renders FAQ outside the page wrapper.
 */

/* ------------------------------------------------------------------ */
/* Section + Title                                                    */
/* ------------------------------------------------------------------ */

.ec-faq-section {
    max-width: 1200px;
    margin: 2.5em auto;
    box-sizing: border-box;
}

.ec-faq-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 1em;
    padding: 0;
    color: #1a1a1a;
    line-height: 1.3;
}

/* ------------------------------------------------------------------ */
/* List + Cards                                                        */
/* ------------------------------------------------------------------ */

.ec-faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ec-faq-entry {
    background: #fff;
    border: 1px solid #e7e7e9;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ec-faq-entry:hover {
    border-color: #d4d4d6;
}

/* ------------------------------------------------------------------ */
/* Question (button)                                                   */
/* ------------------------------------------------------------------ */

.ec-faq-question {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 1.15em 3.2em 1.15em 1.35em;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    cursor: pointer;
    position: relative;
    color: #1a1a1a;
    font-family: inherit;
    transition: color 0.2s ease, background 0.2s ease;
}

.ec-faq-question:hover {
    color: #E65C00;
}

.ec-faq-question[aria-expanded="true"] {
    color: #E65C00;
    background: #fef8f3;
}

.ec-faq-question:focus-visible {
    outline: 2px solid #E65C00;
    outline-offset: -2px;
}

/* Span icon from PHP — hidden, pseudo-element handles the visual */
.ec-faq-icon {
    display: none;
}

/* Accordion Icon as a circular badge */
.ec-faq-question::after {
    content: '+';
    position: absolute;
    right: 1em;
    top: 50%;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(230, 92, 0, 0.1);
    color: #E65C00;
    font-size: 1.3rem;
    line-height: 26px;
    text-align: center;
    font-weight: 400;
    transform: translateY(-50%);
    transition: transform 0.3s ease, background 0.2s ease, color 0.2s ease;
}

.ec-faq-question[aria-expanded="true"]::after {
    transform: translateY(-50%) rotate(45deg);
    background: #E65C00;
    color: #fff;
}

/* ------------------------------------------------------------------ */
/* Answer (accordion content)                                          */
/* ------------------------------------------------------------------ */

.ec-faq-answer {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease-out;
}

/* Override the [hidden] attribute if PHP outputs it */
.ec-faq-answer[hidden] {
    display: block;
}

.ec-faq-question[aria-expanded="true"] + .ec-faq-answer {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
}

.ec-faq-answer-body {
    padding: 0 1.5em 1.4em 1.5em;
    line-height: 1.65;
    color: #444;
    border-top: 1px solid #f0f0f0;
    padding-top: 1.1em;
    margin-top: 0;
}

/* Paragraphs */
.ec-faq-answer-body p {
    margin: 0 0 0.9em 0;
    line-height: 1.65;
}

.ec-faq-answer-body p:last-child {
    margin-bottom: 0;
}

/* Lists */
.ec-faq-answer-body ul,
.ec-faq-answer-body ol {
    margin: 0.6em 0 1em 0;
    padding-left: 1.4em;
}

.ec-faq-answer-body ul {
    list-style: none;
    padding-left: 0;
}

.ec-faq-answer-body ul li {
    position: relative;
    padding-left: 1.4em;
    margin-bottom: 0.55em;
    line-height: 1.6;
}

.ec-faq-answer-body ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #E65C00;
}

.ec-faq-answer-body ol li {
    margin-bottom: 0.55em;
    line-height: 1.6;
    padding-left: 0.3em;
}

.ec-faq-answer-body ul li:last-child,
.ec-faq-answer-body ol li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.ec-faq-answer-body ul ul,
.ec-faq-answer-body ol ol,
.ec-faq-answer-body ul ol,
.ec-faq-answer-body ol ul {
    margin: 0.4em 0;
}

/* Emphasis */
.ec-faq-answer-body strong,
.ec-faq-answer-body b {
    font-weight: 700;
    color: #1a1a1a;
}

.ec-faq-answer-body em,
.ec-faq-answer-body i {
    font-style: italic;
}

/* Links */
.ec-faq-answer-body a {
    color: #E65C00;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.ec-faq-answer-body a:hover {
    color: #b34700;
}

/* ------------------------------------------------------------------ */
/* RTL (Arabic) support                                                */
/* ------------------------------------------------------------------ */

.ec-faq-section[dir="rtl"] .ec-faq-question {
    text-align: right;
    padding: 1.15em 1.35em 1.15em 3.2em;
}

.ec-faq-section[dir="rtl"] .ec-faq-question::after {
    right: auto;
    left: 1em;
}

.ec-faq-section[dir="rtl"] .ec-faq-answer-body ul,
.ec-faq-section[dir="rtl"] .ec-faq-answer-body ol {
    padding-left: 0;
    padding-right: 1.4em;
}

.ec-faq-section[dir="rtl"] .ec-faq-answer-body ul {
    padding-right: 0;
}

.ec-faq-section[dir="rtl"] .ec-faq-answer-body ul li {
    padding-left: 0;
    padding-right: 1.4em;
}

.ec-faq-section[dir="rtl"] .ec-faq-answer-body ul li::before {
    left: auto;
    right: 0;
}

/* ------------------------------------------------------------------ */
/* Mobile                                                              */
/* ------------------------------------------------------------------ */

@media (max-width: 640px) {
    .ec-faq-title {
        font-size: 1.5rem;
    }
    .ec-faq-question {
        padding: 1em 2.8em 1em 1.1em;
        font-size: 1rem;
    }
    .ec-faq-question::after {
        right: 0.7em;
        width: 26px;
        height: 26px;
        line-height: 24px;
        font-size: 1.2rem;
    }
    .ec-faq-answer-body {
        padding: 1em 1.1em 1.2em 1.1em;
    }
}
