/* =============================================================================
   Deck card list — shared between the deck details modal and the deck page.
   Single source of truth for the Newtype v2 type-sectioned card grid
   (.dm-card-cell thumbnails, link badges, ×N slabs). Rendered by
   js/components/deck-card-list.ts. Scoped to .deck-card-list (NOT #deckModal)
   so both surfaces get identical styling. See
   docs/planning/card-deck-parity-audit.md.
   ============================================================================= */

/* Card list highlight states driven by trait/effect badge clicks */
.deck-card-list .dm-card-cell.highlighted {
    outline: 1px solid var(--neon);
    outline-offset: -1px;
    box-shadow: 0 0 10px var(--neon-glow);
    z-index: 1;
}
.deck-card-list .dm-card-cell.dimmed {
    opacity: 0.28;
}

/* Type section */
.deck-card-list .dm-type-section { margin-bottom: 16px; }

.deck-card-list .dm-type-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 6px 6px 0;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.deck-card-list .dm-type-head::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 40px;
    height: 1px;
}
.deck-card-list .dm-type-head.units::before     { background: var(--neon);   box-shadow: 0 0 6px var(--neon); }
.deck-card-list .dm-type-head.pilots::before    { background: var(--amber);  box-shadow: 0 0 6px var(--amber-glow); }
.deck-card-list .dm-type-head.commands::before  { background: var(--info); }
.deck-card-list .dm-type-head.bases::before     { background: var(--purple, #a855f7); }
.deck-card-list .dm-type-head.resources::before { background: var(--text-3); }
.deck-card-list .dm-type-head.sideboard::before { background: #ff7eb3; box-shadow: 0 0 6px rgba(255, 126, 179, 0.5); }

.deck-card-list .dm-type-name {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.deck-card-list .dm-type-name.units     { color: var(--neon); }
.deck-card-list .dm-type-name.pilots    { color: var(--amber); }
.deck-card-list .dm-type-name.commands  { color: var(--info); }
.deck-card-list .dm-type-name.bases     { color: var(--purple, #a855f7); }
.deck-card-list .dm-type-name.resources { color: var(--text-3); }
.deck-card-list .dm-type-name.sideboard { color: #ff7eb3; }

.deck-card-list .dm-type-count {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--text-3);
}

/* ── Card grid (HUD card cells) ── */
.deck-card-list .dm-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 10px;
    padding-top: 4px;
}

.deck-card-list .dm-card-cell {
    position: relative;
    aspect-ratio: 5/7;
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    background: linear-gradient(165deg, #0a0e13, #151e2e);
    transition: border-color 0.12s, box-shadow 0.12s;
}

.deck-card-list .dm-card-cell:hover {
    border-color: var(--neon);
    box-shadow: 0 0 10px var(--neon-glow);
}

.deck-card-list .dm-card-cell::before,
.deck-card-list .dm-card-cell::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    z-index: 4;
    pointer-events: none;
}
.deck-card-list .dm-card-cell::before {
    top: -1px; left: -1px;
    border-top: 1px solid var(--neon);
    border-left: 1px solid var(--neon);
    opacity: 0.6;
}
.deck-card-list .dm-card-cell::after {
    bottom: -1px; right: -1px;
    border-bottom: 1px solid var(--neon);
    border-right: 1px solid var(--neon);
    opacity: 0.6;
}
.deck-card-list .dm-card-cell:hover::before,
.deck-card-list .dm-card-cell:hover::after { opacity: 1; }

.deck-card-list .dm-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.96;
}

/* Top-right meta — card number + rarity */
.deck-card-list .dm-card-meta-tr {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 3px 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}
.deck-card-list .dm-card-meta-num {
    font-size: 8px;
    letter-spacing: 0.04em;
    color: var(--text);
    font-weight: 600;
    line-height: 1;
}
.deck-card-list .dm-card-meta-rarity {
    font-size: 8px;
    letter-spacing: 0.16em;
    color: var(--neon);
    font-weight: 700;
    line-height: 1;
}

/* Centered-right quantity badge */
.deck-card-list .dm-card-qty {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    padding: 6px 7px 6px 9px;
    background: var(--neon);
    color: var(--bg);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 6px 100%);
    box-shadow: 0 0 10px var(--neon-glow);
    pointer-events: none;
}

/* Chain-link badge — stacked just above the quantity slab on the right edge.
   Shown for units/pilots that have a link partner present in the deck. */
.deck-card-list .dm-card-link-badge {
    position: absolute;
    right: 0;
    top: calc(50% - 27px);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 19px;
    padding: 0 4px 0 6px;
    background: var(--neon);
    color: var(--bg);
    box-shadow: 0 0 8px var(--neon-glow);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 5px 100%);
    pointer-events: none;
}
.deck-card-list .dm-card-link-badge svg {
    display: block;
}

/* Bottom overlay with name, shown on hover */
.deck-card-list .dm-card-overlay-bot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.88) 38%, rgba(0, 0, 0, 0.92));
    padding: 18px 6px 6px;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s, transform 0.18s;
}
.deck-card-list .dm-card-cell:hover .dm-card-overlay-bot {
    opacity: 1;
    transform: translateY(0);
}
.deck-card-list .dm-card-name {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.deck-card-list .dm-card-stat {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.04em;
    color: var(--text-2);
    line-height: 1;
}

/* Type-section indicator stripe (color-coded left border on cell) */
.deck-card-list .dm-card-cell.unit      { border-left-color: rgba(46, 255, 126, 0.4); }
.deck-card-list .dm-card-cell.pilot     { border-left-color: rgba(255, 184, 77, 0.4); }
.deck-card-list .dm-card-cell.command   { border-left-color: rgba(0, 217, 255, 0.4); }
.deck-card-list .dm-card-cell.base      { border-left-color: rgba(168, 85, 247, 0.4); }
.deck-card-list .dm-card-cell.resource  { border-left-color: rgba(74, 102, 87, 0.6); }
.deck-card-list .dm-card-cell.sideboard { border-left-color: rgba(255, 126, 179, 0.5); }

/* ── Collection-highlight quantity badges ──
   In highlight-owned mode the ×N slab becomes an owned/needed badge: green when
   the user owns enough copies, red when short. Shared by the modal + page. */
.deck-card-list .dm-card-qty.collection-complete {
    background: var(--neon);
    color: var(--bg);
}
.deck-card-list .dm-card-qty.collection-incomplete {
    background: var(--color-error);
    color: var(--bg);
    box-shadow: 0 0 10px rgba(255, 59, 59, 0.4);
}
