/* ── CW Smart FAQ — Frontend ────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --sf-accent:        #6366f1;   /* overridden by theme-colors if CW FAQ Pro active */
    --sf-accent-light:  #eef2ff;
    --sf-accent-dark:   #4f46e5;
    --sf-text:          #0f172a;
    --sf-text-muted:    #64748b;
    --sf-border:        #e2e8f0;
    --sf-bg:            #ffffff;
    --sf-bg-subtle:     #f8fafc;
    --sf-radius-sm:     8px;
    --sf-radius:        12px;
    --sf-radius-lg:     16px;
    --sf-shadow:        0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --sf-shadow-md:     0 4px 16px rgba(99,102,241,.12);
    --sf-shadow-lg:     0 8px 32px rgba(99,102,241,.18);
    --sf-font:          'Plus Jakarta Sans', system-ui, sans-serif;
    --sf-transition:    .22s cubic-bezier(.4,0,.2,1);
}

/* ── Wrapper ─────────────────────────────────────────────── */
.cwsf-wrapper {
    font-family: var(--sf-font);
    color: var(--sf-text);
    max-width: 800px;
    margin-inline: auto;
}
.cwsf-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--sf-text);
    margin: 0 0 24px;
    letter-spacing: -.02em;
}
.cwsf-notice {
    background: var(--sf-bg-subtle);
    border: 1px solid var(--sf-border);
    border-radius: var(--sf-radius);
    padding: 14px 18px;
    font-size: 14px;
    color: var(--sf-text-muted);
}
.cwsf-notice--info  { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.cwsf-notice--error { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }

/* ── Search bar ──────────────────────────────────────────── */
.cwsf-search-wrap   { margin-bottom: 28px; }
.cwsf-search-inner  {
    position: relative;
    display: flex;
    align-items: center;
}
.cwsf-search-icon {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    color: var(--sf-text-muted);
    pointer-events: none;
    stroke: currentColor;
    flex-shrink: 0;
}
.cwsf-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 48px 14px 46px;
    background: var(--sf-bg);
    border: 2px solid var(--sf-border);
    border-radius: 50px;
    font-family: var(--sf-font);
    font-size: 15px;
    font-weight: 500;
    color: var(--sf-text);
    transition: border-color var(--sf-transition), box-shadow var(--sf-transition);
    outline: none;
    appearance: none;
}
.cwsf-search-input::placeholder { color: var(--sf-text-muted); font-weight: 400; }
.cwsf-search-input:focus {
    border-color: var(--sf-accent);
    box-shadow: 0 0 0 4px var(--sf-accent-light);
}
/* Spinner */
.cwsf-search-spinner {
    position: absolute;
    right: 18px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--sf-accent-light);
    border-top-color: var(--sf-accent);
    border-radius: 50%;
    animation: cwsfSpin .6s linear infinite;
    display: none;
}
.cwsf-search-spinner.cwsf--visible { display: block; }
@keyframes cwsfSpin { to { transform: rotate(360deg); } }

/* ── Search result panel ─────────────────────────────────── */
.cwsf-search-result {
    margin-top: 12px;
    border-radius: var(--sf-radius);
    overflow: hidden;
    animation: cwsfSlideIn .2s ease;
}
.cwsf-search-result[hidden] {
    display: none !important;
}
@keyframes cwsfSlideIn { from { opacity:0; transform:translateY(-6px) } to { opacity:1; transform:none } }

.cwsf-search-result__match {
    background: linear-gradient(135deg, var(--sf-accent) 0%, var(--sf-accent-dark) 100%);
    color: #fff;
    padding: 20px 22px;
    position: relative;
}
.cwsf-search-result__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .7;
    margin-bottom: 6px;
}
.cwsf-search-result__q {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}
.cwsf-search-result__a {
    font-size: 14px;
    line-height: 1.65;
    opacity: .92;
}
.cwsf-search-result__badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: rgba(255,255,255,.2);
    padding: 2px 7px;
    border-radius: 50px;
}
.cwsf-search-result__no-match {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--sf-text-muted);
    background: var(--sf-bg-subtle);
    border: 1px solid var(--sf-border);
    border-radius: var(--sf-radius);
}
.cwsf-search-result__close {
    position: absolute;
    top: 10px;
    right: 44px;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--sf-transition);
}
.cwsf-search-result__close:hover { background: rgba(255,255,255,.3); }

/* ── Accordion ───────────────────────────────────────────── */
.cwsf-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cwsf-item {
    background: var(--sf-bg);
    border: 1.5px solid var(--sf-border);
    border-radius: var(--sf-radius);
    box-shadow: var(--sf-shadow);
    overflow: hidden;
    transition: border-color var(--sf-transition), box-shadow var(--sf-transition), transform var(--sf-transition);
}
.cwsf-item:hover {
    border-color: #c7d2fe;
    box-shadow: var(--sf-shadow-md);
}
.cwsf-item--open {
    border-color: var(--sf-accent);
    box-shadow: var(--sf-shadow-md);
}
.cwsf-item--hidden { display: none !important; }
.cwsf-item--highlight {
    border-color: var(--sf-accent) !important;
    box-shadow: 0 0 0 3px var(--sf-accent-light) !important;
    animation: cwsfPulse .5s ease;
}
@keyframes cwsfPulse {
    0%   { box-shadow: 0 0 0 0 var(--sf-accent-light) }
    70%  { box-shadow: 0 0 0 8px transparent }
    100% { box-shadow: var(--sf-shadow-md) }
}

/* ── Question button ─────────────────────────────────────── */
.cwsf-question {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--sf-font);
    color: inherit;
}
.cwsf-question:focus-visible {
    outline: 2px solid var(--sf-accent);
    outline-offset: -2px;
    border-radius: calc(var(--sf-radius) - 2px);
}
.cwsf-q-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--sf-bg-subtle);
    border: 1.5px solid var(--sf-border);
    font-size: 11px;
    font-weight: 700;
    color: var(--sf-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--sf-transition);
}
.cwsf-item--open .cwsf-q-num {
    background: var(--sf-accent);
    border-color: var(--sf-accent);
    color: #fff;
}
.cwsf-q-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--sf-text);
    line-height: 1.4;
    flex: 1;
    transition: color var(--sf-transition);
}
.cwsf-item--open .cwsf-q-text { color: var(--sf-accent); }
.cwsf-chevron {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--sf-text-muted);
    transition: transform var(--sf-transition), color var(--sf-transition);
}
.cwsf-chevron svg { width: 18px; height: 18px; }
.cwsf-item--open .cwsf-chevron {
    transform: rotate(180deg);
    color: var(--sf-accent);
}

/* ── Answer panel ────────────────────────────────────────── */
.cwsf-answer {
    display: block !important;
    visibility: visible !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height .32s cubic-bezier(.4,0,.2,1);
}
.cwsf-item--open .cwsf-answer { max-height: 3000px; }

.cwsf-answer__body {
    padding: 0 20px 20px 60px;   /* left-aligned with question text past the number */
    border-top: 1px solid var(--sf-border);
}
.cwsf-answer__body p:first-child { margin-top: 14px; }
.cwsf-answer__body p:last-child  { margin-bottom: 0; }
.cwsf-answer__body p {
    font-size: 14.5px;
    line-height: 1.7;
    color: #334155;
}
.cwsf-answer__body a { color: var(--sf-accent); }

/* ── Footer ──────────────────────────────────────────────── */
.cwsf-footer {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}
.cwsf-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--sf-text-muted);
    background: var(--sf-bg-subtle);
    border: 1px solid var(--sf-border);
    padding: 4px 10px;
    border-radius: 50px;
}
.cwsf-badge svg { width: 12px; height: 12px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .cwsf-q-text        { font-size: 14px; }
    .cwsf-answer__body  { padding-left: 20px; }
    .cwsf-search-input  { font-size: 14px; padding: 12px 44px 12px 42px; }
}

/* ── Admin CSS (also loaded here for quick reference) ──────
   Real admin CSS is in assets/css/admin.css               */
