/* Styles for `war_dashboard.html`, loaded after `app.css` so the shared tokens and
 * components are already in scope. Rules written the same way in three or
 * more pages belong in `app.css` instead: `tests/test_shared_styles.py`
 * fails when one is copied that far.
 */
/* ── Wars Dashboard Layout ─── */
html, body { height: 100%; }
.wars-shell {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 49px); /* allow nav growth without clipping graph */
    overflow: hidden;
    background: #0c0e12;
    font-family: 'IBM Plex Sans', sans-serif;
}
/* ── Top bar ── */
.wars-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #12151b;
    border-bottom: 1px solid #252a35;
    padding: 8px 14px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.wars-topbar-title {
    flex: 1;
    min-width: 0;
}
.wars-topbar-title h1 {
    margin: 0;
    font-size: 1.05rem;
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    color: #d4a54a;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}
.wars-topbar-title .subtitle {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 1px;
}
.wars-topbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.wars-topbar-refresh-time {
    font-size: 0.72rem;
    color: #6b7280;
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
}
.wars-alliance-search {
    background: #181c24;
    border: 1px solid #252a35;
    border-radius: 2px;
    padding: 4px 8px;
    font-size: 0.8rem;
    color: #d6d9e0;
    font-family: 'IBM Plex Mono', monospace;
    width: 150px;
    opacity: 1;
    cursor: text;
}
.wars-alliance-search::placeholder {
    color: #6b7280;
}
.wars-alliance-search[disabled] {
    color: #9aa2af;
    opacity: 0.55;
    cursor: not-allowed;
}
.wars-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #181c24;
    border: 1px solid #252a35;
    border-radius: 2px;
    padding: 5px 10px;
    font-size: 0.8rem;
    color: #d6d9e0;
    cursor: pointer;
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    letter-spacing: 0.04em;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.wars-btn:hover { border-color: #d4a54a; color: #d4a54a; }
.wars-btn.active { border-color: #d4a54a; color: #d4a54a; background: #1a1c1f; }
.wars-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* ── Stats bar ── */
.wars-statsbar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #0f1117;
    border-bottom: 1px solid #252a35;
    padding: 5px 14px;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.wars-statsbar::-webkit-scrollbar { display: none; }
.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #12151b;
    border: 1px solid #252a35;
    border-radius: 2px;
    padding: 3px 9px;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.stat-chip .sc-label { color: #6b7280; }
.stat-chip .sc-value { color: #d6d9e0; font-family: 'IBM Plex Mono', monospace; font-weight: 600; }
.stat-chip .sc-value.offensive { color: #4caf87; }
.stat-chip .sc-value.defensive { color: #e05454; }
.stat-chip .sc-value.gold { color: #d4a54a; }
.stat-chip .sc-value.green { color: #7fb18a; }
/* ── Alliance filter bar ── */
.wars-filterbar {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #0c0e12;
    border-bottom: 1px solid #1c1f27;
    padding: 5px 14px;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.wars-filterbar::-webkit-scrollbar { display: none; }
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 2px;
    border: 1px solid transparent;
    padding: 3px 9px;
    font-size: 0.76rem;
    cursor: pointer;
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    letter-spacing: 0.04em;
    transition: border-color 0.15s, background 0.15s;
    white-space: nowrap;
    background: #12151b;
    color: #9aa2af;
}
.filter-chip:hover { color: #d6d9e0; border-color: #3a3f4d; }
.filter-chip.active { border-color: currentColor; font-weight: 600; }
.filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
/* ── Main body ── */
.wars-body {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}
/* ── Graph area ── */
.wars-graph-area {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
}
.wars-svg {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}
/* ── Legend ── */
.wars-legend {
    position: absolute;
    bottom: 44px;
    left: 14px;
    background: rgba(18,21,27,0.92);
    border: 1px solid #252a35;
    border-radius: 2px;
    padding: 7px 10px;
    font-size: 0.72rem;
    color: #9aa2af;
    pointer-events: none;
    z-index: 10;
}
.wars-legend .leg-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 2px 0;
}
.wars-legend .leg-line {
    width: 28px;
    height: 2px;
    border-radius: 1px;
    flex-shrink: 0;
}
/* ── Zoom controls ── */
.wars-zoom-controls {
    position: absolute;
    bottom: 14px;
    right: 14px;
    display: flex;
    gap: 4px;
    z-index: 10;
}
.wars-zoom-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #181c24;
    border: 1px solid #252a35;
    border-radius: 2px;
    color: #9aa2af;
    cursor: pointer;
    font-size: 1rem;
    transition: border-color 0.15s, color 0.15s;
}
.wars-zoom-btn:hover { border-color: #d4a54a; color: #d4a54a; }
/* ── Detail panel ── */
.wars-detail-panel {
    width: 300px;
    flex-shrink: 0;
    background: #12151b;
    border-left: 1px solid #252a35;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    z-index: 5;
}
.wars-detail-panel.mobile-overlay {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
    box-shadow: -4px 0 24px rgba(0,0,0,0.6);
}
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 8px;
    border-bottom: 1px solid #252a35;
}
.detail-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: #d4a54a;
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    letter-spacing: 0.04em;
}
.detail-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
    line-height: 1;
}
.detail-close:hover { color: #d4a54a; }
.detail-section {
    padding: 10px 12px;
    border-bottom: 1px solid #1a1e27;
}
.detail-section h4 {
    margin: 0 0 6px;
    font-size: 0.78rem;
    color: #9aa2af;
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.detail-nation-name {
    font-size: 0.9rem;
    color: #d6d9e0;
    font-weight: 600;
    margin-bottom: 2px;
}
.detail-leader-name {
    font-size: 0.75rem;
    color: #6b7280;
}
.detail-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 6px;
}
.detail-stat {
    display: flex;
    flex-direction: column;
}
.detail-stat .ds-label { font-size: 0.68rem; color: #6b7280; }
.detail-stat .ds-value { font-size: 0.82rem; color: #d6d9e0; font-family: 'IBM Plex Mono', monospace; }
.detail-war-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 8px;
    background: #0f1117;
    border: 1px solid #252a35;
    border-radius: 2px;
    padding: 7px 9px;
}
.detail-war-badge {
    display: inline-block;
    border-radius: 2px;
    padding: 1px 6px;
    font-size: 0.68rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.detail-war-badge.offensive { background: rgba(76,175,135,0.15); color: #4caf87; border: 1px solid rgba(76,175,135,0.3); }
.detail-war-badge.defensive { background: rgba(224,84,84,0.15); color: #e05454; border: 1px solid rgba(224,84,84,0.3); }
.detail-res-bar {
    height: 6px;
    border-radius: 1px;
    background: #1a1e27;
    margin-top: 4px;
    overflow: hidden;
}
.detail-res-fill { height: 100%; border-radius: 1px; }
.pnw-link {
    color: #d4a54a;
    text-decoration: none;
    font-size: 0.75rem;
}
.pnw-link:hover { text-decoration: underline; }
/* ── Error banner ── */
.wars-error-banner {
    background: rgba(180,50,50,0.15);
    border: 1px solid rgba(180,50,50,0.4);
    border-radius: 2px;
    color: #f08080;
    padding: 10px 14px;
    font-size: 0.85rem;
    margin: 14px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.wars-error-banner svg { flex-shrink: 0; margin-top: 1px; }
/* ── Empty state ── */
.wars-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #3a3f4d;
    pointer-events: none;
}
.wars-empty svg { width: 56px; height: 56px; opacity: 0.3; stroke: #6b7280; fill: none; stroke-width: 1.5; }
.wars-empty p { margin: 12px 0 0; font-size: 0.9rem; color: #4b5563; }
/* ── Loading spinner ── */
.wars-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #6b7280;
}
.wars-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #252a35;
    border-top-color: #d4a54a;
    border-radius: 50%;
    animation: wars-spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes wars-spin { to { transform: rotate(360deg); } }
/* ── SVG nodes & links ── */
.war-link { stroke-width: 1.5; fill: none; opacity: 0.78; }
.war-link.dimmed { opacity: 0.12; }
.war-link.highlighted { stroke-width: 2.5; opacity: 1; }
.war-node { cursor: pointer; }
.war-node rect { stroke-width: 1.2; transition: transform 0.15s, stroke-width 0.15s, opacity 0.15s; }
.war-node.dimmed rect { opacity: 0.2; }
.war-node.dimmed text { opacity: 0.2; }
.war-node.highlighted rect { stroke-width: 2; }
.war-node.inactive rect { opacity: 0.35; stroke-dasharray: 3 2; }
.war-badge-circle { fill: #0c0e12; stroke-width: 1.3; }
.air-alert-ping {
    animation: air-alert-pulse 1.2s ease-in-out infinite;
}
@keyframes air-alert-pulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}
.order-row {
    border: 1px solid #252a35;
    border-radius: 2px;
    padding: 6px 8px;
    margin-bottom: 6px;
    background: #0f1117;
}
.order-badge {
    font-size: 0.66rem;
    border: 1px solid #2a4f9a;
    color: #7fb6ff;
    background: rgba(32, 91, 196, 0.2);
    border-radius: 2px;
    padding: 1px 5px;
    display: inline-block;
    margin-right: 6px;
    text-transform: uppercase;
    font-family: 'IBM Plex Mono', monospace;
}
.order-btn {
    background: #173664;
    border: 1px solid #2f66b5;
    color: #a6cbff;
    border-radius: 2px;
    padding: 4px 7px;
    font-size: 0.72rem;
    cursor: pointer;
    margin-right: 6px;
    margin-bottom: 6px;
}
.order-btn:hover { border-color: #4e8cf3; color: #d5e6ff; }
.order-help {
    font-size: 0.68rem;
    color: #6b7280;
    margin-top: 4px;
}
.wars-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: 360px;
    padding: 12px 14px;
    border-radius: 2px;
    border: 1px solid #252a35;
    background: rgba(18,21,27,0.96);
    color: #d6d9e0;
    box-shadow: 0 12px 24px rgba(0,0,0,0.35);
    z-index: 60;
    font-size: 0.82rem;
    line-height: 1.45;
}
.wars-toast.success { border-color: rgba(76,175,135,0.45); }
.wars-toast.error { border-color: rgba(224,84,84,0.45); }
.wars-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 55;
}
.wars-modal {
    width: min(100%, 460px);
    background: #12151b;
    border: 1px solid #252a35;
    border-radius: 2px;
    padding: 16px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}
.wars-modal h3 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: #d4a54a;
}
.wars-modal p {
    margin: 0 0 12px;
    font-size: 0.8rem;
    color: #9aa2af;
    line-height: 1.5;
}
.wars-modal textarea {
    width: 100%;
    min-height: 108px;
    resize: vertical;
    background: #0c0e12;
    border: 1px solid #252a35;
    border-radius: 2px;
    color: #d6d9e0;
    padding: 8px 10px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.84rem;
    box-sizing: border-box;
}
.wars-modal textarea:focus {
    outline: none;
    border-color: #d4a54a;
}
.wars-modal-error {
    margin: 10px 0 0;
    color: #fca5a5;
    font-size: 0.76rem;
}
.wars-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}
body.light-mode .wars-shell { background: #f5f7fb; }
body.light-mode .wars-topbar {
    background: #ffffff;
    border-bottom-color: #d7dce6;
}
body.light-mode .wars-topbar-title h1 { color: #4338ca; }
body.light-mode .wars-topbar-title .subtitle,
body.light-mode .wars-topbar-refresh-time { color: #6b7280; }
body.light-mode .wars-alliance-search,
body.light-mode .wars-btn,
body.light-mode .wars-zoom-btn {
    background: #ffffff;
    border-color: #cfd5e1;
    color: #374151;
}
body.light-mode .wars-btn:hover,
body.light-mode .wars-btn.active,
body.light-mode .wars-zoom-btn:hover {
    border-color: #4338ca;
    color: #4338ca;
    background: #eef2ff;
}
body.light-mode .wars-statsbar {
    background: #f8faff;
    border-bottom-color: #d7dce6;
}
body.light-mode .stat-chip {
    background: #ffffff;
    border-color: #d7dce6;
}
body.light-mode .stat-chip .sc-label { color: #6b7280; }
body.light-mode .stat-chip .sc-value { color: #1f2937; }
body.light-mode .wars-filterbar {
    background: #f5f7fb;
    border-bottom-color: #d7dce6;
}
body.light-mode .filter-chip {
    background: #ffffff;
    color: #4b5563;
    border-color: #d7dce6;
}
body.light-mode .filter-chip:hover { color: #111827; border-color: #9aa2af; }
body.light-mode .wars-legend {
    background: rgba(255,255,255,0.95);
    border-color: #d7dce6;
    color: #4b5563;
}
body.light-mode .wars-empty {
    color: #9ca3af;
}
body.light-mode .wars-empty svg {
    stroke: #9ca3af;
}
body.light-mode .wars-empty p {
    color: #6b7280;
}
body.light-mode .wars-loading {
    color: #6b7280;
}
body.light-mode .wars-spinner {
    border-color: #d7dce6;
    border-top-color: #4338ca;
}
body.light-mode .wars-detail-panel {
    background: #ffffff;
    border-left-color: #d7dce6;
}
body.light-mode .detail-header { border-bottom-color: #d7dce6; }
body.light-mode .detail-header h3 { color: #4338ca; }
body.light-mode .detail-section { border-bottom-color: #e5e7eb; }
body.light-mode .detail-section h4,
body.light-mode .detail-leader-name,
body.light-mode .detail-stat .ds-label { color: #6b7280; }
body.light-mode .detail-nation-name,
body.light-mode .detail-stat .ds-value { color: #1f2937; }
body.light-mode .detail-war-row,
body.light-mode .order-row {
    background: #f8faff;
    border-color: #d7dce6;
}
body.light-mode .order-help {
    color: #6b7280;
}
body.light-mode .wars-toast {
    background: rgba(255,255,255,0.98);
    border-color: #d7dce6;
    color: #1f2937;
}
body.light-mode .wars-modal {
    background: #ffffff;
    border-color: #d7dce6;
}
body.light-mode .wars-modal h3 { color: #4338ca; }
body.light-mode .wars-modal p { color: #6b7280; }
body.light-mode .wars-modal textarea {
    background: #ffffff;
    border-color: #cfd5e1;
    color: #1f2937;
}
body.light-mode .wars-modal textarea:focus {
    border-color: #4338ca;
}
body.light-mode .detail-res-bar { background: #e5e7eb; }
body.light-mode .war-badge-circle { fill: #ffffff; }
body.light-mode .pnw-link { color: #4338ca; }
body.light-mode .wars-error-banner { color: #dc2626; }
body.light-mode .order-btn {
    background: #eef2ff;
    border-color: #4338ca;
    color: #4338ca;
}
body.light-mode .order-btn:hover { background: #e0e7ff; border-color: #3730a3; color: #3730a3; }
body.light-mode .order-badge {
    background: rgba(67,56,202,0.1);
    border-color: #6366f1;
    color: #4338ca;
}
/* ── Responsive panel ── */
@media (max-width: 700px) {
    .wars-detail-panel:not(.mobile-overlay) { display: none; }
    .wars-detail-panel.open { display: flex; }
    .wars-topbar-controls { gap: 5px; }
    .wars-alliance-search { width: 100px; }
}
