/* ===========================================================================
   TigerBlocks FAQ — component styles
   Location: /wp-content/mu-plugins/tigerblocks-faq/assets/css/faq.css
   Note: the overall layout (black header, sidebar/main split) is built in
         Elementor. Here we style ONLY the internals of each shortcode.

   Anti-override strategy: every rule is nested under its root container
   (.tb-faq-search / .tb-faq-categories / .tb-faq-list) to raise specificity
   to (0,2,0)+ and beat Elementor/theme classes regardless of load order.
   `!important` is reserved ONLY for high-conflict properties (button/input
   background/color/border, list-style and links) that Elementor/themes tend
   to force.
   =========================================================================== */

:root {
    --tb-faq-accent:        #FDAD01;  /* brand amber */
    --tb-faq-accent-soft:   #fef0cc;  /* active category background */
    --tb-faq-ink:           #111827;  /* primary text */
    --tb-faq-muted:         #6b7280;  /* secondary text */
    --tb-faq-line:          #e5e7eb;  /* borders */
    --tb-faq-surface:       #ffffff;
    --tb-faq-surface-2:     #f3f4f6;  /* inactive category background */
    --tb-faq-radius:        12px;
    --tb-faq-link:          #2563eb;
}

/* ---------- Search box ---------- */
.tb-faq-search.tb-faq-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.tb-faq-search .tb-faq-search__icon {
    position: absolute;
    left: 18px;
    color: var(--tb-faq-muted);
    pointer-events: none;
}
.tb-faq-search .tb-faq-search__input {
    width: 100%;
    padding: 16px 18px 16px 52px !important;
    font-size: 1rem;
    color: var(--tb-faq-ink) !important;
    background: var(--tb-faq-surface) !important;
    border: 1px solid transparent !important;
    border-radius: var(--tb-faq-radius) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08) !important;
    outline: none;
}
.tb-faq-search .tb-faq-search__input:focus {
    border-color: var(--tb-faq-accent) !important;
    box-shadow: 0 0 0 3px rgba(245, 166, 35, .25) !important;
}
/* Desktop: half-width, horizontally centered within its parent.
   (Mobile stays 100% via the base rule above.) */
@media (min-width: 769px) {
    .tb-faq-search.tb-faq-search {
        width: 50%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ---------- Category sidebar ---------- */
.tb-faq-categories .tb-faq-categories__title {
    margin: 0 0 14px;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .04em;
    line-height: .8rem;
}
.tb-faq-categories .tb-faq-categories__list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.tb-faq-categories .tb-faq-category {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left !important;
    padding: 12px 16px !important;
    font-size: .95rem;
    font-weight: 500;
    color: var(--tb-faq-ink) !important;
    background: var(--tb-faq-surface-2) !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.tb-faq-categories .tb-faq-category__icon {
    flex: 0 0 auto;
    color: var(--tb-faq-muted);
}
.tb-faq-categories .tb-faq-category__label {
    flex: 1 1 auto;
}
.tb-faq-categories .tb-faq-category:hover {
    background: #e8eaed !important;
}
.tb-faq-categories .tb-faq-category.is-active {
    background: var(--tb-faq-accent-soft) !important;
    color: var(--tb-faq-ink) !important;
}
.tb-faq-categories .tb-faq-category.is-active .tb-faq-category__icon {
    color: var(--tb-faq-accent);
}
.tb-faq-categories .tb-faq-category:focus-visible {
    outline: 2px solid var(--tb-faq-accent);
    outline-offset: 2px;
}

/* ---------- FAQ list ---------- */
.tb-faq-list .tb-faq-list__heading {
    margin: 0 0 24px;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--tb-faq-ink);
}
.tb-faq-list .tb-faq-item {
    background: var(--tb-faq-surface) !important;
    border: 1px solid var(--tb-faq-line) !important;
    border-radius: var(--tb-faq-radius);
    margin-bottom: 14px;
    overflow: hidden;
}
.tb-faq-list .tb-faq-item[hidden] {
    display: none;
}
.tb-faq-list .tb-faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--tb-faq-ink);
    cursor: pointer;
    list-style: none !important;   /* hide native/theme marker */
}
.tb-faq-list .tb-faq-question::-webkit-details-marker {
    display: none;                 /* Safari */
}
.tb-faq-list .tb-faq-question:focus-visible {
    outline: 2px solid var(--tb-faq-accent);
    outline-offset: -2px;
}
.tb-faq-list .tb-faq-chevron {
    flex: 0 0 auto;
    color: var(--tb-faq-muted);
    transition: transform .2s ease;
}
.tb-faq-list .tb-faq-item[open] .tb-faq-chevron {
    transform: rotate(180deg);
}
.tb-faq-list .tb-faq-answer {
    padding: 0 24px 22px;
    color: var(--tb-faq-muted);
    line-height: 1.6;
}
.tb-faq-list .tb-faq-answer a {
    color: var(--tb-faq-link) !important;
    text-decoration: none !important;
}
.tb-faq-list .tb-faq-answer a:hover {
    text-decoration: underline !important;
}
.tb-faq-list .tb-faq-answer ul {
    list-style: disc !important;
    margin: 8px 0 !important;
    padding-left: 20px !important;
}

/* ---------- Empty state ---------- */
.tb-faq-list .tb-faq-empty {
    padding: 28px 4px;
    color: var(--tb-faq-muted);
    font-size: .95rem;
}

/* ---------- Help / contact card ---------- */
.tb-faq-help.tb-faq-help {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: #EAECF0;
    border-radius: var(--tb-faq-radius);
}
.tb-faq-help .tb-faq-help__icon {
    flex: 0 0 auto;
    color: var(--tb-faq-accent);
}
.tb-faq-help .tb-faq-help__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tb-faq-help .tb-faq-help__text {
    margin: 0 !important;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    max-width: 225px;
    color: var(--tb-faq-ink);
}
.tb-faq-help .tb-faq-help__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .95rem;
    font-weight: 600;
    color: var(--tb-faq-accent) !important;
    text-decoration: none !important;
}
.tb-faq-help .tb-faq-help__link:hover {
    text-decoration: underline !important;
}
.tb-faq-help .tb-faq-help__external {
    flex: 0 0 auto;
}
.tb-faq-help .tb-faq-help__link:focus-visible {
    outline: 2px solid var(--tb-faq-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Help card placement (desktop sidebar vs. mobile below content) ----------
   Drop the SAME [tigerblocks_faq_help] block in two Elementor spots:
     - in the sidebar  ->  class="tb-faq-help--desktop"
     - below the main content  ->  class="tb-faq-help--mobile"
   These helpers toggle which copy is visible. (Class is doubled to reach
   (0,2,0) specificity and beat the base .tb-faq-help.tb-faq-help rule.) */
.tb-faq-help--desktop.tb-faq-help--desktop { display: flex; }
.tb-faq-help--mobile.tb-faq-help--mobile   { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .tb-faq-help--desktop.tb-faq-help--desktop { display: none; }
    .tb-faq-help--mobile.tb-faq-help--mobile   { display: flex; }

    /* Category menu becomes a single horizontal, swipeable row.
       Blocks keep their size and overflow scrolls side to side. */
    .tb-faq-categories .tb-faq-categories__list {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;        /* momentum scroll on iOS */
        scroll-snap-type: x proximity;
        /* let chips bleed to the screen edges so it reads as scrollable */
        margin: 0 -16px !important;
        padding: 4px 16px 10px !important;
        scrollbar-width: thin;
    }
    .tb-faq-categories .tb-faq-categories__list::-webkit-scrollbar {
        height: 4px;
    }
    .tb-faq-categories .tb-faq-categories__list::-webkit-scrollbar-thumb {
        background: var(--tb-faq-line);
        border-radius: 4px;
    }
    .tb-faq-categories .tb-faq-category {
        flex: 0 0 auto;                /* don't shrink — preserve block width */
        width: auto;
        white-space: nowrap;           /* keep each label on one line */
        scroll-snap-align: start;
    }
    .tb-faq-list .tb-faq-list__heading {
        font-size: 1.3rem;
    }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    .tb-faq-list .tb-faq-chevron,
    .tb-faq-categories .tb-faq-category {
        transition: none;
    }
}
