/* FAQ editor + hydration UI. Loaded as a separate stylesheet so the
   base site CSS stays lean when we ship a build later. */

.el-faq-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--el-text-muted);
    font-weight: 500;
}
.el-faq-loading i { color: var(--el-accent); font-size: 1.4rem; }

/* Editor modal shell. Hidden by default; is-open swaps in flex + fade. */
.fq-editor {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.fq-editor.is-open { display: flex; }
body.fq-editor-open { overflow: hidden; }
/* Fullscreen — operator ask. Zero-padding on the outer to let the
   modal touch every edge; keep border-radius=0 so it reads as a real
   full-screen surface, not a rounded card. */
.fq-editor { padding: 0; }

.fq-modal {
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    color: #0f172a;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
html.night-mode .fq-modal { background: #101a30; color: #e6ebf5; }

.fq-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
html.night-mode .fq-modal-head { border-bottom-color: rgba(255,255,255,0.1); }
.fq-modal-head h2 {
    margin: 0;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--el-accent);
}

.fq-modal-body {
    flex: 1;
    display: grid;
    /* CSS var --fq-sec-w drives the sections-rail width (default 320px).
       JS updates it via a mousedown resize handler + persists to
       localStorage so the operator's preferred split survives a reload.
       The 6px middle track is the drag grip. */
    grid-template-columns: var(--fq-sec-w, 320px) 6px 1fr;
    gap: 0;
    overflow: hidden;
}
.fq-modal-body:has(.fq-drawer) { grid-template-columns: var(--fq-sec-w, 300px) 6px 1fr 400px; }

/* Search bar — sits between the modal head + body. Sticky-visible while
   scrolling either pane so the operator never loses their query. */
.fq-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
    flex: 0 0 auto;
}
html.night-mode .fq-search-bar {
    border-bottom-color: rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
}
.fq-search-bar > .mdi {
    color: var(--el-text-muted);
    font-size: 1.1rem;
    flex: 0 0 auto;
}
.fq-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--el-text);
    font-size: 0.95rem;
    padding: 6px 4px;
    outline: none;
    font-family: inherit;
}
.fq-search-input::placeholder { color: var(--el-text-muted); opacity: 0.7; }
.fq-search-input::-webkit-search-cancel-button { display: none; } /* we render our own clear */
.fq-search-count {
    flex: 0 0 auto;
    padding: 2px 10px;
    background: rgba(var(--club-accent-rgb), 0.12);
    color: var(--el-accent);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.fq-search-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--el-text-muted);
    font-size: 0.9rem;
}
.fq-search-empty .mdi {
    display: block;
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.6;
}
.fq-sec-count-match {
    background: rgba(var(--club-accent-rgb), 0.16);
    color: var(--el-accent);
}

/* Drag-grip resizer — sits between sections + items panes. Vertical on
   desktop (wide), horizontal on mobile-stacked (narrow — see media
   query at the bottom of this file). Shows a subtle 3-dot pattern so
   the operator sees it's draggable. */
.fq-resizer {
    background: rgba(0, 0, 0, 0.05);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    cursor: col-resize;
    position: relative;
    user-select: none;
    touch-action: none; /* let the resize handler own pointer events on touch */
    transition: background 0.15s;
    z-index: 2;
}
html.night-mode .fq-resizer {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}
.fq-resizer::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 2px;
    box-shadow:
        3px 0 0 0 rgba(0, 0, 0, 0.15),
        -3px 0 0 0 rgba(0, 0, 0, 0.15);
    transition: background 0.15s, box-shadow 0.15s;
}
html.night-mode .fq-resizer::before {
    background: rgba(255, 255, 255, 0.3);
    box-shadow:
        3px 0 0 0 rgba(255, 255, 255, 0.18),
        -3px 0 0 0 rgba(255, 255, 255, 0.18);
}
.fq-resizer:hover,
.fq-resizer.is-dragging {
    background: rgba(var(--club-accent-rgb), 0.12);
}
.fq-resizer:hover::before,
.fq-resizer.is-dragging::before {
    background: var(--el-accent);
    box-shadow:
        3px 0 0 0 var(--el-accent),
        -3px 0 0 0 var(--el-accent);
}
body.fq-resizing, body.fq-resizing * { cursor: col-resize !important; user-select: none !important; }
body.fq-resizing-v, body.fq-resizing-v * { cursor: row-resize !important; user-select: none !important; }

/* Sections rail */
.fq-sec-rail {
    background: rgba(0, 0, 0, 0.03);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
html.night-mode .fq-sec-rail {
    background: rgba(255, 255, 255, 0.02);
    border-right-color: rgba(255,255,255,0.1);
}
.fq-rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--el-text-muted);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
html.night-mode .fq-rail-head { border-bottom-color: rgba(255,255,255,0.08); }
.fq-sec-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}
.fq-sec-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 4px;
    transition: background 100ms;
}
.fq-sec-row:hover { background: rgba(0, 0, 0, 0.04); }
html.night-mode .fq-sec-row:hover { background: rgba(255,255,255,0.05); }
.fq-sec-row.is-active { background: rgba(2, 12, 146, 0.1); }
html.night-mode .fq-sec-row.is-active { background: rgba(120, 165, 255, 0.15); }
.fq-sec-row.fq-dim { opacity: 0.5; }
.fq-sec-row.fq-dragging { opacity: 0.4; }
.fq-sec-row.fq-drop-target {
    outline: 2px dashed var(--el-accent);
    outline-offset: 1px;
    background: rgba(2, 12, 146, 0.06);
}
.fq-sec-icon { color: var(--el-accent); font-size: 1.1rem; }
.fq-sec-title { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fq-sec-count {
    background: rgba(0, 0, 0, 0.06);
    color: var(--el-text-muted);
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
html.night-mode .fq-sec-count { background: rgba(255,255,255,0.08); }
.fq-drag-handle { color: rgba(0, 0, 0, 0.3); cursor: grab; font-size: 1rem; }
html.night-mode .fq-drag-handle { color: rgba(255,255,255,0.3); }

/* Items pane */
.fq-items-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.fq-pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
html.night-mode .fq-pane-head { border-bottom-color: rgba(255,255,255,0.08); }
.fq-pane-head h3 { margin: 0; font-size: 1.05rem; color: var(--el-text); }
html.night-mode .fq-pane-head h3 { color: #e6ebf5; }
.fq-pane-sub { font-size: 0.78rem; color: var(--el-text-muted); }
.fq-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 16px;
}
.fq-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color 100ms;
}
html.night-mode .fq-item-row {
    background: rgba(255,255,255,0.02);
    border-color: rgba(255,255,255,0.1);
}
.fq-item-row:hover { border-color: var(--el-accent); }
.fq-item-row.fq-dragging { opacity: 0.4; }
.fq-item-icon { color: var(--el-accent); font-size: 1.1rem; flex-shrink: 0; }
.fq-item-q { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fq-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.78rem;
    color: var(--el-text-muted);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
html.night-mode .fq-hint { border-top-color: rgba(255,255,255,0.08); }
.fq-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--el-text-muted);
    text-align: center;
    padding: 60px 20px;
}
.fq-empty-hint {
    padding: 24px;
    text-align: center;
    color: var(--el-text-muted);
    font-size: 0.88rem;
}
.fq-drop-zone-active {
    outline: 2px dashed var(--el-accent);
    outline-offset: -8px;
    background: rgba(2, 12, 146, 0.03);
}

/* Item drawer */
.fq-drawer {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.02);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    min-height: 0;
}
html.night-mode .fq-drawer {
    background: rgba(255,255,255,0.02);
    border-left-color: rgba(255,255,255,0.1);
}
.fq-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-weight: 600;
}
html.night-mode .fq-drawer-head { border-bottom-color: rgba(255,255,255,0.08); }
.fq-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.fq-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.fq-field > span:first-child {
    font-size: 0.82rem;
    color: var(--el-text-muted);
    font-weight: 600;
}
.fq-field input, .fq-field textarea {
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    font: inherit;
    font-size: 0.92rem;
    color: inherit;
    background: #fff;
}
html.night-mode .fq-field input,
html.night-mode .fq-field textarea {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.fq-field textarea {
    resize: vertical;
    min-height: 160px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}
.fq-field input:focus, .fq-field textarea:focus {
    outline: 2px solid var(--el-accent);
    outline-offset: -1px;
    border-color: transparent;
}
.fq-hint-inline {
    font-size: 0.75rem;
    color: var(--el-text-muted);
    line-height: 1.5;
}
.fq-hint-inline code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.85em;
}
html.night-mode .fq-hint-inline code { background: rgba(255,255,255,0.08); }
/* ── Per-item refine pill ──────────────────────────────────────────
   Rendered inside each .el-accordion-body when the visitor is
   super_admin. Sits bottom-right of the answer card. Click opens the
   lightweight refine modal (see .fq-refine-* below) — bypasses the
   full FAQ editor. */
.el-faq-refine {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    background: rgba(var(--club-accent-rgb), 0.1);
    color: var(--el-accent);
    border: 1px dashed var(--el-accent);
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    font-size: 1rem;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    opacity: 0.55;
}
.el-faq-refine:hover {
    background: var(--el-accent);
    color: var(--el-hero, #001a4d);
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 6px 18px rgba(var(--club-accent-rgb), 0.35);
    opacity: 1;
    border-style: solid;
}
/* Accordion body needs position:relative so the pill's absolute
   positioning anchors to it. */
.el-accordion-body { position: relative; }
html.night-mode .el-faq-refine {
    background: rgba(94, 176, 255, 0.14);
    color: var(--el-accent);
    border-color: var(--el-accent);
}
html.night-mode .el-faq-refine:hover {
    background: var(--el-accent);
    color: #050505;
}

/* ── Refine modal ──────────────────────────────────────────────────
   Compact centered modal. Backdrop click closes. Shows current answer
   HTML (raw — token-preserving), an AI instruction input, and either
   a Refine button OR an AI-preview block with Accept / Discard. */
.fq-refine-root { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.fq-refine-root.is-open { pointer-events: auto; }
.fq-refine-backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: grid; place-items: center;
    padding: 20px;
    overflow-y: auto;
    animation: fq-refine-fade 0.18s ease-out both;
}
@keyframes fq-refine-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.fq-refine-modal {
    background: var(--el-surface, #fff);
    color: var(--el-text);
    max-width: 640px;
    width: 100%;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
    animation: fq-refine-pop 0.24s cubic-bezier(0.32, 0.72, 0.32, 1) both;
}
@keyframes fq-refine-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
html.night-mode .fq-refine-modal { background: #08152e; }
.fq-refine-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
html.night-mode .fq-refine-head { border-bottom-color: rgba(255, 255, 255, 0.1); }
.fq-refine-eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--el-accent);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.fq-refine-title { font-size: 1rem; font-weight: 800; color: var(--el-text); line-height: 1.3; }
.fq-refine-body {
    padding: 16px 20px;
    display: flex; flex-direction: column; gap: 14px;
    overflow-y: auto;
}
.fq-refine-field { display: flex; flex-direction: column; gap: 4px; }
.fq-refine-label { font-size: 0.78rem; font-weight: 700; color: var(--el-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.fq-refine-label small { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.7; }
.fq-refine-textarea, .fq-refine-input {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.14);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--el-text);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
}
html.night-mode .fq-refine-textarea, html.night-mode .fq-refine-input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
}
.fq-refine-input { font-family: inherit; }
.fq-refine-textarea { font-family: 'SFMono-Regular', 'Menlo', 'Consolas', monospace; font-size: 0.82rem; }
.fq-refine-preview {
    border: 1px solid rgba(var(--club-accent-rgb), 0.35);
    background: rgba(var(--club-accent-rgb), 0.04);
    border-radius: 10px;
    padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
}
.fq-refine-preview-head { color: var(--el-accent); font-weight: 800; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 6px; }
.fq-refine-preview-actions { display: flex; justify-content: flex-end; gap: 8px; }
.fq-refine-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
html.night-mode .fq-refine-foot { border-top-color: rgba(255, 255, 255, 0.1); }
.fq-refine-foot-right { display: inline-flex; gap: 8px; }
.fq-refine-ctas {
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
}
html.night-mode .fq-refine-ctas { border-top-color: rgba(255, 255, 255, 0.1); }
.fq-refine-cta-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 12px;
}
.fq-refine-cta-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 6px;
    align-items: center;
}
.fq-refine-cta-row .fq-icon-btn {
    width: 32px; height: 32px;
    display: inline-grid; place-items: center;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 6px;
    color: var(--el-text-muted);
    cursor: pointer;
}
.fq-refine-cta-row .fq-icon-btn:hover { color: #dc2626; border-color: rgba(220, 38, 38, 0.4); }
html.night-mode .fq-refine-cta-row .fq-icon-btn { border-color: rgba(255, 255, 255, 0.14); }
.fq-refine-cta-empty {
    padding: 12px;
    text-align: center;
    color: var(--el-text-muted);
    font-size: 0.85rem;
    font-style: italic;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}
html.night-mode .fq-refine-cta-empty { background: rgba(255, 255, 255, 0.03); }
.fq-refine-cta-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 4px;
}
.fq-refine-cta-add-row .fq-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(var(--club-accent-rgb), 0.06);
    border: 1px solid rgba(var(--club-accent-rgb), 0.25);
    color: var(--el-accent);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}
.fq-refine-cta-add-row .fq-btn:hover {
    background: rgba(var(--club-accent-rgb), 0.14);
}
@media (max-width: 500px) {
    .fq-refine-cta-row { grid-template-columns: 1fr; }
    .fq-refine-cta-row .fq-icon-btn { justify-self: end; }
}

.fq-refine-loading {
    padding: 40px;
    text-align: center;
    color: var(--el-text-muted);
    display: inline-flex; align-items: center; gap: 8px;
    justify-content: center;
    width: 100%;
}
@media (prefers-reduced-motion: reduce) {
    .fq-refine-modal, .fq-refine-backdrop { animation: none; }
    .el-faq-refine { transition: none; }
}

.fq-icon-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 4px;
    margin-top: -4px;
    /* Cap height so the ~80-icon library doesn't push the answer
       textarea + AI buttons off-screen. Internal scroll keeps
       everything else in view. */
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.02);
    scrollbar-width: thin;
}
html.night-mode .fq-icon-picker {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}
.fq-icon-picker::-webkit-scrollbar { width: 6px; }
.fq-icon-picker::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}
html.night-mode .fq-icon-picker::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}
.fq-icon-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    cursor: pointer;
    color: var(--el-text-muted);
}
html.night-mode .fq-icon-chip { border-color: rgba(255,255,255,0.15); }
.fq-icon-chip:hover { color: var(--el-accent); border-color: var(--el-accent); }
.fq-icon-chip.is-active {
    background: var(--el-accent);
    border-color: var(--el-accent);
    color: #fff;
}
.fq-ai-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.fq-drawer-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
html.night-mode .fq-drawer-foot { border-top-color: rgba(255,255,255,0.08); }

/* Buttons */
.fq-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.05);
    color: inherit;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 100ms;
}
html.night-mode .fq-btn {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.15);
}
.fq-btn:hover { background: rgba(0, 0, 0, 0.08); }
html.night-mode .fq-btn:hover { background: rgba(255,255,255,0.1); }
.fq-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.fq-btn--sm { padding: 5px 10px; font-size: 0.82rem; }
.fq-btn--primary {
    background: var(--el-accent);
    color: #fff;
    border-color: var(--el-accent);
}
.fq-btn--primary:hover { background: #0a1cb0; }
.fq-btn--accent {
    background: rgba(2, 12, 146, 0.1);
    color: var(--el-accent);
    border-color: rgba(2, 12, 146, 0.3);
}
html.night-mode .fq-btn--accent {
    background: rgba(120, 165, 255, 0.15);
    color: #a6c0ff;
    border-color: rgba(120, 165, 255, 0.3);
}
.fq-btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--el-text-muted);
}
.fq-btn--ghost:hover { background: rgba(0, 0, 0, 0.05); }
html.night-mode .fq-btn--ghost:hover { background: rgba(255,255,255,0.05); }
.fq-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    background: transparent;
    color: var(--el-text-muted);
    border: 0;
    cursor: pointer;
    border-radius: 4px;
}
.fq-icon-btn:hover { background: rgba(0, 0, 0, 0.08); color: var(--el-accent); }
html.night-mode .fq-icon-btn:hover { background: rgba(255,255,255,0.1); }
.fq-icon-btn--danger:hover { color: #dc2626; }

/* Loading + toast */
.fq-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 100px 20px;
    color: var(--el-text-muted);
}
.fq-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    background: #0f172a;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 10000;
    max-width: 90vw;
    font-size: 0.9rem;
    opacity: 1;
    transition: opacity 300ms, transform 300ms;
}
.fq-toast--success { background: #16a34a; }
.fq-toast--error { background: #dc2626; }
.fq-toast--out { opacity: 0; transform: translateX(-50%) translateY(20px); }

@media (max-width: 900px) {
    /* Stacked layout — sections on top, horizontal grip, items below.
       --fq-sec-h persists the top-row height (JS wires it same as
       --fq-sec-w on wide screens). */
    .fq-modal-body {
        grid-template-columns: 1fr;
        grid-template-rows: var(--fq-sec-h, 200px) 6px 1fr;
    }
    .fq-modal-body:has(.fq-drawer) {
        grid-template-columns: 1fr;
        grid-template-rows: var(--fq-sec-h, 200px) 6px 1fr;
    }
    .fq-drawer { position: fixed; inset: 0; z-index: 10; }
    .fq-sec-rail {
        max-height: none; /* was 200px — the grid track owns the height now */
        border-right: 0;
        border-bottom: 1px solid rgba(0,0,0,0.08);
    }
    /* Flip resizer to horizontal: it becomes a drag-up/down bar
       between the stacked sections + items rows. */
    .fq-resizer {
        cursor: row-resize;
        border-left: 0;
        border-right: 0;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }
    html.night-mode .fq-resizer { border-color: rgba(255, 255, 255, 0.08); }
    .fq-resizer::before {
        width: 40px;
        height: 2px;
        box-shadow:
            0 3px 0 0 rgba(0, 0, 0, 0.15),
            0 -3px 0 0 rgba(0, 0, 0, 0.15);
    }
    html.night-mode .fq-resizer::before {
        box-shadow:
            0 3px 0 0 rgba(255, 255, 255, 0.18),
            0 -3px 0 0 rgba(255, 255, 255, 0.18);
    }
    .fq-resizer:hover::before,
    .fq-resizer.is-dragging::before {
        box-shadow:
            0 3px 0 0 var(--el-accent),
            0 -3px 0 0 var(--el-accent);
    }
}

/* ── Token picker ────────────────────────────────────────────────
   Sits on top of the FAQ editor modal. Backdrop click closes.
   Grouped by category (Club / Memberships / Tier prices / Facilities
   / Coaching). Unresolved tokens (DB value missing) get an amber tint
   so the operator knows which field to populate before members see
   `{{club_hours}}` literally on the public page. */
.fq-tk-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.fq-tk-modal {
    width: min(720px, 100%);
    max-height: min(80vh, 720px);
    background: #ffffff;
    color: #0f172a;
    border-radius: 12px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
html.night-mode .fq-tk-modal { background: #101a30; color: #e6ebf5; }
.fq-tk-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    gap: 12px;
}
html.night-mode .fq-tk-head { border-bottom-color: rgba(255,255,255,0.08); }
.fq-tk-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--el-accent);
}
.fq-tk-sub {
    font-size: 0.78rem;
    color: var(--el-text-muted);
    margin-top: 2px;
    line-height: 1.4;
}
.fq-tk-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px 20px;
}
.fq-tk-cat + .fq-tk-cat { margin-top: 18px; }
.fq-tk-cat-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--el-text-muted);
    margin: 12px 0 6px;
    padding-left: 4px;
}
.fq-tk-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fq-tk-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: border-color 120ms, background 120ms;
}
html.night-mode .fq-tk-row {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
}
.fq-tk-row:hover {
    border-color: var(--el-accent);
    background: rgba(2, 12, 146, 0.05);
}
html.night-mode .fq-tk-row:hover { background: rgba(120, 165, 255, 0.08); }
.fq-tk-row--unresolved {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.35);
}
.fq-tk-row--unresolved:hover {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.6);
}
.fq-tk-row-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.fq-tk-key {
    background: rgba(0,0,0,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--el-accent);
    font-family: 'SF Mono', Menlo, Consolas, monospace;
}
html.night-mode .fq-tk-key {
    background: rgba(255,255,255,0.08);
    color: #a6c0ff;
}
.fq-tk-label {
    font-weight: 600;
    font-size: 0.92rem;
}
.fq-tk-value {
    font-size: 0.85rem;
    color: var(--el-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 2px;
}
.fq-tk-value i { color: var(--el-accent); font-size: 1rem; }
.fq-tk-row--unresolved .fq-tk-value { color: #b45309; }
.fq-tk-row--unresolved .fq-tk-value i { color: #d97706; }
html.night-mode .fq-tk-row--unresolved .fq-tk-value { color: #fbbf24; }
html.night-mode .fq-tk-row--unresolved .fq-tk-value i { color: #f59e0b; }
.fq-tk-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 20px;
    color: var(--el-text-muted);
}
.fq-tk-empty i { color: var(--el-accent); }
