/**
 * FR Publishing FAQ Block Styles
 * Pure CSS accordion with checkbox hack
 */

.frpublishing-faq-block {
    margin: 2rem 0;
}

.faq-item {
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s ease;
}

.faq-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Hide the checkbox */
.faq-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Question label (clickable) */
.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
    transition: background-color 0.2s ease;
}

.faq-question:hover {
    background-color: #f8f8f8;
}

.faq-question-text {
    flex: 1;
    padding-right: 1rem;
}

/* Icon (plus/minus indicator) */
.faq-icon {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.faq-icon::before,
.faq-icon::after {
    content: '';
    position: absolute;
    background-color: #666;
    transition: transform 0.3s ease;
}

/* Horizontal line */
.faq-icon::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

/* Vertical line (becomes horizontal when open) */
.faq-icon::after {
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

/* When checked, rotate the vertical line to make it horizontal (creating a minus) */
.faq-toggle:checked + .faq-question .faq-icon::after {
    transform: translateX(-50%) rotate(90deg);
}

/* Answer container */
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
}

/* Answer content */
.faq-answer-content {
    padding: 0 1.5rem;
    color: #555;
    line-height: 1.6;
}

/* When checkbox is checked, show the answer */
.faq-toggle:checked ~ .faq-answer {
    max-height: 1000px; /* Large enough to fit most content */
    padding: 1rem 0;
}

/* Accessibility: Focus styles */
.faq-toggle:focus + .faq-question {
    outline: 1px solid #e0e0e0;
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .faq-question {
        padding: 1rem;
        font-size: 1rem;
    }

    .faq-answer-content {
        padding: 0 1rem;
        font-size: 0.95rem;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .faq-item {
        background: #2a2a2a;
        border-color: #444;
    }

    .faq-question {
        color: #e0e0e0;
    }

    .faq-question:hover {
        background-color: #333;
    }

    .faq-answer-content {
        color: #ccc;
    }

    .faq-icon::before,
    .faq-icon::after {
        background-color: #999;
    }
}
