/* ============================================================
   FAQ PAGE — faq.css
   Uses project CSS variables only. Responsive down to 320px.
   ============================================================ */



/* ── FAQ Layout ─────────────────────────────────────────────── */

.faq-area {
    padding-block: 70px;
}

.faq-area-container {
    width: 100%;
}

.faq-area-row {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 30px;
    align-items: start;
}


/* ── Sidebar ────────────────────────────────────────────────── */

.faq-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 20px);
}

/* Card wrapper — this is the element that carries the visual card */
.faq-sidebar .list-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    box-shadow: var(--shadow-light);
}
/* Individual category link */
.faq-sidebar .list-group-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 11px var(--spacing-lg);
    padding-inline-start: 18px; /* space for the active bar */
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
    border: 1px solid transparent;
    line-height: 1.4;
    position: relative;
    user-select: none;
}

/* Icon comes first visually, regardless of source order or dir */
.faq-sidebar .list-group-item .icon {
    order: -1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: inherit;
}

.faq-sidebar .list-group-item .icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.faq-sidebar .list-group-item .label {
    flex: 1;
    min-width: 0;
}
/* Left active indicator bar */
.faq-sidebar .list-group-item::before {
    content: '';
    position: absolute;
    inset-inline-start: var(--spacing-sm);
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary-color);
    border-radius: 2px;
    transition: height var(--transition-normal);
}

.faq-sidebar .list-group-item:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--border-light);
}

.faq-sidebar .list-group-item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.faq-sidebar .list-group-item.active {
    background: var(--primary-more-light);
    color: var(--primary-color);
    font-weight: 600;
    border-color: var(--primary-light);
}

/* Extend the bar when active */
.faq-sidebar .list-group-item.active::before {
    height: 55%;
}


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

.faq-content .accordion {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.accordion-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: box-shadow var(--transition-normal),
                border-color var(--transition-normal);
}

.accordion-item:hover {
    border-color: var(--border-primary);
    box-shadow: var(--shadow-medium);
}

.accordion-item.is-open {
    border-color: var(--primary-light);
    box-shadow: 0 4px 20px var(--primary-light);
}

.accordion-header {
    margin: 0;
}

.accordion-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-md);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: start; /* RTL-safe — replaces text-align: left */
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: 600;
    font-family: inherit;
    line-height: 1.45;
    transition: var(--transition-fast);
}

.accordion-button:hover {
    color: var(--primary-color);
}

/* Question mark icon badge */
.faq-icon-question {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    background: var(--primary-more-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
}

.accordion-item.is-open .faq-icon-question {
    background: var(--primary-color);
    color: var(--text-white);
}

/* Chevron SVG — pushed to the end, rotates when open */
.faq-icon-chevron {
    margin-right: auto;
    color: var(--text-muted);
    transition: transform var(--transition-normal), color var(--transition-normal);
}

[dir="ltr"] .faq-icon-chevron{
    margin-right: 0px !important;
    margin-left: auto !important;
}

.accordion-item.is-open .faq-icon-chevron {
    transform: rotate(180deg);
    color: var(--primary-color);
}

/* Collapse panel */
.accordion-collapse {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-collapse.show {
    max-height: 600px;
}

.accordion-body {
    padding: 11px var(--spacing-lg) var(--spacing-lg);
    color: var(--text-muted);
    font-size: var(--font-size-base);
    line-height: 1.7;
    border-top: 1px solid var(--border-accent);
}
/* ── Search Form ─────────────────────────────────────────────── */

.faq-search-form {
    margin-bottom: var(--spacing-md);
    width: 100%;
    max-width: 450px;
}

/* Pill-shaped wrapper that holds icon + input + button together */
.faq-search-inner {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0 var(--spacing-sm) 0 var(--spacing-md);
    box-shadow: var(--shadow-light);
    transition: border-color var(--transition-fast),
                box-shadow var(--transition-fast);
                width: 100%;
}

/* Highlight the whole pill when the input is focused */
.faq-search-inner:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-more-light);
}

/* Decorative search icon on the left */
.faq-search-icon {
    flex-shrink: 0;
    color: var(--text-light);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.faq-search-inner:focus-within .faq-search-icon {
    color: var(--primary-color);
}

/* The text input itself */
.faq-search-input {
    flex: 1;
    min-width: 0;                        /* prevents overflow in tight layouts */
    border: none;
    outline: none;
    background: transparent;
    padding: 11px var(--spacing-sm);
    font-size: var(--font-size-sm);
    font-family: inherit;
    color: var(--text-secondary);
    line-height: 1.4;
}

.faq-search-input::placeholder {
    color: var(--text-light);
}

/* Remove the native ✕ clear button that browsers add to type="search" */
.faq-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* Submit button — icon-only, no border, inherits pill background */
.faq-search-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-more-light);
    color: var(--primary-color);
    cursor: pointer;
    transition: background var(--transition-fast),
                color var(--transition-fast);
}

.faq-search-btn:hover {
    background: var(--primary-color);
    color: var(--text-white);
}

.faq-search-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}


/* ── Responsive tweaks for the search form ───────────────────── */

@media (max-width: 768px) {
    /* On mobile the sidebar goes full-width, so the form naturally stretches */
    .faq-search-form {
        margin-bottom: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .faq-search-input {
        font-size: var(--font-size-xs);
        padding: 10px var(--spacing-xs);
    }
}
/* ── Empty state (shown by JS when a category has no results) ── */

.faq-no-results {
    text-align: center;
    padding: 60px var(--spacing-2xl);
    color: var(--text-light);
    display: none;                  /* JS sets display: flex to reveal */
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
}

.faq-no-results svg {
    color: var(--border-primary);
    opacity: 0.6;
}

.faq-no-results p {
    font-size: var(--font-size-md);
    margin: 0;
}


/* ── Mobile sidebar toggle button (hidden on desktop) ─────────── */

.faq-sidebar-toggle {
    display: none;                  /* flex only on mobile — see breakpoint below */
    width: 100%;
    padding: 12px var(--spacing-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    transition: var(--transition-fast);
    box-shadow: var(--shadow-light);
}

.faq-sidebar-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.faq-sidebar-toggle .toggle-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Chevron SVG inside the toggle button */
.faq-sidebar-toggle .toggle-chevron {
    transition: transform var(--transition-normal);
}

.faq-sidebar-toggle.open .toggle-chevron {
    transform: rotate(180deg);
}

/* When toggle is open, round the bottom corners of the button
   and connect it visually to the dropdown list below */
.faq-sidebar-toggle.open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
    color: var(--primary-color);
}


/* ── Responsive ─────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
    .faq-area-row {
        grid-template-columns: 220px 1fr;
        gap: 20px;
    }

    .faq-sidebar .list-group-item {
        font-size: var(--font-size-xs);
        padding: 10px var(--spacing-md);
        padding-inline-start: 18px;
    }
}

/* Mobile landscape + large phones */
@media (max-width: 768px) {

    .faq-area {
        padding-block: 40px;
    }

    /* Stack sidebar above content */
    .faq-area-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    /* Sidebar is no longer sticky */
    .faq-sidebar {
        position: static;
    }

    /* Show the toggle button */
    .faq-sidebar-toggle {
        display: flex;
    }

    /* The list-group becomes a collapsible dropdown */
    .faq-sidebar .list-group {
        display: none;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        border-top: none;
        padding-top: var(--spacing-xs);
        margin-top: 0;
    }

    .faq-sidebar .list-group.open {
        display: flex;
        border-color: var(--primary-color);
    }

    /* Slightly smaller accordion on mobile */
    .accordion-button {
        padding: var(--spacing-lg);
        font-size: var(--font-size-sm);
    }

    .accordion-body {
        padding: 0 var(--spacing-lg) var(--spacing-lg);
        padding-inline-start: calc(var(--spacing-lg) + 30px + var(--spacing-sm));
        font-size: var(--font-size-sm);
    }
}

/* Small phones */
@media (max-width: 480px) {

    .accordion-button {
        gap: var(--spacing-sm);
        padding: var(--spacing-md);
    }

    .faq-icon-question {
        width: 26px;
        height: 26px;
    }

    /* On very small screens drop the indented padding — just align flush */
    .accordion-body {
        padding: 0 var(--spacing-md) var(--spacing-md);
        padding-inline-start: var(--spacing-md);
    }

    .faq-sidebar .list-group-item {
        font-size: var(--font-size-xs);
        padding: 6px;
        padding-inline-start: 5px;
    }
}