/**
 * FAQ Categories Component Styles
 * Accessible accordion with category selector
 * Theme-aware with light/dark mode support
 */

/* ===================================
   FAQ Container
   =================================== */

.faq-section {
    background: var(--map-surface);
    position: relative;
}

.faq-container {
    max-width: 900px;
    margin: 0 auto;
}

/* ===================================
   Search Bar
   =================================== */

.faq-search-wrapper {
    margin-bottom: 2rem;
}

.faq-search-wrapper .form-control {
    padding: 0.75rem 1rem 0.75rem 3rem;
    border-radius: var(--map-radius-md);
    border: 2px solid var(--map-border);
    background: var(--map-surface-raised);
    color: var(--map-text);
    font-size: 1.125rem;
    transition: all 0.2s ease;
}

.faq-search-wrapper .form-control::placeholder {
    color: var(--map-text-subtle);
    opacity: 0.6;
}

.faq-search-wrapper .form-control:focus {
    border-color: var(--map-color-brand);
    box-shadow: 0 0 0 0.25rem rgba(var(--map-color-brand-rgb), 0.1);
    outline: none;
}

.faq-search-wrapper .material-icons {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--map-text-subtle);
    pointer-events: none;
}

/* ===================================
   Category Selector
   =================================== */

.faq-category-selector {
    margin-bottom: 2rem;
}

.faq-category-selector .form-select {
    border: 2px solid var(--map-border);
    border-radius: var(--map-radius-md);
    background: var(--map-surface-raised);
    color: var(--map-text);
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.faq-category-selector .form-select:hover {
    border-color: var(--map-color-brand);
}

.faq-category-selector .form-select:focus {
    border-color: var(--map-color-brand);
    box-shadow: 0 0 0 0.25rem rgba(var(--map-color-brand-rgb), 0.1);
    outline: none;
}

.faq-category-selector .form-label {
    color: var(--map-text);
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: block;
}

/* ===================================
   Category Header
   =================================== */

.faq-category-header {
    padding: 1.5rem 0;
    border-bottom: 2px solid var(--map-border);
}

.faq-category-icon {
    font-size: 3rem;
    color: var(--map-color-brand);
    display: block;
    margin-bottom: 1rem;
}

.faq-category-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--map-text);
    margin-bottom: 0.5rem;
}

/* ===================================
   FAQ List
   =================================== */

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

/* ===================================
   FAQ Item (Accordion)
   =================================== */

.faq-item {
    background: var(--map-surface-raised);
    border: 2px solid var(--map-border);
    border-radius: var(--map-radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

.faq-item:hover {
    border-color: var(--map-color-brand);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Question Button */
.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.faq-question:hover {
    background: rgba(var(--map-color-brand-rgb), 0.05);
}

.faq-question:focus {
    outline: 2px solid var(--map-color-brand);
    outline-offset: -2px;
}

.faq-question-text {
    flex: 1;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--map-text);
    line-height: 1.5;
}

.faq-toggle-icon {
    flex-shrink: 0;
    color: var(--map-color-brand);
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-toggle-icon {
    transform: rotate(180deg);
}

/* Answer Content */
.faq-answer {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.faq-answer:not([hidden]) {
    max-height: 2000px; /* Large enough for any content */
}

.faq-answer-content {
    padding: 0 1.5rem 1.5rem 1.5rem;
    color: var(--map-text-subtle);
    line-height: 1.7;
}

.faq-answer-content p {
    margin-bottom: 1rem;
}

.faq-answer-content p:last-child {
    margin-bottom: 0;
}

/* No Results State */
.faq-no-results {
    padding: 3rem 1rem;
}

.faq-no-results .material-icons {
    color: var(--map-text-subtle);
    opacity: 0.5;
}

/* ===================================
   Dark Mode Overrides
   =================================== */

:root[data-bs-theme="dark"] .faq-section {
    background: var(--map-surface);
}

:root[data-bs-theme="dark"] .faq-search-wrapper .form-control,
:root[data-bs-theme="dark"] .faq-category-selector .form-select,
:root[data-bs-theme="dark"] .faq-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--map-text);
}

:root[data-bs-theme="dark"] .faq-search-wrapper .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

:root[data-bs-theme="dark"] .faq-search-wrapper .form-control:focus,
:root[data-bs-theme="dark"] .faq-category-selector .form-select:focus {
    border-color: var(--map-color-brand);
    background: rgba(255, 255, 255, 0.08);
}

:root[data-bs-theme="dark"] .faq-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--map-color-brand);
}

:root[data-bs-theme="dark"] .faq-question:hover {
    background: rgba(var(--map-color-brand-rgb), 0.1);
}

:root[data-bs-theme="dark"] .faq-category-selector .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    .faq-question-text {
        font-size: 1rem;
    }

    .faq-question {
        padding: 1rem 1.25rem;
    }

    .faq-answer-content {
        padding: 0 1.25rem 1.25rem 1.25rem;
        font-size: 0.9375rem;
    }

    .faq-category-title {
        font-size: 1.5rem;
    }

    .faq-category-icon {
        font-size: 2.5rem;
    }
}

/* ===================================
   Accessibility
   =================================== */

@media (prefers-reduced-motion: reduce) {
    .faq-toggle-icon,
    .faq-answer,
    .faq-item,
    .faq-question {
        transition: none;
    }
}

/* Focus visible for keyboard navigation */
.faq-question:focus-visible {
    outline: 3px solid var(--map-color-brand);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .faq-item {
        border-width: 3px;
    }

    .faq-question:focus {
        outline-width: 3px;
    }
}

/* Print styles */
@media print {
    .faq-search-wrapper,
    .faq-category-selector {
        display: none;
    }

    .faq-answer {
        max-height: none !important;
    }

    .faq-answer[hidden] {
        display: block !important;
    }

    .faq-toggle-icon {
        display: none;
    }

    .faq-item {
        page-break-inside: avoid;
        border: 1px solid #000;
        margin-bottom: 1rem;
    }
}
