/* ==========================================================================
   Module affaq — front accordion
   Standalone styles (no Bootstrap dependency).
   ========================================================================== */

.affaq-block {
    margin: 40px 0;
    font-family: inherit;
    color: #333;
    --affaq-border: #e5e5e5;
    --affaq-border-hover: #222;
    --affaq-text: #222;
    --affaq-accent: #111;
    --affaq-bg-hover: transparent;
    --affaq-radius: 0;
}

.affaq-block * {
    box-sizing: border-box;
}

.affaq-block .affaq-title {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0 0 24px;
    line-height: 1.2;
    color: var(--affaq-text);
}

.affaq-block .affaq-block-description {
    margin: 0 0 20px;
    color: #555;
    line-height: 1.5;
}

.affaq-block .affaq-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--affaq-border);
}

.affaq-block .affaq-item {
    border-bottom: 1px solid var(--affaq-border);
    margin: 0;
    padding: 0;
    list-style: none;
}

.affaq-block .affaq-item::before {
    content: none;
}

.affaq-block .affaq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 18px 8px;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: var(--affaq-radius);
    color: var(--affaq-text);
    font: inherit;
    font-weight: 600;
    font-size: 1em;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease;
}

.affaq-block .affaq-question:hover,
.affaq-block .affaq-question:focus {
    color: var(--affaq-accent);
    background-color: var(--affaq-bg-hover);
    outline: none;
}

.affaq-block .affaq-question:focus-visible {
    outline: 2px solid var(--affaq-accent);
    outline-offset: -2px;
}

.affaq-block .affaq-question-text {
    flex: 1 1 auto;
    padding-right: 16px;
}

/* ± icon rendered in pure CSS, rotates on expand */
.affaq-block .affaq-icon {
    position: relative;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    display: inline-block;
}

.affaq-block .affaq-icon::before,
.affaq-block .affaq-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: currentColor;
    transition: transform .25s ease, opacity .25s ease;
}

.affaq-block .affaq-icon::before {
    width: 14px;
    height: 2px;
    transform: translate(-50%, -50%);
}

.affaq-block .affaq-icon::after {
    width: 2px;
    height: 14px;
    transform: translate(-50%, -50%);
}

.affaq-block .affaq-question[aria-expanded="true"] .affaq-icon::after {
    transform: translate(-50%, -50%) scaleY(0);
    opacity: 0;
}

.affaq-block .affaq-question[aria-expanded="true"] {
    color: var(--affaq-accent);
}

.affaq-block .affaq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
}

.affaq-block .affaq-answer-inner {
    padding: 0 8px 22px;
    line-height: 1.6;
    color: #444;
}

.affaq-block .affaq-answer-inner > *:first-child {
    margin-top: 0;
}

.affaq-block .affaq-answer-inner > *:last-child {
    margin-bottom: 0;
}

.affaq-block .affaq-answer-inner a {
    color: var(--affaq-accent);
    text-decoration: underline;
}

/* Accessibility: respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .affaq-block .affaq-answer,
    .affaq-block .affaq-icon,
    .affaq-block .affaq-icon::before,
    .affaq-block .affaq-icon::after,
    .affaq-block .affaq-question {
        transition: none;
    }
}

/* No-JS fallback: show all answers opened */
.affaq-block.no-js .affaq-answer {
    max-height: none;
}

/* ==========================================================================
   Public list page (controllers/front/list.php → list.tpl) — 2-column layout
   ========================================================================== */
.affaq-list-wrapper {
    max-width: 1180px;
    margin: 24px auto 60px;
    padding: 0 16px;
    --affaq-border: #e5e5e5;
    --affaq-border-hover: #222;
    --affaq-text: #222;
    --affaq-accent: #111;
}
.affaq-list-2col {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    align-items: start;
}
@media (max-width: 768px) {
    .affaq-list-2col { grid-template-columns: 1fr; }
}

/* Sidebar */
.affaq-list-sidebar {
    position: sticky;
    top: 24px;
    align-self: start;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}
.affaq-list-sidebar__title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin: 0 0 12px;
}
.affaq-list-sidebar__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.affaq-list-sidebar__link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: background 120ms ease, color 120ms ease;
}
.affaq-list-sidebar__link:hover {
    background: #f3f4f6;
    color: #111;
}
.affaq-list-sidebar__link.is-active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 500;
}
.affaq-list-sidebar__link .material-icons {
    font-size: 18px;
    color: #9ca3af;
    flex-shrink: 0;
}

/* aficons SVG icon in the sidebar links */
.affaq-list-sidebar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: currentColor;
}
.affaq-list-sidebar__icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Main column */
.affaq-list-main { min-width: 0; }

.affaq-list-filter { margin-bottom: 24px; }
.affaq-list-filter__input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--affaq-border);
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
    font-family: inherit;
    box-sizing: border-box;
}
.affaq-list-filter__input:focus {
    outline: none;
    border-color: var(--affaq-border-hover);
}

.affaq-list-empty {
    text-align: center;
    color: #9ca3af;
    padding: 32px 0;
}

.affaq-list-section { margin-bottom: 40px; }
.affaq-list-section__title {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--affaq-accent);
    display: flex;
    align-items: center;
    gap: 10px;
}
.affaq-list-section__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    color: currentColor;
}
.affaq-list-section__icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}
.affaq-list-section__desc {
    margin-bottom: 16px;
    color: #555;
}

/* Reuse accordion styles on list page */
.affaq-list-section .affaq-list { list-style: none; padding: 0; margin: 0; }
.affaq-list-section .affaq-item {
    border-top: 1px solid var(--affaq-border);
}
.affaq-list-section .affaq-item:last-child { border-bottom: 1px solid var(--affaq-border); }
.affaq-list-section .affaq-question {
    width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
    padding: 16px 16px 16px 0; display: flex; align-items: center; justify-content: space-between;
    font-size: 16px; color: var(--affaq-text); font-weight: 500;
    transition: color 200ms ease;
}
.affaq-list-section .affaq-question:hover { color: var(--affaq-border-hover); }
.affaq-list-section .affaq-icon {
    position: relative; width: 16px; height: 16px; flex-shrink: 0; margin-left: 12px;
}
.affaq-list-section .affaq-icon::before,
.affaq-list-section .affaq-icon::after {
    content: ''; position: absolute; background: currentColor;
    transition: transform 300ms ease;
}
.affaq-list-section .affaq-icon::before {
    top: 50%; left: 0; width: 100%; height: 2px; margin-top: -1px;
}
.affaq-list-section .affaq-icon::after {
    left: 50%; top: 0; width: 2px; height: 100%; margin-left: -1px;
}
.affaq-list-section .affaq-question[aria-expanded="true"] .affaq-icon::after { transform: rotate(90deg); }

.affaq-list-section .affaq-answer {
    max-height: 0; overflow: hidden; transition: max-height 350ms ease;
}
.affaq-list-section .affaq-answer-inner { padding: 0 0 16px 0; color: #444; line-height: 1.6; }

/* ==========================================================================
   Helpful / not-helpful voting widget (feature 6.4)
   ========================================================================== */

.affaq-helpful {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #e5e5e5;
    font-size: 0.88em;
    color: #666;
}

.affaq-helpful__label { margin-right: 4px; }

.affaq-helpful__btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 16px;
    color: #333;
    cursor: pointer;
    font: inherit;
    line-height: 1;
    transition: background 120ms ease, border-color 120ms ease;
}
.affaq-helpful__btn:hover { background: #f4f4f4; border-color: #999; }
.affaq-helpful__btn.is-selected { background: #111; border-color: #111; color: #fff; }
.affaq-helpful__btn--up.is-selected  { background: #2e7d32; border-color: #2e7d32; }
.affaq-helpful__btn--down.is-selected { background: #c62828; border-color: #c62828; }
.affaq-helpful__btn .material-icons { font-size: 16px; line-height: 1; }
.affaq-helpful__btn .affaq-helpful__count { min-width: 10px; }

.affaq-helpful[data-voted="1"] .affaq-helpful__btn:not(.is-selected) {
    opacity: 0.5;
    cursor: default;
}
.affaq-helpful__thanks { margin-left: 6px; color: #2e7d32; }

