/*
 * Foldable box component.
 *
 * A collapsible card built on <details>/<summary>.
 * Self-contained: works in any context without parent class dependencies.
 *
 * Usage:
 *   <details class="dlg-box" open>
 *     <summary class="dlg-box-header">Title</summary>
 *     <div class="dlg-box-body">Content here</div>
 *   </details>
 *
 * Variants:
 *   .dlg-box--accent   Accent-colored header
 */


/* ── Base box ────────────────────────────────────────────── */

details.dlg-box {
    border-radius: 8px;
    background: var(--app-bg-secondary, #f9f9f9);
    overflow: hidden;
}

details.dlg-box[hidden] {
    display: none;
}

details.dlg-box > summary.dlg-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    cursor: pointer;
    list-style: none;
    font-family: var(--app-font-primary, "Geist", sans-serif);
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    color: var(--app-text-primary, rgba(17, 24, 39, 0.87));
}

details.dlg-box > summary.dlg-box-header::-webkit-details-marker {
    display: none;
}

details.dlg-box > summary.dlg-box-header::marker {
    content: "";
}


/* Chevron indicator */
details.dlg-box > summary.dlg-box-header::after {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

details.dlg-box:not([open]) > summary.dlg-box-header::after {
    transform: rotate(-90deg);
}

.dlg-box-body {
    padding: 0 20px 16px;
}

/* ── Accent variant ──────────────────────────────────────── */

details.dlg-box--accent > summary.dlg-box-header {
    background: rgba(20, 27, 155, 0.11);
    border-radius: 8px 8px 0 0;
}

details.dlg-box--accent:not([open]) > summary.dlg-box-header {
    border-radius: 8px;
}

details.dlg-box--accent > .dlg-box-body {
    padding: 16px 20px;
}
