/*
 * Tamilcube Chatbot Loader — minimal accordion styling for the SSR
 * [tamilcube_faq] shortcode. A subset of the hub's faq.css; the loader
 * plugin ships this so spokes render the accordion without depending on
 * any hub-side CSS.
 */

.tc-faq,
.tc-faq * { box-sizing: border-box; }

.tc-faq {
    --tc-faq-accent: #8b1e3f;
    --tc-faq-ink: #18212f;
    --tc-faq-muted: #647083;
    --tc-faq-line: #e4e7ec;
    --tc-faq-soft: #f9fafb;
    width: 100%;
    margin: 28px 0;
    color: var(--tc-faq-ink);
    font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.tc-faq-topic-group { margin: 0 0 28px; }

.tc-faq-topic {
    margin: 0 0 12px;
    color: var(--tc-faq-ink);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
}

.tc-faq-items { display: grid; gap: 10px; }

.tc-faq-item {
    overflow: hidden;
    border: 1px solid var(--tc-faq-line);
    border-radius: 10px;
    background: #fff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

/* Whole-card highlight when expanded — modern :has() lets us style the
   item based on the inner button's aria-expanded state. Fallback for
   browsers without :has() is just the unchanged border (no harm). */
.tc-faq-item:has(.tc-faq-question[aria-expanded="true"]) {
    border-color: color-mix(in srgb, var(--tc-faq-accent), white 65%);
    box-shadow: 0 4px 14px rgba(139, 30, 63, 0.08);
}

.tc-faq-question {
    width: 100%;
    min-height: 56px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 12px;
    align-items: center;
    border: 0;
    padding: 15px 16px;
    background: #fff;
    text-align: left;
    /* !important on color + opacity defends against host themes that
       apply button:hover { color: white } or opacity: 0 — those rules
       outrank an unmarked .tc-faq-question selector on the :hover
       pseudo-class and would make our question text invisible. */
    color: var(--tc-faq-ink) !important;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
    opacity: 1 !important;
    cursor: pointer;
    transition: background 0.14s ease;
}

.tc-faq-question:hover,
.tc-faq-question:focus,
.tc-faq-question:active,
.tc-faq-question:focus-visible {
    color: var(--tc-faq-ink) !important;
    opacity: 1 !important;
}

.tc-faq-question:hover { background: var(--tc-faq-soft); }
.tc-faq-question:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--tc-faq-accent), white 68%);
    outline-offset: -3px;
}

/* The question text lives in a plain <span> sibling of the icon span.
   Inheriting from the button covers most cases, but some themes target
   `button span` directly — this forces inheritance from our locked
   color above. */
.tc-faq-question > span:not(.tc-faq-icon) {
    color: inherit !important;
    opacity: 1 !important;
}

.tc-faq-icon {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--tc-faq-accent), white 88%);
    transition: background 0.18s ease;
}

.tc-faq-question[aria-expanded="true"] .tc-faq-icon {
    background: var(--tc-faq-accent);
}

.tc-faq-icon::before,
.tc-faq-icon::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 2px;
    border-radius: 999px;
    background: var(--tc-faq-accent);
    content: "";
    transform: translate(-50%, -50%);
    transition: background 0.18s ease;
}

.tc-faq-question[aria-expanded="true"] .tc-faq-icon::before,
.tc-faq-question[aria-expanded="true"] .tc-faq-icon::after {
    background: #fff;
}

.tc-faq-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
    transition: opacity 0.16s ease, background 0.18s ease;
}

.tc-faq-question[aria-expanded="true"] .tc-faq-icon::after { opacity: 0; }

.tc-faq-answer {
    padding: 0 16px 16px;
    color: #344054;
    font-size: 15px;
    line-height: 1.65;
}

.tc-faq-answer[hidden] { display: none; }

.tc-faq-answer p { margin: 0 0 10px; }
.tc-faq-answer p:last-child { margin-bottom: 0; }

.tc-faq-answer a:not(.tc-faq-link) {
    color: var(--tc-faq-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Secondary "More info" link — outlined pill rather than solid CTA so it
   reads as a reference link, not the primary action on the card. */
.tc-faq-link {
    display: inline-flex;
    align-items: center;
    margin-top: 6px;
    padding: 6px 12px;
    border: 1px solid color-mix(in srgb, var(--tc-faq-accent), white 78%);
    border-radius: 999px;
    color: var(--tc-faq-accent);
    background: color-mix(in srgb, var(--tc-faq-accent), white 94%);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.tc-faq-link:hover,
.tc-faq-link:focus-visible {
    background: color-mix(in srgb, var(--tc-faq-accent), white 86%);
    border-color: color-mix(in srgb, var(--tc-faq-accent), white 66%);
}

.tc-faq-link:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--tc-faq-accent), white 68%);
    outline-offset: 2px;
}

.tc-faq-link::after { margin-left: 6px; content: "\2197"; font-size: 11px; }

.tc-faq-empty {
    margin: 16px 0;
    border: 1px solid var(--tc-faq-line);
    border-radius: 10px;
    padding: 18px;
    color: var(--tc-faq-muted);
    background: var(--tc-faq-soft);
}

.tc-faq-empty strong { display: block; margin-bottom: 4px; color: var(--tc-faq-ink); }

@media (max-width: 700px) {
    .tc-faq-topic { font-size: 17px; }
    .tc-faq-question { padding: 14px; font-size: 14px; }
    .tc-faq-answer { padding: 0 14px 14px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .tc-faq-item,
    .tc-faq-question,
    .tc-faq-icon,
    .tc-faq-icon::before,
    .tc-faq-icon::after,
    .tc-faq-link {
        transition: none;
    }
}
