/**
 * PMTS — FAQ Page
 * Modern accordion with category tabs, search, and deep-link support.
 * Theme-aware (uses style.css design tokens).
 */

/* ============================
   HERO — premium aurora backdrop
   Multi-layer mesh gradient + dot texture + light beam.
   Inspired by Stripe / Linear / Vercel docs heroes.
   ============================ */
.faq-hero {
    padding: 7rem 0 5rem;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: var(--bg-primary);
    text-align: center;
}

/* Background container holds three decorative layers */
.faq-hero__bg {
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* Layer 1: AURORA — multiple soft radial gradients overlapping
   Creates an organic, atmospheric color wash */
.faq-hero__aurora {
    position: absolute; inset: -10%;
    background:
        radial-gradient(at 18% 22%, hsla(244, 88%, 62%, 0.22) 0px, transparent 45%),
        radial-gradient(at 82% 18%, hsla(264, 82%, 60%, 0.20) 0px, transparent 45%),
        radial-gradient(at 60% 75%, hsla(228, 80%, 58%, 0.18) 0px, transparent 50%),
        radial-gradient(at 12% 78%, hsla(280, 70%, 55%, 0.16) 0px, transparent 55%);
    filter: blur(60px) saturate(1.15);
    animation: faqAuroraDrift 24s ease-in-out infinite alternate;
}
[data-theme="light"] .faq-hero__aurora {
    background:
        radial-gradient(at 18% 22%, hsla(244, 95%, 65%, 0.14) 0px, transparent 45%),
        radial-gradient(at 82% 18%, hsla(264, 90%, 65%, 0.12) 0px, transparent 45%),
        radial-gradient(at 60% 75%, hsla(228, 90%, 60%, 0.10) 0px, transparent 50%),
        radial-gradient(at 12% 78%, hsla(280, 80%, 60%, 0.10) 0px, transparent 55%);
}
@keyframes faqAuroraDrift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-2%, 1%) scale(1.05); }
}

/* Layer 2: DOT TEXTURE — fine pattern, edge-faded
   Adds tactile depth without competing for attention */
.faq-hero__dots {
    position: absolute; inset: 0;
    background-image: radial-gradient(
        color-mix(in srgb, var(--text-primary) 14%, transparent) 1px,
        transparent 1.5px);
    background-size: 24px 24px;
    background-position: 0 0;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, black 10%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, black 10%, transparent 75%);
    opacity: 0.35;
}
[data-theme="light"] .faq-hero__dots {
    background-image: radial-gradient(
        color-mix(in srgb, var(--text-primary) 22%, transparent) 1px,
        transparent 1.5px);
    opacity: 0.5;
}

/* Layer 3: BEAM — vertical light shaft behind the title
   Subtle accent glow that lifts the headline */
.faq-hero__beam {
    position: absolute;
    top: -5%; left: 50%;
    width: 50%; height: 70%;
    transform: translateX(-50%);
    background: radial-gradient(ellipse 50% 60% at 50% 30%,
        color-mix(in srgb, var(--accent) 25%, transparent) 0%,
        transparent 70%);
    filter: blur(30px);
}
[data-theme="light"] .faq-hero__beam {
    background: radial-gradient(ellipse 50% 60% at 50% 30%,
        color-mix(in srgb, var(--accent) 12%, transparent) 0%,
        transparent 70%);
}

/* Smooth fade into the next section */
.faq-hero::after {
    content: '';
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 100px;
    background: linear-gradient(to bottom, transparent, var(--bg-primary));
    pointer-events: none;
    z-index: 1;
}

.faq-hero > .container {
    position: relative;
    z-index: 2;
}

.faq-hero__inner {
    max-width: 720px;
    margin: 0 auto;
}

/* Eyebrow with pulsating accent dot — premium status-indicator feel */
.faq-hero__eyebrow {
    display: inline-flex; align-items: center; gap: 0.55rem;
    padding: 0.45rem 1rem 0.45rem 0.85rem;
    background: color-mix(in srgb, var(--bg-card) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px -3px rgba(99, 102, 241, 0.15);
}
.faq-hero__eyebrow-dot {
    width: 8px; height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
    animation: faqDotPulse 2.5s ease-out infinite;
}
@keyframes faqDotPulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
    70%  { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.faq-hero__title {
    font-size: clamp(2.5rem, 4.5vw + 0.5rem, 4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--text-primary);
    margin: 0 0 1.25rem;
    /* Subtle text-shadow gives depth against the aurora */
    text-shadow: 0 1px 0 color-mix(in srgb, var(--text-primary) 5%, transparent);
}
.faq-hero__subtitle {
    font-size: clamp(1rem, 0.5vw + 0.88rem, 1.2rem);
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

/* ============================
   SEARCH — the focal element
   Big, elevated, gradient-bordered, theme-aware
   ============================ */
.faq-search {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.05),
        0 8px 24px -8px rgba(99, 102, 241, 0.18),
        0 20px 48px -24px rgba(0, 0, 0, 0.25);
    transition: box-shadow 0.25s, transform 0.25s;
}
.faq-search::before {
    /* Gradient border via mask trick — clean accent edge, not a heavy frame */
    content: '';
    position: absolute; inset: 0;
    padding: 1.5px;
    border-radius: 16px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent) 70%, transparent),
        color-mix(in srgb, var(--accent) 25%, transparent) 50%,
        color-mix(in srgb, var(--accent) 60%, transparent));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 0.25s;
}
.faq-search:hover {
    transform: translateY(-1px);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.05),
        0 12px 32px -8px rgba(99, 102, 241, 0.25),
        0 28px 56px -24px rgba(0, 0, 0, 0.28);
}
.faq-search:hover::before { opacity: 0.85; }
.faq-search:focus-within {
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent),
        0 12px 32px -8px rgba(99, 102, 241, 0.3),
        0 28px 56px -24px rgba(0, 0, 0, 0.28);
}
.faq-search:focus-within::before { opacity: 1; }

.faq-search__icon {
    position: absolute;
    left: 1.25rem; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px;
    color: var(--accent);
    pointer-events: none;
    z-index: 1;
}
.faq-search__input {
    position: relative;
    width: 100%;
    padding: 1.15rem 6.5rem 1.15rem 3.4rem;
    font-size: 1.02rem;
    font-weight: 500;
    background: transparent;
    border: none;
    border-radius: 16px;
    color: var(--text-primary);
}
.faq-search__input::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}
.faq-search__input:focus { outline: none; }

/* Keyboard hint inside the input (right side) */
.faq-search__kbd {
    position: absolute;
    right: 1rem; top: 50%; transform: translateY(-50%);
    display: inline-block;
    padding: 0.22rem 0.55rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-tertiary);
    line-height: 1;
    pointer-events: none;
    transition: opacity 0.15s;
}
.faq-search:focus-within .faq-search__kbd { opacity: 0; }

.faq-search__clear {
    position: absolute;
    right: 1rem; top: 50%; transform: translateY(-50%);
    background: var(--border);
    border: none;
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s, transform 0.15s;
    z-index: 2;
}
.faq-search__clear:hover { background: var(--accent); color: white; transform: translateY(-50%) scale(1.08); }
.faq-search__clear svg { width: 13px; height: 13px; }

/* Hint below the search */
.faq-hero__hint {
    margin: 1.1rem 0 0;
    font-size: 0.78rem;
    color: var(--text-tertiary);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: center;
}
.faq-hero__hint kbd {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
}
.faq-hero__hint-sep {
    color: var(--text-tertiary);
    opacity: 0.5;
}

/* ===== CATEGORY TABS ===== */
.faq-cats {
    padding: 1.5rem 0 0.5rem;
    background: var(--bg-primary);
    position: sticky;
    top: 60px;
    z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
    border-bottom: 1px solid var(--border);
}
.faq-cats__list {
    display: flex; gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
}
.faq-cats__list::-webkit-scrollbar { display: none; }

/* Category tabs use --cat-color (set inline by JS) for theming.
   Falls back to --accent if no category color is set. */
.faq-cat {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-size: 0.85rem; font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
    --cat-color: var(--accent);
}
.faq-cat:hover {
    border-color: var(--cat-color);
    color: var(--cat-color);
    transform: translateY(-1px);
}
.faq-cat svg {
    width: 15px; height: 15px;
    color: var(--cat-color);
}
.faq-cat--active {
    background: var(--cat-color);
    border-color: var(--cat-color);
    color: white;
    box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--cat-color) 50%, transparent);
}
.faq-cat--active:hover { color: white; transform: none; }
.faq-cat--active svg { color: white; }
.faq-cat__count {
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    background: color-mix(in srgb, var(--cat-color) 12%, var(--bg-primary));
    color: var(--cat-color);
    border-radius: 999px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}
.faq-cat--active .faq-cat__count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* ===== FAQ LIST + SECTIONS ===== */
.faq-list {
    padding: 2.5rem 0 4rem;
    background: var(--bg-primary);
}

/* Section header — visually delimits each category group */
.faq-section {
    margin-bottom: 2.5rem;
    --cat-color: var(--accent);
}
.faq-section--hidden { display: none; }
.faq-section__header {
    display: flex; align-items: center; gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--cat-color) 12%, var(--bg-card)) 0%,
        var(--bg-card) 100%);
    border: 1px solid color-mix(in srgb, var(--cat-color) 25%, var(--border));
    border-left: 4px solid var(--cat-color);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.faq-section__icon {
    display: inline-flex;
    width: 38px; height: 38px;
    align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--cat-color) 15%, var(--bg-primary));
    color: var(--cat-color);
    border-radius: 10px;
    flex-shrink: 0;
}
.faq-section__icon svg { width: 20px; height: 20px; }
.faq-section__title {
    flex: 1;
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.faq-section__count {
    flex-shrink: 0;
    padding: 0.18rem 0.6rem;
    background: color-mix(in srgb, var(--cat-color) 18%, var(--bg-primary));
    color: var(--cat-color);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    font-feature-settings: "tnum";
}
.faq-section__items {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* Q&A items — left border in category color */
.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid color-mix(in srgb, var(--cat-color) 60%, var(--border));
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    scroll-margin-top: 130px;
    --cat-color: var(--accent);
}
.faq-item:hover {
    border-color: color-mix(in srgb, var(--cat-color) 35%, var(--border));
    border-left-color: var(--cat-color);
    transform: translateX(2px);
}
.faq-item[open] {
    border-color: var(--cat-color);
    border-left-color: var(--cat-color);
    border-left-width: 3px;
    box-shadow: 0 4px 16px -8px color-mix(in srgb, var(--cat-color) 50%, transparent);
    transform: translateX(2px);
}
.faq-item--hidden { display: none !important; }
.faq-item--highlight { animation: faqPulse 1.6s ease-out; }
@keyframes faqPulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cat-color) 50%, transparent); }
    70%  { box-shadow: 0 0 0 12px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.faq-item__q {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none;
    user-select: none;
}
.faq-item__q::-webkit-details-marker { display: none; }
.faq-item__icon {
    display: inline-flex;
    width: 32px; height: 32px;
    align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--cat-color) 14%, transparent);
    color: var(--cat-color);
    border-radius: 9px;
    flex-shrink: 0;
}
.faq-item__icon svg { width: 16px; height: 16px; }
.faq-item__q-text {
    flex: 1;
    font-size: 0.96rem;
    line-height: 1.4;
}
.faq-item__chevron {
    flex-shrink: 0;
    width: 22px; height: 22px;
    color: var(--text-tertiary);
    transition: transform 0.2s, color 0.15s;
}
.faq-item__chevron svg { width: 22px; height: 22px; }
.faq-item[open] .faq-item__chevron {
    transform: rotate(180deg);
    color: var(--cat-color);
}

.faq-item__a {
    padding: 0 1.25rem 1.1rem 3.95rem;
    color: var(--text-secondary);
    line-height: 1.65;
    font-size: 0.93rem;
}
.faq-item__a p { margin: 0 0 0.6rem; }
.faq-item__a p:last-child { margin-bottom: 0; }
.faq-item__link {
    display: inline-flex;
    align-items: center;
    margin-top: 0.7rem;
    color: var(--cat-color);
    font-weight: 600;
    font-size: 0.86rem;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}
.faq-item__link:hover { border-bottom-color: var(--cat-color); }

/* Empty state */
.faq-empty {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--text-secondary);
}
.faq-empty svg {
    width: 48px; height: 48px;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}
.faq-empty h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}
.faq-empty p {
    margin: 0;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* ===== CTA ===== */
.faq-cta {
    padding: 3rem 0 5rem;
    background: var(--bg-primary);
}
.faq-cta__inner {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent) 8%, var(--bg-card)) 0%,
        var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2.75rem 2rem;
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
}
.faq-cta__icon {
    width: 44px; height: 44px;
    color: var(--accent);
    margin-bottom: 0.75rem;
}
.faq-cta__inner h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.6rem;
}
.faq-cta__inner p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1.75rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}
.faq-cta__actions {
    display: flex; gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}
.faq-cta__btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.85rem 1.4rem;
    border-radius: 12px;
    font-size: 0.92rem; font-weight: 600;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.faq-cta__btn svg { width: 18px; height: 18px; }
.faq-cta__btn--whatsapp {
    background: #25d366;
    color: white;
    box-shadow: 0 6px 18px -8px rgba(37, 211, 102, 0.55);
}
.faq-cta__btn--whatsapp:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -10px rgba(37, 211, 102, 0.7); }
.faq-cta__btn--secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.faq-cta__btn--secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 760px) {
    .faq-hero { padding: 5.5rem 0 3.5rem; }
    .faq-hero__beam { width: 80%; height: 60%; }
    .faq-hero__dots { background-size: 20px 20px; }
    .faq-search__input { padding: 1rem 4.25rem 1rem 3rem; font-size: 0.95rem; }
    .faq-search__icon { left: 1rem; width: 18px; height: 18px; }
    .faq-search__kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .faq-hero__aurora { animation: none; }
    .faq-hero__eyebrow-dot { animation: none; }
}
@media (max-width: 640px) {
    .faq-cats { top: 56px; }
    .faq-section { margin-bottom: 1.75rem; }
    .faq-section__header { padding: 0.7rem 0.85rem; gap: 0.55rem; }
    .faq-section__icon { width: 32px; height: 32px; }
    .faq-section__icon svg { width: 16px; height: 16px; }
    .faq-section__title { font-size: 0.98rem; }
    .faq-item__q { padding: 0.85rem 1rem; gap: 0.6rem; }
    .faq-item__icon { width: 28px; height: 28px; border-radius: 8px; }
    .faq-item__icon svg { width: 14px; height: 14px; }
    .faq-item__q-text { font-size: 0.9rem; }
    .faq-item__a { padding: 0 1rem 1rem 3.05rem; font-size: 0.88rem; }
    .faq-cta__inner { padding: 2rem 1.25rem; }
    .faq-cta__actions { flex-direction: column; align-items: stretch; }
    .faq-cta__btn { justify-content: center; }
}

/* ===== RTL (Arabic) ===== */
[dir="rtl"] .faq-search__icon { left: auto; right: 1.25rem; }
[dir="rtl"] .faq-search__input { padding: 1.15rem 3.4rem 1.15rem 6.5rem; text-align: right; }
[dir="rtl"] .faq-search__kbd { right: auto; left: 1rem; }
[dir="rtl"] .faq-search__clear { right: auto; left: 1rem; }
[dir="rtl"] .faq-item__a { padding: 0 4.1rem 1.25rem 1.25rem; }
[dir="rtl"] .faq-item[open] .faq-item__chevron { transform: rotate(-180deg); }
