/* ── Document List widget ────────────────────────────────────────────── */

.magic-doc-list .doc-section + .doc-section {
    margin-top: 2rem;
}

.magic-doc-list .doc-section-title {
    margin: 0 0 1rem;
}

.magic-doc-list .doc-category + .doc-category {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.magic-doc-list .doc-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s ease;
}

.magic-doc-list .doc-category-chevron {
    flex: none;
    width: 0.5em;
    height: 0.5em;
    margin-left: 1rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.magic-doc-list .doc-category-header[aria-expanded="true"] .doc-category-chevron {
    transform: rotate(-135deg);
}

/* JS removes nothing here — the grid-rows collapse is pure CSS, gated by aria-expanded */
.magic-doc-list .doc-category-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
}

.magic-doc-list .doc-category-header[aria-expanded="true"] + .doc-category-panel {
    grid-template-rows: 1fr;
}

.magic-doc-list .doc-category-panel-inner {
    overflow: hidden;
}

.magic-doc-list .doc-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
}

.magic-doc-list .doc-row:first-child {
    border-top: none;
}

.magic-doc-list .doc-row:nth-child(even) {
    background: #dbe1e947;
}

.magic-doc-list .doc-row-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.magic-doc-list .doc-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.magic-doc-list .doc-language-badge {
    flex: none;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    background: #eee;
    font-size: 0.75em;
    font-weight: bold;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.magic-doc-list .doc-date {
    flex: none;
    color: #666;
    font-size: 0.85em;
}

.magic-doc-list .doc-action {
    flex: none;
    padding: 0.4em 1em;
    border: 1px solid #00B5E2;
    background: #00B5E2;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    margin-left: auto;
    text-decoration: none;
    text-align: center;
}

.magic-doc-list .doc-action:hover {
    opacity: 0.9;
}

@media all and (min-width: 768px) {
    .magic-doc-list .doc-row-main {
        width: auto;
    }
    .magic-doc-list .doc-action {
        margin-left: 0;
    }
}
