/* Skills Plus FAQ Addon — Frontend Styles */

.spfaq { width: 100%; }
.spfaq * { box-sizing: border-box; }

/* ITEM */
.spfaq-item {
    overflow: hidden;
    transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}

/* QUESTION BUTTON */
.spfaq-question {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: color .2s ease;
}
.spfaq-question:focus { outline: 2px solid currentColor; outline-offset: 2px; }
.spfaq-question:focus:not(:focus-visible) { outline: none; }

.spfaq-question-text {
    flex: 1;
    transition: color .2s ease;
}

/* NUMBER */
.spfaq-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color .25s ease, color .25s ease, border-color .25s ease;
    font-variant-numeric: tabular-nums;
}
.spfaq-num-style-circle .spfaq-number { border-radius: 50%; }
.spfaq-num-style-square .spfaq-number { border-radius: 8px; }
.spfaq-num-style-plain .spfaq-number  { background: transparent !important; }
.spfaq-num-style-outline .spfaq-number {
    background: transparent !important;
    border-style: solid !important;
    border-width: 1.5px !important;
    border-radius: 50%;
}

/* ARROW */
.spfaq-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color .25s ease, color .25s ease, transform .35s cubic-bezier(.16,1,.3,1);
    position: relative;
}
.spfaq-arrow svg { display: block; }
.spfaq-arrow-open, .spfaq-arrow-close {
    display: flex; align-items: center; justify-content: center;
    transition: opacity .25s ease;
}
.spfaq-arrow-close {
    position: absolute; inset: 0;
    opacity: 0;
}

/* ARROW ANIMATIONS */
.spfaq-arrow-anim-rotate .spfaq-active .spfaq-arrow { transform: rotate(180deg); }
.spfaq-arrow-anim-rotate90 .spfaq-active .spfaq-arrow { transform: rotate(90deg); }
.spfaq-arrow-anim-fade .spfaq-active .spfaq-arrow .spfaq-arrow-open { opacity: 0; }
.spfaq-arrow-anim-fade .spfaq-active .spfaq-arrow .spfaq-arrow-close { opacity: 1; }
.spfaq-arrow-anim-none .spfaq-active .spfaq-arrow { transform: none; }

/* ANSWER */
.spfaq-answer {
    overflow: hidden;
    max-height: 0;
    transition: max-height .35s cubic-bezier(.16,1,.3,1);
}
.spfaq-active .spfaq-answer {
    /* Inline max-height set by JS for accurate animation */
}
.spfaq-divider { height: 1px; width: 100%; }
.spfaq-answer-inner > *:first-child { margin-top: 0; }
.spfaq-answer-inner > *:last-child { margin-bottom: 0; }
.spfaq-answer-inner p { margin: 0 0 12px; }
.spfaq-answer-inner p:last-child { margin-bottom: 0; }
.spfaq-answer-inner ul, .spfaq-answer-inner ol { margin: 0 0 12px 20px; }
.spfaq-answer-inner a { text-decoration: underline; }

/* RIGHT BADGE */
.spfaq-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 50px;
    margin-left: auto;
    transition: background-color .25s ease, color .25s ease;
}
.spfaq-badge-default { color: #64748B; background: transparent; }
.spfaq-badge-cyan    { color: #0369a1; background: #e0f2fe; }
.spfaq-badge-green   { color: #166534; background: #dcfce7; }
.spfaq-badge-gold    { color: #854d0e; background: #fef3c7; }
.spfaq-badge-red     { color: #991b1b; background: #fee2e2; }

/* MODULES LAYOUT (matches Course Modules screenshot) */
.spfaq-layout-modules .spfaq-item {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
}
.spfaq-layout-modules .spfaq-item.spfaq-active {
    background: #f0f9ff;
    border-color: #7dd3fc;
}
.spfaq-layout-modules .spfaq-question { padding: 18px 24px; }
.spfaq-layout-modules .spfaq-number {
    width: 36px; height: 36px; background: #ffffff; color: #475569;
    border: 1px solid #e5e7eb; font-size: 12px; font-weight: 700;
}
.spfaq-layout-modules .spfaq-active .spfaq-number { background: #0EA5E9; color: #fff; border-color: #0EA5E9; }
.spfaq-layout-modules .spfaq-arrow {
    width: 32px; height: 32px; background: transparent; color: #475569;
}

/* LAYOUT VARIANTS */
.spfaq-layout-minimal .spfaq-item {
    background: transparent !important;
    border-width: 0 0 1px 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.spfaq-layout-minimal .spfaq-item + .spfaq-item { margin-top: 0 !important; }

.spfaq-layout-separated .spfaq-item + .spfaq-item { margin-top: 16px; }

.spfaq-layout-filled .spfaq-item { border-color: transparent !important; }
.spfaq-layout-filled .spfaq-item:not(.spfaq-active) { background-color: #F8FAFC; }

/* RTL */
[dir="rtl"] .spfaq-number { margin-right: 0; margin-left: 14px; }
[dir="rtl"] .spfaq-arrow { margin-left: 0; margin-right: 14px; }
[dir="rtl"] .spfaq-question-text { text-align: right; }
[dir="rtl"] .spfaq-arrow-anim-rotate90 .spfaq-active .spfaq-arrow { transform: rotate(-90deg); }

/* ─── Elementor Loop Grid — Auto Numbering ──────────────────────────────── */
/* Resets counter on each Loop Grid that contains an SP FAQ widget           */
.elementor-widget-loop-grid:has(.spfaq) {
    counter-reset: spfaq-loop-counter;
}
/* Increments once per loop item */
.elementor-widget-loop-grid:has(.spfaq) .e-loop-item {
    counter-increment: spfaq-loop-counter;
}
/* Number badge — injected before the question text */
.elementor-widget-loop-grid .e-loop-item .spfaq-question::before {
    content: counter(spfaq-loop-counter, decimal-leading-zero);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    background: #F1F5F9;
    color: #27292C;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    margin-right: 15px;
    flex-shrink: 0;
    transition: background 0.3s ease, color 0.3s ease;
}
/* Active (open) state — badge changes colour */
.elementor-widget-loop-grid .e-loop-item .spfaq-active .spfaq-question::before {
    background: #57BBD0;
    color: #ffffff;
}
