/**
 * Details Block Component
 * Styling for WordPress native details/summary accordion block
 * Matches Figma design: https://www.figma.com/design/8DyWLmP4nMWiaYhaBiYls6/Besrami-Dev
 */

/* Base Details Block Styling */
.wp-block-details {
    background-color: #fbfaf9;
    border: 1px solid #ebebeb;
    border-radius: 8px;
    margin-bottom: 25px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.wp-block-details:last-child {
    margin-bottom: 0;
}

/* Summary (Clickable Header) Styling */
.wp-block-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 26px;
    font-family: 'Urbanist', sans-serif;
    font-size: 22px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.1;
    color: #333857;
    letter-spacing: -0.0533px;
    cursor: pointer;
    list-style: none;
    position: relative;
    transition: all 0.3s ease;
}

/* Remove default marker/arrow */
.wp-block-details summary::-webkit-details-marker,
.wp-block-details summary::marker {
    display: none;
}

/* Custom Chevron Icon */
.wp-block-details summary::after {
    content: '';
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23333857' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform 0.3s ease;
    margin-left: 16px;
}

/* Rotate chevron when open */
.wp-block-details[open] summary::after {
    transform: rotate(180deg);
}

/* Hover state */
.wp-block-details summary:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Keep background when open */
.wp-block-details[open] summary {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Focus state for accessibility */
.wp-block-details summary:focus {
    outline: 2px solid #67d3e4;
    outline-offset: -2px;
}

.wp-block-details summary:focus:not(:focus-visible) {
    outline: none;
}

.wp-block-details summary:focus-visible {
    outline: 2px solid #67d3e4;
    outline-offset: -2px;
}

/* Content Area */
.wp-block-details__content,
.wp-block-details > *:not(summary) {
    padding: 15px 26px 24px 26px;
    font-family: 'Urbanist', sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: rgba(0, 0, 0, 0.8);
}

/* Smooth content reveal animation */
.wp-block-details[open] .wp-block-details__content,
.wp-block-details[open] > *:not(summary) {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Nested content spacing */
.wp-block-details__content > *:first-child,
.wp-block-details > *:not(summary):first-of-type {
    margin-top: 0;
}

.wp-block-details__content > *:last-child,
.wp-block-details > *:not(summary):last-child {
    margin-bottom: 0;
}

/* Support for paragraphs within content */
.wp-block-details__content p,
.wp-block-details > p {
    margin-bottom: 16px;
}

.wp-block-details__content p:last-child,
.wp-block-details > p:last-child {
    margin-bottom: 0;
}

/* Responsive Styles */

/* Tablet and below */
@media (max-width: 991px) {
    .wp-block-details summary {
        font-size: 20px;
        padding: 20px 22px;
    }

    .wp-block-details summary::after {
        width: 22px;
        height: 22px;
        margin-left: 12px;
    }

    .wp-block-details__content,
    .wp-block-details > *:not(summary) {
        padding: 15px 22px 20px 22px;
        font-size: 17px;
    }

    .wp-block-details {
        margin-bottom: 20px;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .wp-block-details summary {
        font-size: 18px;
        padding: 18px 20px;
    }

    .wp-block-details summary::after {
        width: 20px;
        height: 20px;
        margin-left: 10px;
    }

    .wp-block-details__content,
    .wp-block-details > *:not(summary) {
        padding: 15px 20px 18px 20px;
        font-size: 16px;
    }

    .wp-block-details {
        margin-bottom: 16px;
        border-radius: 6px;
    }
}

/* Editor Specific Styles (Gutenberg) */
.editor-styles-wrapper .wp-block-details {
    margin-top: 0;
}

.editor-styles-wrapper .wp-block-details summary {
    user-select: none;
}
