/*
 * Command & Control board.
 *
 * Marker styles are global rather than scoped to the page component: Leaflet
 * injects DivIcon HTML into its own panes, outside the component's DOM, so a
 * scoped stylesheet's attribute selector never matches them.
 */

/* ── Layout ──────────────────────────────────────────────────────────────── */

.c2-shell {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--ssr-space-4);
    align-items: start;
}

.c2-board {
    position: relative;
    border: 1px solid var(--ssr-border);
    border-radius: var(--ssr-radius);
    overflow: hidden;
    background: var(--ssr-bg-sunken);
}

#c2-map {
    width: 100%;
    height: clamp(420px, 68vh, 900px);
}

/* Dropping is a two-step gesture with no cursor feedback of its own, so the
   board says plainly that it will accept what is being dragged. */
#c2-map.c2-drop-active {
    outline: 2px dashed var(--ssr-gold);
    outline-offset: -6px;
}

@media (max-width: 900px) {
    .c2-shell { grid-template-columns: 1fr; }
    #c2-map { height: 55vh; }
}

/* ── Side panel ──────────────────────────────────────────────────────────── */

.c2-panel {
    border: 1px solid var(--ssr-border);
    border-radius: var(--ssr-radius);
    background: var(--ssr-surface);
    padding: var(--ssr-space-3);
    max-height: clamp(420px, 68vh, 900px);
    overflow-y: auto;
}

.c2-panel h2 {
    font-size: var(--ssr-text-sm);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ssr-text-muted);
    margin: 0 0 var(--ssr-space-2);
}

.c2-domain-group + .c2-domain-group { margin-top: var(--ssr-space-4); }

.c2-domain-group > h3 {
    font-size: var(--ssr-text-2xs);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ssr-text-muted);
    margin: 0 0 var(--ssr-space-2);
    padding-bottom: 2px;
    border-bottom: 1px solid var(--ssr-border);
}

.c2-asset-card {
    display: flex;
    align-items: center;
    gap: var(--ssr-space-2);
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 4px;
    border: 1px solid var(--ssr-border);
    border-radius: var(--ssr-radius-sm);
    background: var(--ssr-surface-raised);
    cursor: grab;
    text-align: left;
    font-size: var(--ssr-text-sm);
    color: var(--ssr-text);
}

.c2-asset-card:hover { border-color: var(--ssr-gold); }
.c2-asset-card:active { cursor: grabbing; }
.c2-asset-card.is-dragging { opacity: .45; }

.c2-asset-card img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex: 0 0 34px;
}

.c2-asset-card i {
    width: 34px;
    text-align: center;
    font-size: 1.15rem;
    color: var(--ssr-text-secondary);
}

.c2-asset-card .c2-asset-name { flex: 1 1 auto; line-height: 1.2; }
.c2-asset-card .c2-asset-sub {
    display: block;
    font-size: var(--ssr-text-2xs);
    color: var(--ssr-text-muted);
}

/* ── Markers ─────────────────────────────────────────────────────────────── */

.c2-divicon { background: none; border: none; }

.c2-marker {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.c2-frame {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px var(--c2-border-style, solid) var(--c2-color, #888);
    background: color-mix(in srgb, var(--c2-color) 18%, #0d1117 82%);
    color: #f2f5f8;
    box-sizing: border-box;
}

.c2-frame img { width: 26px; height: 26px; object-fit: contain; }
.c2-frame i { font-size: .95rem; line-height: 1; }

/* MIL-STD-2525 frame shapes, near enough to be read at a glance. */
.c2-aff-friendly .c2-frame { border-radius: 14px 14px 4px 4px; }      /* rectangle-ish */
.c2-aff-neutral  .c2-frame { border-radius: 2px; }                    /* square */
.c2-aff-unknown  .c2-frame { border-radius: 50%; }                    /* quatrefoil stand-in */
.c2-aff-suspect  .c2-frame { border-radius: 2px 14px 2px 14px; }      /* cut corners */
.c2-aff-hostile  .c2-frame { transform: rotate(45deg); border-radius: 3px; }
.c2-aff-hostile  .c2-frame > * { transform: rotate(-45deg); }         /* keep art upright */

.c2-marker-dead { filter: grayscale(.55); }

/* ── Awaiting an officer ─────────────────────────────────────────────────── */

/* Held contacts read as provisional without being hard to see — an operator still
   needs to spot one to accept it. The halo is deliberately unlike the dotted border
   that means low intel confidence: "nobody has checked this" and "we are unsure it is
   there" are different doubts. */
.c2-marker-held .c2-frame {
    box-shadow: 0 0 0 2px #0d1117, 0 0 0 4px var(--ssr-gold, #c9a840);
}

.c2-marker-held { animation: c2-held-pulse 2.4s ease-in-out infinite; }

@keyframes c2-held-pulse {
    0%, 100% { opacity: .62; }
    50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .c2-marker-held { animation: none; opacity: .8; }
}

/* An accepted contact carrying an unaccepted damage report. */
.c2-proposal {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ssr-gold, #c9a840);
    color: #14181d;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border: 1px solid #0d1117;
    pointer-events: none;
}

.c2-review-card {
    border: 1px solid var(--ssr-gold, #c9a840);
    border-radius: var(--ssr-radius-sm);
    background: color-mix(in srgb, var(--ssr-gold, #c9a840) 10%, transparent);
    padding: var(--ssr-space-2);
    margin-bottom: var(--ssr-space-3);
}

.c2-review-card h3 {
    font-size: var(--ssr-text-2xs);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ssr-gold-text, #7a6120);
    margin: 0 0 4px;
}

.c2-review-card .c2-heard {
    font-size: var(--ssr-text-xs);
    color: var(--ssr-text-secondary);
    font-style: italic;
    margin-bottom: var(--ssr-space-2);
}

.c2-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 2px;
    font-size: 10px;
    font-family: var(--ssr-font-mono, monospace);
    white-space: nowrap;
    color: #e9edf2;
    text-shadow: 0 1px 2px #000, 0 0 3px #000;
    pointer-events: none;
}

.c2-qty {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 8px;
    background: #0d1117;
    border: 1px solid var(--c2-color, #888);
    color: #f2f5f8;
    font-size: 10px;
    line-height: 14px;
    text-align: center;
    font-family: var(--ssr-font-mono, monospace);
}

/* ── Battle damage overlays ──────────────────────────────────────────────── */

.c2-dmg { position: absolute; pointer-events: none; }

/* Degraded / damaged: a corner pip, amber then deeper. */
.c2-dmg-degraded,
.c2-dmg-damaged {
    left: 0;
    bottom: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid #0d1117;
}
.c2-dmg-degraded { background: #facc15; }
.c2-dmg-damaged  { background: #f97316; }

/* Mobility kill: cannot move — a bar across the track. */
.c2-dmg-mobility {
    left: 2px;
    right: 2px;
    top: 50%;
    height: 3px;
    background: #f1f5f9;
    box-shadow: 0 0 0 1px #0d1117;
}

/* Firepower kill: cannot shoot — a bar down the barrel. */
.c2-dmg-firepower {
    top: 2px;
    bottom: 2px;
    left: 50%;
    width: 3px;
    background: #f1f5f9;
    box-shadow: 0 0 0 1px #0d1117;
}

/* Destroyed: struck through. */
.c2-dmg-destroyed {
    inset: 3px;
    background:
        linear-gradient(45deg,  transparent 46%, #ef4444 46%, #ef4444 54%, transparent 54%),
        linear-gradient(-45deg, transparent 46%, #ef4444 46%, #ef4444 54%, transparent 54%);
}

/* Engaged, assessment pending. */
.c2-dmg-unknown {
    right: -2px;
    bottom: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0d1117;
    color: #facc15;
    font-size: 10px;
    line-height: 14px;
    text-align: center;
    font-weight: 700;
}

/* ── Force summary ───────────────────────────────────────────────────────── */

.c2-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ssr-space-2);
    margin-bottom: var(--ssr-space-3);
}

.c2-count {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--ssr-radius-pill);
    border: 1px solid var(--c2-color, var(--ssr-border));
    background: color-mix(in srgb, var(--c2-color, #888) 12%, transparent);
    font-size: var(--ssr-text-sm);
}

.c2-count .c2-count-n {
    font-family: var(--ssr-font-mono, monospace);
    font-size: var(--ssr-text-md);
    font-weight: 700;
    color: var(--ssr-text);
}

.c2-count .c2-count-dead {
    font-size: var(--ssr-text-2xs);
    color: var(--ssr-text-muted);
}

.c2-stale {
    font-size: var(--ssr-text-xs);
    color: var(--ssr-text-muted);
}
.c2-stale.is-stale { color: var(--ssr-danger); }
