/**
 * WC FAQ Toggle – Front-end styles.
 *
 * Designed to sit naturally alongside WooCommerce tab panels.
 * Uses CSS custom properties so themes can override colours easily.
 *
 * @package Rivmedia\WC_FAQ_Toggle
 */

/* ── Customisable variables ─────────────────────────────────────── */

.rivmedia-wcfaq-section {
    --wcfaq-accent:       #8a1f1f;
    --wcfaq-accent-hover: #6e1818;
    --wcfaq-heading-text: #ffffff;
    --wcfaq-border:       #e0e0e0;
    --wcfaq-bg:           #ffffff;
    --wcfaq-text:         #333333;
    --wcfaq-text-light:   #666666;
    --wcfaq-radius:       4px;
}

/* ── Section wrapper ────────────────────────────────────────────── */

.rivmedia-wcfaq-section {
    margin: 2em 0;
    max-width: 100%;
    font-size: inherit;
    line-height: inherit;
    color: var(--wcfaq-text);
}

/* ── Panel (heading bar + body) ─────────────────────────────────── */

.rivmedia-wcfaq-panel {
    border: 1px solid var(--wcfaq-border);
    border-radius: var(--wcfaq-radius);
    overflow: hidden;
    background: var(--wcfaq-bg);
}

/* ── Heading bar ────────────────────────────────────────────────── */

.rivmedia-wcfaq-heading {
    margin: 0;
    padding: 12px 20px;
    background: var(--wcfaq-accent);
    color: var(--wcfaq-heading-text);
    font-size: 1.1em;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

/* ── Body area ──────────────────────────────────────────────────── */

.rivmedia-wcfaq-body {
    padding: 0;
}

/* ── Accordion list ─────────────────────────────────────────────── */

.rivmedia-wcfaq-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── Individual FAQ item ────────────────────────────────────────── */

.rivmedia-wcfaq-item {
    border-bottom: 1px solid var(--wcfaq-border);
}

.rivmedia-wcfaq-item:last-child {
    border-bottom: none;
}

/* ── Trigger button ─────────────────────────────────────────────── */

.rivmedia-wcfaq-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    margin: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.95em;
    color: var(--wcfaq-text);
    text-align: left;
    gap: 16px;
    transition: background-color 0.15s ease;
}

.rivmedia-wcfaq-trigger:hover {
    background-color: #f8f8f8;
}

.rivmedia-wcfaq-trigger:focus-visible {
    outline: 2px solid var(--wcfaq-accent);
    outline-offset: -2px;
}

/* ── Question text ──────────────────────────────────────────────── */

.rivmedia-wcfaq-question {
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

/* ── Plus / minus icon ──────────────────────────────────────────── */

.rivmedia-wcfaq-icon {
    position: relative;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--wcfaq-accent);
    transition: background-color 0.2s ease, transform 0.25s ease;
}

.rivmedia-wcfaq-trigger:hover .rivmedia-wcfaq-icon {
    background: var(--wcfaq-accent-hover);
}

.rivmedia-wcfaq-icon::before,
.rivmedia-wcfaq-icon::after {
    content: '';
    position: absolute;
    background: var(--wcfaq-heading-text);
    border-radius: 1px;
    transition: transform 0.25s ease;
}

/* Horizontal bar */
.rivmedia-wcfaq-icon::before {
    top: 50%;
    left: 5px;
    right: 5px;
    height: 2px;
    transform: translateY(-50%);
}

/* Vertical bar */
.rivmedia-wcfaq-icon::after {
    left: 50%;
    top: 5px;
    bottom: 5px;
    width: 2px;
    transform: translateX(-50%) rotate(0deg);
}

/* Rotate vertical bar when open */
.rivmedia-wcfaq-trigger[aria-expanded="true"] .rivmedia-wcfaq-icon::after {
    transform: translateX(-50%) rotate(90deg);
}

/* ── Answer panel ───────────────────────────────────────────────── */

.rivmedia-wcfaq-answer {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
}

.rivmedia-wcfaq-answer[hidden] {
    display: block; /* Override UA hidden so CSS transition works */
    max-height: 0;
    opacity: 0;
    visibility: hidden;
}

.rivmedia-wcfaq-answer.is-open {
    visibility: visible;
    opacity: 1;
}

.rivmedia-wcfaq-answer-inner {
    padding: 0 20px 20px;
    color: var(--wcfaq-text-light);
    font-size: 0.92em;
    line-height: 1.7;
}

.rivmedia-wcfaq-answer-inner p:first-child {
    margin-top: 0;
}

.rivmedia-wcfaq-answer-inner p:last-child {
    margin-bottom: 0;
}

/* ── Category archive variant ───────────────────────────────────── */

.woocommerce-page .rivmedia-wcfaq-section {
    clear: both;
}
