/* AI FAQ Frontend Styles */

/* Base Container */
.ai-faq-container {
    margin: 24px auto;
    width: 100%;
    max-width: 1100px;
    background: #ffffff;
    border-radius: 4px;
    overflow: hidden;
}

/* Ensure consistent sizing so paddings/borders don't change width */
.ai-faq-container, .ai-faq-container * {
    box-sizing: border-box;
}

.ai-faq-title {
    margin: 0 0 20px 0;
    padding: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

/* FAQ Items Base */
.ai-faq-items {
    display: block;
}

.ai-faq-item {
    margin-bottom: 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.3s ease;
}

.ai-faq-item:last-child {
    margin-bottom: 0;
}

.ai-faq-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== ACCORDION STYLE ===== */
/* Question Button for Accordion (toggleable) */
.ai-faq-accordion .ai-faq-toggle-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    position: relative;
    overflow: hidden;
}

/* Keep answer the same width as question */
.ai-faq-accordion .ai-faq-answer {
    width: 100%;
}

.ai-faq-accordion .ai-faq-toggle-button:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-faq-accordion .ai-faq-toggle-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.ai-faq-accordion .ai-faq-question-text {
    flex: 1;
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Answer for Accordion - CRITICAL: Remove display:none to allow smooth transitions */
.ai-faq-accordion .ai-faq-answer {
    max-height: 0;
    padding: 0 15px;
    background: #fff;
    border-top: 1px solid #eee;
    color: #666;
    line-height: 1.6;
    transform-origin: top;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: max-height, opacity, padding;
}

.ai-faq-accordion .ai-faq-item.active .ai-faq-answer {
    max-height: 1000px; /* Large enough to accommodate any content */
    padding: 15px;
    opacity: 1;
}

/* Toggle Icon for Accordion */
.ai-faq-accordion .ai-faq-toggle-icon {
    font-size: 18px;
    font-weight: bold;
    color: #666;
    margin-left: 10px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 20px;
    text-align: center;
    will-change: transform;
}

.ai-faq-accordion .ai-faq-item.active .ai-faq-toggle-icon {
    color: #2196f3;
    /* transform: rotate(180deg); */
}

/* Focus states for accessibility */
.ai-faq-accordion .ai-faq-toggle-button:focus-visible {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.1);
}

/* Override any conflicting styles from layout settings */
.ai-faq-accordion .ai-faq-answer {
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden !important;
    will-change: max-height, opacity, padding !important;
}

.ai-faq-accordion .ai-faq-item:not(.active) .ai-faq-answer {
    max-height: 0 !important;
    padding: 0 15px !important;
    opacity: 0 !important;
}

.ai-faq-accordion .ai-faq-item.active .ai-faq-answer {
    max-height: 1000px !important;
    padding: 15px !important;
    opacity: 1 !important;
}

/* ===== TOGGLE STYLE ===== */
/* Hidden checkbox for toggle style */
.ai-faq-toggle .ai-faq-toggle-input {
    display: none;
}

/* Label acts as clickable button for toggle style */
.ai-faq-toggle .ai-faq-toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px;
    background: #f8f9fa;
    cursor: pointer;
    text-align: left;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

/* Keep toggle answer the same width as label */
.ai-faq-toggle .ai-faq-toggle-answer {
    width: 100%;
}

.ai-faq-toggle .ai-faq-toggle-label:hover {
    background: #e9ecef;
}

.ai-faq-toggle .ai-faq-toggle-label:focus {
    box-shadow: inset 0 0 0 2px #0073aa;
}

.ai-faq-toggle .ai-faq-question-text {
    flex: 1;
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* Answer for Toggle (initially hidden, shown when checkbox checked) */
.ai-faq-toggle .ai-faq-toggle-answer {
    display: none;
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
    color: #666;
    line-height: 1.6;
}

.ai-faq-toggle .ai-faq-item.active .ai-faq-toggle-answer {
    display: block;
}

/* Toggle Icon for Toggle Style */
.ai-faq-toggle .ai-faq-toggle-icon {
    font-size: 18px;
    font-weight: bold;
    color: #666;
    margin-left: 10px;
    transition: transform 0.3s ease;
    min-width: 20px;
    text-align: center;
}

/* ===== LIST STYLE ===== */
/* List style layout (no toggles, direct display) */
.ai-faq-list .ai-faq-item {
    padding: 16px 0;
    border-bottom: 1px solid #eaeaea;
    border: none;
    border-radius: 0;
    background: transparent;
    margin-bottom: 0;
}

.ai-faq-list .ai-faq-item:last-child {
    border-bottom: none;
}

.ai-faq-list .ai-faq-list-question {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #222;
    cursor: default;
    padding: 0;
    background: transparent;
    border: none;
    text-align: left;
    width: 100%;
}

.ai-faq-list .ai-faq-list-answer {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    padding: 0;
    background: transparent;
    border: none;
    display: block !important; /* Always visible */
    width: 100%;
}

/* ===== CARDS STYLE ===== */
/* Cards style layout (no toggles, direct display in grid) */
.ai-faq-card-style .ai-faq-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 28px;
    row-gap: 28px;
    column-gap: 28px;
    margin-top: 20px;
    align-items: stretch;
}

.ai-faq-card-style .ai-faq-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #eee;
    box-sizing: border-box;
    overflow: hidden;
}

.ai-faq-card-style .ai-faq-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.ai-faq-card-style .ai-faq-card-question {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #222;
    cursor: default;
    padding: 0;
    background: transparent;
    border: none;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    width: 100%;
}

.ai-faq-card-style .ai-faq-card-answer {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    flex-grow: 1;
    padding: 0;
    background: transparent;
    border: none;
    display: block !important; /* Always visible */
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    width: 100%;
}

@media (max-width: 992px) {
    .ai-faq-card-style .ai-faq-items {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .ai-faq-card-style .ai-faq-items {
        grid-template-columns: 1fr;
    }
}

/* ===== TABS STYLE ===== */
.ai-faq-tabs {
    border: none;
    border-radius: 0;
    background: transparent;
}

.ai-faq-tabs .ai-faq-items {
    display: flex;
    flex-direction: column;
}

.ai-faq-tabs .ai-faq-tab-headers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 2px solid #e5e7eb;
    background: transparent;
    padding: 0 0 8px 0;
    margin-bottom: 0;
}

.ai-faq-tabs .ai-faq-tab-header {
    padding: 12px 20px;
    background: #f8f9fa;
    border: 1px solid #e3e7ee;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    white-space: normal;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.4;
    min-width: 120px;
    text-align: center;
    position: relative;
    overflow: visible;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: none;
    flex: 1 1 auto;
}

.ai-faq-tabs .ai-faq-tab-header:hover {
    background: #e9ecef;
    border-color: #d1d5db;
    color: #111827;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-faq-tabs .ai-faq-tab-header.active {
    background: #ffffff;
    color: #111827;
    font-weight: 600;
    border-color: #0073aa;
    border-bottom-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    z-index: 1;
}

.ai-faq-tabs .ai-faq-tab-contents {
    position: relative;
    margin-top: -1px;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ai-faq-tabs .ai-faq-tab-content {
    padding: 20px;
    display: none;
}

.ai-faq-tabs .ai-faq-tab-content.active {
    display: block;
}

/* ===== SHARED ANSWER CONTENT ===== */
.ai-faq-answer-content {
    margin: 0;
}

.ai-faq-answer p:first-child {
    margin-top: 0;
}

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

/* ===== ANIMATION CLASSES ===== */
/* Slide Animation - Improved for smoother accordion */
.ai-faq-slide .ai-faq-answer:not(.ai-faq-accordion .ai-faq-answer),
.ai-faq-slide .ai-faq-toggle-answer {
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    will-change: height, opacity, transform;
}

/* Enhanced accordion button transitions */
.ai-faq-accordion .ai-faq-toggle-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: background-color, transform;
}

.ai-faq-accordion .ai-faq-toggle-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Enhanced icon transitions */
.ai-faq-accordion .ai-faq-toggle-icon {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.ai-faq-accordion .ai-faq-item.active .ai-faq-toggle-icon {
    /* transform: rotate(180deg); */
}

/* Fade Animation */
.ai-faq-fade .ai-faq-answer,
.ai-faq-fade .ai-faq-toggle-answer {
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity;
}

.ai-faq-fade .ai-faq-item:not(.active) .ai-faq-answer,
.ai-faq-fade .ai-faq-item:not(.active) .ai-faq-toggle-answer {
    opacity: 0;
}

.ai-faq-fade .ai-faq-item.active .ai-faq-answer,
.ai-faq-fade .ai-faq-item.active .ai-faq-toggle-answer {
    opacity: 1;
}

/* Bounce Animation - Improved timing */
.ai-faq-bounce .ai-faq-item.active .ai-faq-answer,
.ai-faq-bounce .ai-faq-item.active .ai-faq-toggle-answer {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-20px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(0);
    }
    70% {
        transform: scale(0.95) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===== ICON STYLES ===== */
/*.ai-faq-icon-plus-minus .ai-faq-toggle-icon::after {
    content: '+';
}*/

body .ai-faq-container .ai-faq-question,
body .ai-faq-container .ai-faq-question:hover,
body .ai-faq-container .ai-faq-question:hover .ai-faq-question-text{
    text-decoration: none !important;
}

.ai-faq-icon-plus-minus .ai-faq-item.active .ai-faq-toggle-icon::after {
    content: '−';
}

.ai-faq-icon-arrow .ai-faq-toggle-icon::after {
    content: '↓';
}

.ai-faq-icon-arrow .ai-faq-item.active .ai-faq-toggle-icon::after {
    content: '↑';
}

.ai-faq-icon-chevron .ai-faq-toggle-icon::after {
    content: '⌄';
}

.ai-faq-icon-chevron .ai-faq-item.active .ai-faq-toggle-icon::after {
    content: '⌃';
}

.ai-faq-icon-caret .ai-faq-toggle-icon::after {
    content: '▼';
}

.ai-faq-icon-caret .ai-faq-item.active .ai-faq-toggle-icon::after {
    content: '▲';
}

/* Icon Position */
.ai-faq-icon-left .ai-faq-toggle-button,
.ai-faq-icon-left .ai-faq-toggle-label {
    flex-direction: row-reverse;
}

.ai-faq-icon-left .ai-faq-toggle-icon {
    margin-left: 0;
    margin-right: 10px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media screen and (max-width: 768px) {
    .ai-faq-container {
        margin: 10px 0;
    }
    
    .ai-faq-title {
        text-align: center;
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .ai-faq-toggle-button,
    .ai-faq-toggle-label {
        padding: 12px;
        font-size: 15px;
    }
    
    .ai-faq-answer,
    .ai-faq-toggle-answer {
        padding: 12px;
        font-size: 14px;
    }
    
    .ai-faq-tabs .ai-faq-tab-headers {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 6px;
        padding-bottom: 6px;
    }
    
    .ai-faq-tabs .ai-faq-tab-header {
        flex: 0 0 auto;
        scroll-snap-align: start;
        white-space: normal;
        min-width: 100px;
        max-width: none;
        font-size: 13px;
        padding: 10px 16px;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
}

@media screen and (max-width: 480px) {
    .ai-faq-title {
        text-align: center;
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .ai-faq-toggle-button,
    .ai-faq-toggle-label {
        padding: 10px;
        font-size: 14px;
    }
    
    .ai-faq-answer,
    .ai-faq-toggle-answer {
        padding: 10px;
        font-size: 13px;
    }
    
    .ai-faq-toggle-icon {
        font-size: 16px;
        min-width: 18px;
    }
    
    .ai-faq-tabs .ai-faq-tab-header {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 80px;
        max-width: none;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .ai-faq-container {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .ai-faq-item {
        border-color: #404040;
        background: #2a2a2a;
    }
    
    .ai-faq-toggle-button,
    .ai-faq-toggle-label {
        background: #333333;
        color: #e0e0e0;
    }
    
    .ai-faq-toggle-button:hover,
    .ai-faq-toggle-label:hover {
        background: #404040;
    }
    
    .ai-faq-answer,
    .ai-faq-toggle-answer {
        background: #2a2a2a;
        color: #cccccc;
        border-top-color: #404040;
    }
    
    .ai-faq-toggle-icon {
        color: #b0b0b0;
    }
    
    .ai-faq-title {
        color: #e0e0e0;
        text-align: center;
    }
    
    /* Dark mode tabs */
    .ai-faq-tabs .ai-faq-tab-headers {
        border-bottom-color: #404040;
    }
    
    .ai-faq-tabs .ai-faq-tab-header {
        background: #333333;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .ai-faq-tabs .ai-faq-tab-header:hover {
        background: #404040;
        border-color: #555555;
        color: #ffffff;
    }
    
    .ai-faq-tabs .ai-faq-tab-header.active {
        background: #2a2a2a;
        border-color: #0073aa;
        color: #ffffff;
    }
    
    .ai-faq-tabs .ai-faq-tab-contents {
        border-color: #404040;
        background: #2a2a2a;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .ai-faq-item {
        border-width: 2px;
        border-color: #000;
    }
    
    .ai-faq-toggle-button,
    .ai-faq-toggle-label {
        background: #fff;
        color: #000;
        border-bottom: 2px solid #000;
    }
    
    .ai-faq-toggle-button:focus,
    .ai-faq-toggle-label:focus {
        box-shadow: inset 0 0 0 3px #000;
        outline: 3px solid #ff0;
        outline-offset: 2px;
    }
    
    .ai-faq-answer,
    .ai-faq-toggle-answer {
        background: #fff;
        color: #000;
        border-top: 2px solid #000;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .ai-faq-container {
        background: transparent !important;
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
    
    .ai-faq-item {
        border: 1px solid #000 !important;
        margin-bottom: 10px !important;
        break-inside: avoid;
    }
    
    .ai-faq-toggle-button,
    .ai-faq-toggle-label {
        background: transparent !important;
        color: #000 !important;
        font-weight: bold !important;
    }
    
    .ai-faq-answer,
    .ai-faq-toggle-answer {
        display: block !important;
        background: transparent !important;
        color: #000 !important;
        border-top: 1px solid #000 !important;
    }
    
    .ai-faq-toggle-icon {
        display: none !important;
    }
    
    .ai-faq-card-style .ai-faq-items {
        display: block !important;
    }
    
    .ai-faq-card-style .ai-faq-card {
        margin-bottom: 15px !important;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .ai-faq-toggle-icon,
    .ai-faq-answer,
    .ai-faq-toggle-answer,
    .ai-faq-item,
    .ai-faq-toggle-button,
    .ai-faq-toggle-label {
        transition: none !important;
        animation: none !important;
    }
    
    .ai-faq-bounce .ai-faq-item.active .ai-faq-answer,
    .ai-faq-bounce .ai-faq-item.active .ai-faq-toggle-answer {
        animation: none !important;
    }
    
    .ai-faq-slide .ai-faq-answer,
    .ai-faq-slide .ai-faq-toggle-answer {
        transition: none !important;
    }
    
    .ai-faq-fade .ai-faq-answer,
    .ai-faq-fade .ai-faq-toggle-answer {
        transition: none !important;
    }
}

/* ===== FOCUS MANAGEMENT ===== */
.ai-faq-toggle-button:focus-visible,
.ai-faq-toggle-label:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ===== LOADING STATE ===== */
.ai-faq-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ai-faq-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== ERROR STATE ===== */
.ai-faq-error {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px 0;
}

.ai-faq-empty {
    padding: 15px;
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    margin: 20px 0;
    text-align: center;
}

/* ===== UTILITY CLASSES ===== */
.ai-faq-hide-icons .ai-faq-toggle-icon {
    display: none !important;
}

.ai-faq-compact .ai-faq-toggle-button,
.ai-faq-compact .ai-faq-toggle-label {
    padding: 10px 15px;
    font-size: 14px;
}

.ai-faq-compact .ai-faq-answer,
.ai-faq-compact .ai-faq-toggle-answer {
    padding: 10px 15px;
    font-size: 13px;
}

.ai-faq-large .ai-faq-toggle-button,
.ai-faq-large .ai-faq-toggle-label {
    padding: 20px;
    font-size: 18px;
}

.ai-faq-large .ai-faq-answer,
.ai-faq-large .ai-faq-toggle-answer {
    padding: 20px;
    font-size: 16px;
}

/* ===== RESPONSIVE CONTAINER WIDTHS ===== */
@media screen and (max-width: 1280px) {
  .ai-faq-container { max-width: 1000px; }
}
@media screen and (max-width: 1024px) {
  .ai-faq-container { max-width: 860px; }
}
@media screen and (max-width: 768px) {
  .ai-faq-container { max-width: 100%; margin: 16px auto; }
}

/**
 * FAQ Groups Frontend Styles
 *
 * @package Logicrays_AI_FAQ_Builder
 */

/* FAQ Container */
.ai-faq-container {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.ai-faq-title {
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #2271b1;
    font-size: 24px;
    color: #333;
}

.ai-faq-items {
    margin: 0;
}

/* FAQ Item */
.ai-faq-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden;
}

.ai-faq-item-active {
    border-color: #2271b1;
}

/* FAQ Question Button */
.ai-faq-question {
    width: 100%;
    background: #f9f9f9;
    border: none;
    padding: 15px 50px 15px 20px;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    position: relative;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-faq-question:hover {
    background: #f0f0f0;
}

.ai-faq-question:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}

.ai-faq-question h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

/* Toggle Icon */
.ai-faq-toggle-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
}

.ai-faq-toggle-icon::before,
.ai-faq-toggle-icon::after {
    content: '';
    position: absolute;
    background: #333;
    transition: transform 0.3s ease;
}

.ai-faq-toggle-icon::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    margin-top: -1px;
}

.ai-faq-toggle-icon::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
}

.ai-faq-question[aria-expanded="true"] .ai-faq-toggle-icon::after {
    transform: rotate(90deg);
    opacity: 0;
}

/* FAQ Answer */
.ai-faq-answer {
    display: none;
    padding: 0;
    background: #fff;
}

.ai-faq-answer-content {
    padding: 20px;
    color: #555;
    line-height: 1.6;
}

.ai-faq-answer-content p:first-child {
    margin-top: 0;
}

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

/* Accordion Style */
.ai-faq-accordion .ai-faq-item {
    border-radius: 0;
    border-bottom: none;
}

.ai-faq-accordion .ai-faq-item:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.ai-faq-accordion .ai-faq-item:last-child {
    border-bottom: 1px solid #ddd;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* List Style */
.ai-faq-list .ai-faq-question {
    background: #fff;
    border-bottom: 1px solid #ddd;
}

.ai-faq-list .ai-faq-item {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
}

/* Cards Style */
.ai-faq-cards .ai-faq-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.ai-faq-cards .ai-faq-item {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-faq-cards .ai-faq-question {
    background: #2271b1;
    color: #fff;
}

.ai-faq-cards .ai-faq-question:hover {
    background: #1a5a8a;
}

.ai-faq-cards .ai-faq-toggle-icon::before,
.ai-faq-cards .ai-faq-toggle-icon::after {
    background: #fff;
}

/* Tabs Style */
.ai-faq-tabs {
    display: flex;
    flex-direction: column;
}

.ai-faq-tabs .ai-faq-items {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.ai-faq-tabs .ai-faq-item {
    flex: 1;
    min-width: 150px;
    border: none;
    border-radius: 0;
    margin: 0;
}

.ai-faq-tabs .ai-faq-question {
    background: #f9f9f9;
    border-right: 1px solid #ddd;
    border-radius: 0;
    padding: 15px;
}

.ai-faq-tabs .ai-faq-question[aria-expanded="true"] {
    background: #2271b1;
    color: #fff;
    border-bottom: 2px solid #2271b1;
    margin-bottom: -2px;
}

.ai-faq-tabs .ai-faq-answer {
    position: absolute;
    width: 100%;
    left: 0;
    z-index: 10;
}

/* Error and Empty States */
.ai-faq-error,
.ai-faq-empty {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    text-align: center;
}

.ai-faq-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-faq-cards .ai-faq-items {
        grid-template-columns: 1fr;
    }
    
    .ai-faq-tabs .ai-faq-items {
        flex-direction: column;
    }
    
    .ai-faq-tabs .ai-faq-question {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
}

/* Keep accordion visible logic safe from legacy .ai-faq-answer rules below */
.ai-faq-accordion .ai-faq-answer {
    display: block !important;
}