/* ============================================================
   Deck Analytics — shared chart + badge vocabulary
   ============================================================
   Output of the shared renderer `js/components/deck-analytics.ts`
   (formation bars, cost curve, trait/effect badges). Consumed by
   BOTH the deck detail modal (`deck-modal-manager.ts`) and the deck
   detail page (`pages/deck/index.ts`), plus the deck-builder's
   Analytics tab — so these rules are intentionally UNSCOPED (no
   `#deckModal` / `.deck-detail-container` prefix), exactly like the
   sibling `deck-card-list.css`.

   Single source of truth: change a chart/badge here and every surface
   updates. Surface-specific sizing (if any) stays as a scoped override
   in that surface's own stylesheet. Loaded globally from index.html.

   Pages that render badges in a *different* context (public-decks /
   my-decks deck tiles, deck-builder analytics pane) scope their own
   `.public-decks-container .trait-badge` etc. and win on specificity —
   they are deliberately NOT governed by this baseline. */

/* ── Formation bars ──
   Per-card-type (and per-colour) horizontal share bars. Also reused by
   the deck-builder Analytics tab pane. */
.dm-formation-bars {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.dm-f-row {
    display: grid;
    grid-template-columns: 64px 1fr 28px;
    align-items: center;
    gap: 8px;
}
.dm-f-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
}
.dm-f-track {
    height: 4px;
    background: rgba(46, 255, 126, 0.08);
    position: relative;
    overflow: hidden;
}
.dm-f-fill {
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dm-f-fill.unit     { background: var(--neon);   box-shadow: 0 0 6px var(--neon); }
.dm-f-fill.pilot    { background: var(--amber);  box-shadow: 0 0 6px var(--amber-glow); }
.dm-f-fill.command  { background: var(--info);   box-shadow: 0 0 6px var(--info-glow); }
.dm-f-fill.base     { background: #a855f7;       box-shadow: 0 0 6px rgba(168, 85, 247, 0.4); }
.dm-f-fill.resource { background: var(--text-3); }
/* Card-colour fills — used by the Color breakdown in the Analytics pane. */
.dm-f-fill.color-blue   { background: #4a9eff; box-shadow: 0 0 6px rgba(74, 158, 255, 0.4); }
.dm-f-fill.color-green  { background: var(--neon); box-shadow: 0 0 6px var(--neon); }
.dm-f-fill.color-red    { background: var(--color-error); box-shadow: 0 0 6px rgba(255, 59, 59, 0.4); }
.dm-f-fill.color-purple { background: #a855f7; box-shadow: 0 0 6px rgba(168, 85, 247, 0.4); }
.dm-f-fill.color-white  { background: rgba(216, 245, 225, 0.55); }
.dm-f-fill.color-other  { background: var(--text-3); }
.dm-f-count {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-align: right;
    color: var(--text-2);
}

/* ── Cost curve ──
   Bars use direct px height set by JS so no percentage reflow issues
   against an implicit parent height. */
.dm-cost-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 72px;
    border-bottom: 1px solid var(--border);
    padding-top: 2px;
}
.dm-cost-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.dm-cost-bar {
    width: 100%;
    background: var(--neon);
    opacity: 0.5;
    transition: opacity 0.15s;
    min-height: 2px;
    box-shadow: 0 0 4px var(--neon-glow);
}
.dm-cost-col:hover .dm-cost-bar { opacity: 1; }
.dm-cost-bar-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-3);
    line-height: 1;
}

/* ── Traits / Effects badges ──
   Click a badge to highlight matching cards in the card list.
   HUD-styled chips. */
.traits-badges,
.effects-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.trait-badge,
.effect-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(46, 255, 126, 0.04);
    border: 1px solid var(--border);
    border-radius: 0;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.trait-badge:hover,
.effect-badge:hover {
    border-color: var(--neon);
    background: rgba(46, 255, 126, 0.1);
}

.trait-badge-name,
.effect-badge-name {
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-2);
}

.trait-badge-count,
.effect-badge-count {
    font-size: 10px;
    font-weight: 600;
    color: var(--neon);
}

/* Active badge — the filter currently driving the highlight */
.highlightable-badge.active {
    border-color: var(--neon);
    background: rgba(46, 255, 126, 0.16);
    box-shadow: 0 0 8px var(--neon-glow);
}
.highlightable-badge.active .trait-badge-name,
.highlightable-badge.active .effect-badge-name {
    color: var(--neon);
}

/* Empty state for an analytics block with no entries */
.no-effects {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--text-3);
    font-style: italic;
}

/* ── Acquisition (Total Cost / Collection / Missing) ──
   Lives in the deck detail left intel panel on BOTH the modal and the page.
   Gated on a logged-in user by the shared deck-completeness renderer. */
.dm-acq-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dm-acq-card {
    border: 1px solid var(--border);
    background: rgba(46, 255, 126, 0.03);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dm-acq-card.clickable-card {
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.dm-acq-card.clickable-card:hover {
    border-color: var(--neon);
    background: rgba(46, 255, 126, 0.07);
}
.dm-acq-title {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
}
.dm-acq-value {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--neon);
}
.buy-cards-link {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--neon);
    margin-top: 2px;
}
.price-disclaimer {
    font-size: 9px;
    color: var(--text-3);
    font-weight: 400;
}

/* Collection highlight-owned toggle */
.collection-highlight-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-2);
    border: 1px solid var(--border);
    transition: var(--transition-fast);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 12px;
    width: 12px;
    left: 2px;
    top: 2px;
    background: var(--text-3);
    transition: var(--transition-fast);
}
.toggle-switch input:checked + .toggle-slider {
    background: rgba(46, 255, 126, 0.2);
    border-color: var(--neon);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
    background: var(--neon);
}
.toggle-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-2);
}
