/* ── Content Intelligence (YouTube tab) ───────────────────────────────────
 * Brandbook-compliant classes for the 5-card CI section. Uses existing
 * .glass-card scaffolding plus CI-specific concerns (funnel rows, guest
 * table, retention sparkline, half-life dual-KPI, topic bars).
 *
 * Color tokens (from theme.css :root):
 *   --accent*           accent red family
 *   --text-1 #fff       primary text   |  --text-2 #888  secondary
 *   --text-3 #555       tertiary/footnote
 *   --surface-3 .06     bar track / divider
 *   --surface-4 .04     hairline border / muted bar track
 * No raw hex in this file — all colors flow through tokens.
 */

/* ── Section header ───────────────────────────────────────────────────── */
.ci-new-badge {
    font-size: 9px;
    font-weight: 900;
    color: var(--text-2);
    letter-spacing: 0.2em;
    margin-left: 6px;
    text-transform: uppercase;
}

/* ── Card scaffolding (used by every CI sub-card) ─────────────────────── */
.ci-card {
    margin-bottom: 24px;
}
.ci-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    gap: 14px;
    flex-wrap: wrap;
}
.ci-card-title {
    font-size: 12px;
    font-weight: 900;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}
.ci-card-subtitle {
    font-size: 10px;
    color: var(--text-2);
    margin-top: 4px;
}
.ci-pill-badge {
    font-size: 9px;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: 5px 12px;
}

/* ── Loading / empty states ───────────────────────────────────────────── */
.ci-loading,
.ci-no-data {
    color: var(--text-3);
    font-size: 12px;
    padding: 8px 0;
}

/* ── Two-card row (Retention + Half-life side by side) ────────────────── */
.ci-two-up {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

/* ── Disclaimer footer ────────────────────────────────────────────────── */
.ci-disclaimer {
    font-size: 9px;
    color: var(--text-3);
    text-align: right;
    margin-top: 10px;
    font-style: italic;
}

/* ─────────────────────────────────────────────────────────────────────── *
 * Card 1 — Crossover (Shorts → Long-form)
 * ─────────────────────────────────────────────────────────────────────── */
.ci-cross-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 32px;
    align-items: start;
}
.ci-cross-hero {
    min-width: 140px;
}
.ci-cross-hero__pct {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.05em;
}
.ci-cross-hero__caption {
    font-size: 10px;
    color: var(--text-2);
    margin-top: 8px;
    max-width: 170px;
    line-height: 1.4;
}
.ci-cross-row {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr 70px;
    gap: 14px;
    align-items: center;
    margin-bottom: 10px;
}
.ci-cross-row__label {
    font-size: 12px;
    color: var(--text-2);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ci-cross-row__bar {
    height: 14px;
    background: var(--surface-3);
    border-radius: 3px;
    overflow: hidden;
}
.ci-cross-row__fill {
    height: 100%;
    transition: width 0.4s ease;
}
.ci-cross-row__fill--primary   { background: var(--accent); }
.ci-cross-row__fill--secondary { background: var(--accent-border); }
.ci-cross-row__fill--tertiary  { background: var(--accent-soft); }
.ci-cross-row__value {
    font-size: 13px;
    font-weight: 900;
    color: var(--text-1);
    text-align: right;
}
/* Mobile: collapse 3-col grid to 1-col so 200px label doesn't crowd the
   bar; label takes full row above bar+number. */
@media (max-width: 480px) {
    .ci-cross-grid { grid-template-columns: 1fr; gap: 16px; }
    .ci-cross-row  { grid-template-columns: 1fr 70px; gap: 8px; }
    .ci-cross-row__label { grid-column: 1 / -1; }
}

/* ─────────────────────────────────────────────────────────────────────── *
 * Card 2 — Performance by Guest (sortable table)
 * ─────────────────────────────────────────────────────────────────────── */
.ci-guests-scroll {
    position: relative;
    overflow-x: auto;
}
.ci-guests-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}
.ci-guests-table th {
    padding: 8px 12px;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-align: left;
}
.ci-guests-table .th--num { text-align: right; }
.ci-guests-table tr {
    border-top: 1px solid var(--surface-4);
}
.ci-guests-table td {
    padding: 11px 12px;
    font-size: 13px;
    color: var(--text-1);
}
.ci-guests-table .td--num { text-align: right; }
.ci-guests-table .td--guest {
    font-weight: 900;
    color: var(--text-1);
    letter-spacing: 0.04em;
}
.ci-guests-table .td--bold {
    font-weight: 900;
    color: var(--text-1);
}
.ci-guests-table .tr--leader td          { color: var(--accent); }
.ci-guests-table .tr--leader .td--guest  { color: var(--accent); }
.ci-guests-table .tr--leader .td--bold   { color: var(--accent); }
.ci-leader-marker {
    color: var(--accent);
    font-size: 11px;
    margin-left: 4px;
}
@media (max-width: 640px) {
    .ci-guests-scroll::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 32px;
        height: 100%;
        background: linear-gradient(to left, var(--surface-2), transparent);
        pointer-events: none;
    }
}

/* ─────────────────────────────────────────────────────────────────────── *
 * Card 3 — Retention drop-off (minutes)
 * ─────────────────────────────────────────────────────────────────────── */
.ci-retention-hero {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    align-items: start;
}
.ci-retention-hero__pct {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.05em;
}
.ci-retention-hero__caption {
    font-size: 11px;
    color: var(--text-2);
    line-height: 1.4;
    padding-top: 8px;
}
.ci-retention-chart {
    display: block;
    margin-top: 12px;
    overflow: visible;
    width: 100%;
}
.ci-retention-dropoffs {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}
.ci-dropoff {
    font-size: 10px;
    color: var(--text-2);
}
.ci-dropoff__timecode {
    color: var(--text-1);
    font-weight: 900;
}

/* ─────────────────────────────────────────────────────────────────────── *
 * Card 4 — Half-life (two KPIs + progress vs avg interval)
 * ─────────────────────────────────────────────────────────────────────── */
.ci-halflife-row {
    display: flex;
    gap: 32px;
    margin-bottom: 18px;
}
.ci-halflife-stat__num {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-1);
    line-height: 1;
    letter-spacing: -0.05em;
}
.ci-halflife-stat__suffix {
    font-size: 0.9rem;
    color: var(--accent);
    margin-left: 4px;
    letter-spacing: 0.05em;
}
.ci-halflife-stat__label {
    font-size: 10px;
    color: var(--text-2);
    margin-top: 6px;
}
.ci-halflife-progress {
    height: 6px;
    background: var(--surface-3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.ci-halflife-progress__fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.4s ease;
}
.ci-halflife-footer {
    font-size: 10px;
    color: var(--text-3);
}
.ci-halflife-footer__value {
    color: var(--text-1);
    font-weight: 900;
}

/* ─────────────────────────────────────────────────────────────────────── *
 * Card 5 — Topic performance (horizontal bars)
 * ─────────────────────────────────────────────────────────────────────── */
.ci-topic {
    margin-bottom: 18px;
}
.ci-topic__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
    gap: 12px;
}
.ci-topic__name {
    font-size: 13px;
    color: var(--text-1);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}
.ci-topic__stats {
    font-size: 11px;
    color: var(--accent);
    font-weight: 900;
    white-space: nowrap;
    flex-shrink: 0;
}
.ci-topic__bar {
    height: 8px;
    background: var(--surface-4);
    border-radius: 3px;
    overflow: hidden;
}
.ci-topic__fill {
    height: 100%;
    transition: width 0.4s ease;
}
.ci-topic__fill--rank-1 { background: var(--accent); }
.ci-topic__fill--rank-2 { background: var(--accent-border); }
.ci-topic__fill--rank-3 { background: var(--accent-soft); }
