/* FAQ Container Wrapper - Native Gutenberg Block */
.wp-block-faq-section-container {
    position: relative;
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* Block selection styling in editor */
.wp-block-editor .wp-block-faq-section-container {
    /* Let WordPress handle the block selection styling */
    margin: 0;
    padding: 0;
    border: none;
    cursor: default;
}

/* Add subtle styling to indicate block boundaries */
.wp-block-editor .wp-block-faq-section-container .faq-section {
    border: 2px dashed transparent;
    border-radius: 8px;
    padding: 10px;
    transition: border-color 0.2s ease;
}

.wp-block-editor .wp-block-faq-section-container:hover .faq-section {
    border-color: rgba(0, 115, 170, 0.3);
}

.wp-block-editor .wp-block-faq-section-container.is-selected .faq-section {
    border-color: var(--wp--preset--color--primary, #0073aa);
}

/* FAQ Section Styles */
.faq-section {
    padding: 80px 20px;
    position: relative;
}

/* Group Container Support */
.wp-block-faq-section-faq-block {
    margin: 2em 0;
    border-radius: 8px;
    overflow: hidden;
}

.wp-block-faq-section-faq-block.alignwide {
    margin: 2em -5em;
}

.wp-block-faq-section-faq-block.alignfull {
    margin: 2em calc(-50vw + 50%);
}

.faq-block-wrapper {
    position: relative;
}

@media (max-width: 768px) {
    .wp-block-faq-section-faq-block.alignwide,
    .wp-block-faq-section-faq-block.alignfull {
        margin-left: -20px;
        margin-right: -20px;
    }
}
.faq-container {
    max-width: 900px;
    margin: 0 auto;
}
.faq-header {
    text-align: center;
    margin-bottom: 50px;
}
.faq-header h2 {
    font-size: 2.8rem;
    font-weight: 700;
    color: #212529;
}
.faq-header h3 {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--wp--preset--color--primary, #0073aa);
    margin-top: 10px;
}
.faq-header p {
    font-size: 1rem;
    color: #6c757d;
    line-height: 1.6;
    margin-top: 15px;
}
.faq-accordion {
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}
.faq-item {
    border-bottom: 1px solid #e9ecef;
}
.faq-item:last-child {
    border-bottom: none;
}
.faq-question {
    width: 100%;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: #343a40;
    transition: background-color 0.2s ease;
}
.faq-question:hover {
    background-color: #f8f9fa;
}
.faq-question .faq-question-title {
    display: flex;
    align-items: center;
}
.faq-question .faq-question-icon {
    font-size: 1.1rem;
    margin-right: 15px;
    width: 20px;
    text-align: center;
    color: var(--wp--preset--color--primary, #0073aa);
}
.faq-toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease-in-out;
    color: var(--wp--preset--color--primary, #0073aa);
}
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out;
    color: #495057;
    font-size: 1rem;
    line-height: 1.7;
    opacity: 0.5;
}

/* Animation Speed Variants */
.animation-slow .faq-answer {
    transition: max-height 0.6s ease-out, opacity 0.45s ease-out;
}

.animation-slow .faq-toggle-icon {
    transition: transform 0.45s ease-in-out;
}

.animation-normal .faq-answer {
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out;
}

.animation-normal .faq-toggle-icon {
    transition: transform 0.3s ease-in-out;
}

.animation-fast .faq-answer {
    transition: max-height 0.2s ease-out, opacity 0.15s ease-out;
}

.animation-fast .faq-toggle-icon {
    transition: transform 0.15s ease-in-out;
}
.faq-question.active + .faq-answer {
    opacity: 1;
}
.faq-answer-content {
    padding: 0 25px 25px 25px;
}
.faq-answer ul {
    list-style: none;
    padding-left: 5px;
    margin-top: 15px;
}
.faq-answer li {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
}
.faq-answer li::before {
    content: "\f058";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--wp--preset--color--primary, #0073aa);
    margin-right: 12px;
    margin-top: 4px;
}
.faq-footer {
    text-align: center;
    margin-top: 50px;
    color: #495057;
}
.faq-footer .faq-conclusion {
    font-weight: 600;
    font-size: 1.2rem;
    color: #343a40;
    margin-bottom: 10px;
}
.faq-footer .faq-cta {
    font-size: 1rem;
    line-height: 1.6;
}

/* Editor-specific styles - Following troubleshooting guide */
.is-editor .faq-section {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

.is-editor .faq-section::before {
    content: 'FAQ Section Block';
    position: absolute;
    top: -10px;
    left: 20px;
    background: white;
    padding: 0 10px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* Inline editing styles */
.is-editor .faq-header h2,
.is-editor .faq-header h3,
.is-editor .faq-header p,
.is-editor .faq-footer p {
    border: 1px dashed transparent;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.is-editor .faq-header h2:hover,
.is-editor .faq-header h3:hover,
.is-editor .faq-header p:hover,
.is-editor .faq-footer p:hover,
.is-editor .faq-header h2:focus,
.is-editor .faq-header h3:focus,
.is-editor .faq-header p:focus,
.is-editor .faq-footer p:focus {
    border-color: var(--wp--preset--color--primary, #0073aa);
    background-color: rgba(0, 115, 170, 0.05);
}

.is-editor .faq-header h2:empty::after,
.is-editor .faq-header h3:empty::after,
.is-editor .faq-header p:empty::after,
.is-editor .faq-footer p:empty::after {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

/* FAQ Item inline editing */
.is-editor .faq-question-title span {
    border: 1px dashed transparent;
    padding: 2px 4px;
    border-radius: 3px;
    display: inline-block;
    min-width: 100px;
}

.is-editor .faq-question-title span:hover,
.is-editor .faq-question-title span:focus {
    border-color: var(--wp--preset--color--primary, #0073aa);
    background-color: rgba(0, 115, 170, 0.05);
}

.is-editor .faq-accordion {
    /* Ensure editor accordion is always visible */
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

.is-editor .faq-item {
    /* Ensure all FAQ items are visible in editor */
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

.is-editor .faq-answer {
    /* Show answers in editor for preview - override frontend animations */
    max-height: none !important;
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    overflow: visible !important;
}

.is-editor .faq-question {
    /* Make editor questions clearly interactive */
    background-color: #f8f9fa;
    cursor: default;
    position: relative;
}

.is-editor .editor-controls {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.is-editor .editor-controls button {
    padding: 6px 10px !important;
    font-size: 12px !important;
    border: 1px solid #ddd !important;
    background: white !important;
    cursor: pointer !important;
    border-radius: 3px !important;
    min-height: auto !important;
    line-height: 1 !important;
}

.is-editor .editor-controls button:hover {
    background-color: #f0f0f0 !important;
}

.is-editor .editor-controls button.is-primary {
    background-color: var(--wp--preset--color--primary, #0073aa) !important;
    color: white !important;
    border-color: var(--wp--preset--color--primary, #0073aa) !important;
}

.is-editor .editor-controls button.is-destructive {
    background-color: #d63638 !important;
    color: white !important;
    border-color: #d63638 !important;
}

.is-editor .faq-editor-panel {
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    border-radius: 5px;
}

.is-editor .faq-editor-panel .components-base-control {
    margin-bottom: 15px;
}

.is-editor .faq-editor-panel .components-select-control__input {
    min-width: 200px;
}

.is-editor .add-faq-button {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

.is-editor .add-faq-button button {
    background-color: var(--wp--preset--color--primary, #0073aa) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-weight: 500 !important;
}

.is-editor .add-faq-button button:hover {
    background-color: #005a87 !important;
}

/* Editor grid styles - separate from frontend */
.is-editor .editor-accordion {
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.is-editor .editor-faq-item {
    border-bottom: 1px solid #e9ecef;
    opacity: 1 !important;
    transform: none !important;
}

.is-editor .editor-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #fafafa;
    border-bottom: 1px solid #eee;
}

.is-editor .editor-answer {
    padding: 15px 20px;
    background-color: white;
    max-height: none !important;
    overflow: visible !important;
    opacity: 1 !important;
}

/* Responsive styles */
@media (max-width: 768px) {
    .faq-section {
        padding: 40px 15px;
    }
    
    .faq-header h2 {
        font-size: 2.2rem;
    }
    
    .faq-header h3 {
        font-size: 1.3rem;
    }
    
    .faq-question {
        padding: 15px 20px;
        font-size: 1rem;
    }
    
    .faq-answer-content {
        padding: 0 20px 20px 20px;
    }
}
