/* ============================================================
 * cards.css — Universal Card + Grid System
 * Threshold Admin — reusable across all tabs
 * ============================================================ */

/* ── Base Card ─────────────────────────────────────────────── */

.thx-card {
    background: var(--bg-item-tint, rgba(255,255,255,0.08));
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: var(--radius-lg, 10px);
    padding: 14px 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* ── Card Header (clickable, contains title + chevron) ───── */

.thx-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    gap: 8px;
}

.thx-card-header-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-secondary, #d8dee9);
    font-weight: 600;
    flex: 1;
}

.thx-card-header-chevron {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--fg-dim, #6b7589);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

/* ── Card Body (collapsible) ─────────────────────────────── */

.thx-card-body {
    margin-top: 10px;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
    max-height: 2000px;
    opacity: 1;
}

/* ── Collapsed State ─────────────────────────────────────── */

.thx-card--collapsed .thx-card-header-chevron {
    transform: rotate(-90deg);
}

.thx-card--collapsed .thx-card-body {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

/* ── Size Variants ───────────────────────────────────────── */

.thx-card--compact {
    padding: 10px 12px;
}
.thx-card--compact .thx-card-header-title {
    font-size: 10px;
}
.thx-card--compact .thx-card-body {
    margin-top: 6px;
}

.thx-card--large {
    padding: 18px 20px;
}
.thx-card--large .thx-card-header-title {
    font-size: 12px;
}
.thx-card--large .thx-card-body {
    margin-top: 12px;
}

/* ── Width Variants (inside .thx-grid) ───────────────────── */

.thx-card--wide {
    grid-column: 1 / -1;
}

.thx-card--full {
    width: 100%;
}

/* ── Grid Container ──────────────────────────────────────── */

.thx-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 780px;
}

/* Manual column overrides */
.thx-grid--1col { grid-template-columns: 1fr; max-width: 400px; }
.thx-grid--2col { grid-template-columns: 1fr 1fr; max-width: 520px; }
.thx-grid--3col { grid-template-columns: 1fr 1fr 1fr; max-width: 780px; }

/* ── Collapsible Sub-sections (inside cards) ─────────────── */

.thx-subsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    padding: 4px 0;
    gap: 6px;
}

.thx-subsection-body {
    overflow: hidden;
    transition: max-height 0.2s ease, opacity 0.15s ease;
    max-height: 1000px;
    opacity: 1;
}

.thx-subsection--collapsed .thx-subsection-header .thx-card-header-chevron {
    transform: rotate(-90deg);
}

.thx-subsection--collapsed .thx-subsection-body {
    max-height: 0;
    opacity: 0;
}

/* ── Responsive Breakpoints ──────────────────────────────── */

@media (max-width: 500px) {
    .thx-grid {
        grid-template-columns: 1fr !important;
        max-width: 100% !important;
    }
    .thx-card--wide {
        grid-column: 1;
    }
}

@media (min-width: 501px) and (max-width: 549px) {
    .thx-grid:not(.thx-grid--1col):not(.thx-grid--3col) {
        grid-template-columns: 1fr 1fr;
        max-width: 520px;
    }
}
