/* ==========================================================================
   HISTORICAL HQ INTERACTIVE GEOSPATIAL COMMAND CENTERS (WW1 & WW2)
   High-Fidelity Military Cartography & Tactical Intelligence Styling
   ========================================================================== */

:root {
  --ww1-brass: #d4af37;
  --ww1-gold: #ffb703;
  --ww1-cyan: #00f3ff;
  --ww1-dark: #070b12;
  --ww1-panel: rgba(11, 18, 30, 0.94);
  --ww1-border: rgba(212, 175, 55, 0.35);

  --ww2-amber: #f59e0b;
  --ww2-crimson: #ef4444;
  --ww2-green: #10b981;
  --ww2-blue: #38bdf8;
  --ww2-dark: #080c14;
  --ww2-panel: rgba(14, 20, 32, 0.94);
  --ww2-border: rgba(245, 158, 11, 0.35);
}

/* Base Full-Screen HQ Layout */
html, body {
  margin: 0;
  padding: 0;
  background-color: #060910;
  font-family: var(--font-body, "Plus Jakarta Sans", sans-serif);
  color: #e2e8f0;
}

.historical-hq-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Dual Top Navigation Styling */
.historical-subnav-bar {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 100;
  height: 52px;
  background: rgba(8, 14, 24, 0.92);
  border-bottom: 1.5px solid var(--ww1-border);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.ww2-theme .historical-subnav-bar {
  border-bottom-color: var(--ww2-border);
}

.subnav-left-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.subnav-title {
  font-family: var(--font-hud, "Rajdhani", sans-serif);
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subnav-links-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subnav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 6px 14px;
  border-radius: 10px;
  font-family: var(--font-hud);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
}

.subnav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: var(--ww1-cyan);
  transform: translateY(-1px);
}

.subnav-btn.active {
  background: rgba(0, 243, 255, 0.18);
  border-color: var(--ww1-cyan);
  color: var(--ww1-cyan);
  box-shadow: 0 0 14px rgba(0, 243, 255, 0.35);
}

.subnav-btn.versus-btn {
  border-color: rgba(255, 183, 3, 0.4);
  color: var(--ww1-gold);
}

.subnav-btn.versus-btn:hover {
  background: rgba(255, 183, 3, 0.2);
  border-color: var(--ww1-gold);
  box-shadow: 0 0 16px rgba(255, 183, 3, 0.4);
}

/* Main Geospatial Map Viewport */
.historical-map-viewport {
  position: absolute;
  top: 108px;
  left: 0;
  width: 100%;
  height: calc(100% - 108px);
  z-index: 1;
  background: #09121f;
}

#ww1-map, #ww2-map {
  width: 100%;
  height: 100%;
  background: #09121f;
}

.leaflet-container {
  background: #09121f !important;
}

/* Floating Top-Right Faction Pill Group */
.historical-top-hud {
  position: absolute;
  top: 124px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.historical-top-hud > * {
  pointer-events: auto;
}

.faction-filter-dock {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 16, 28, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  padding: 6px 12px;
  border-radius: 14px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.faction-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: 10px;
  font-family: var(--font-hud);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.faction-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.faction-btn.active {
  background: rgba(255, 183, 3, 0.2);
  border-color: var(--ww1-gold);
  color: var(--ww1-gold);
  box-shadow: 0 0 14px rgba(255, 183, 3, 0.35);
}

.faction-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Floating Bottom Command Center & Timeline Dock */
.historical-bottom-dock {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: calc(100% - 40px);
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.historical-bottom-dock > * {
  pointer-events: auto;
}

.historical-timeline-bar {
  background: rgba(8, 14, 24, 0.94);
  border: 1.5px solid var(--ww1-border);
  border-radius: 18px;
  padding: 14px 22px;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.ww2-theme .historical-timeline-bar {
  border-color: var(--ww2-border);
}

.timeline-playback-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-play-pause {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ww1-gold), #e09f00);
  border: none;
  color: #000000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(255, 183, 3, 0.4);
  transition: all 0.2s ease;
}

.ww2-theme .btn-play-pause {
  background: linear-gradient(135deg, var(--ww2-amber), #d97706);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.btn-play-pause:hover {
  transform: scale(1.05);
}

.timeline-years-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.year-node {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  color: #94a3b8;
  padding: 8px 18px;
  border-radius: 10px;
  font-family: var(--font-hud);
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.year-node:hover {
  border-color: var(--ww1-cyan);
  color: #ffffff;
  transform: translateY(-2px);
}

.year-node.active {
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.28), rgba(212, 175, 55, 0.4));
  border-color: var(--ww1-gold);
  color: var(--ww1-gold);
  box-shadow: 0 0 16px rgba(255, 183, 3, 0.45);
}

.ww2-theme .year-node.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(217, 119, 6, 0.4));
  border-color: var(--ww2-amber);
  color: var(--ww2-amber);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
}

.timeline-event-badge {
  font-family: var(--font-hud);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ww1-cyan);
  padding: 6px 14px;
  background: rgba(0, 243, 255, 0.12);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: 10px;
  white-space: nowrap;
}

.ww2-theme .timeline-event-badge {
  color: var(--ww2-amber);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Metric Segment Tabs on Left Side */
.historical-layer-dock {
  position: absolute;
  top: 175px;
  left: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(8, 14, 24, 0.94);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.6);
  max-width: 220px;
}

.layer-dock-header {
  font-family: var(--font-hud);
  font-size: 0.78rem;
  font-weight: 900;
  color: #94a3b8;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
}

.layer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 9px 12px;
  border-radius: 10px;
  font-family: var(--font-hud);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.layer-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.layer-btn.active {
  background: rgba(0, 243, 255, 0.18);
  border-color: var(--ww1-cyan);
  color: var(--ww1-cyan);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
}

.ww2-theme .layer-btn.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--ww2-amber);
  color: var(--ww2-amber);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

/* Polygon Vector Cartography Styling */
.ww1-country-polygon, .ww2-country-polygon {
  transition: fill 0.25s ease, fill-opacity 0.25s ease, stroke-width 0.2s ease, stroke 0.2s ease;
  cursor: pointer;
  outline: none;
}

.ww1-country-polygon:hover, .ww2-country-polygon:hover {
  filter: none !important;
}

.ww1-country-polygon.central:hover {
  filter: none !important;
}

.ww2-country-polygon.axis:hover {
  filter: none !important;
}

/* Superpower Tactical Map Pins */
.ww1-superpower-pin {
  cursor: pointer;
  background: none;
  border: none;
}

.superpower-pin-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 10, 18, 0.92);
  border: 1.5px solid var(--ww1-gold);
  border-radius: 20px;
  padding: 3px 8px 3px 4px;
  backdrop-filter: blur(10px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
}

.superpower-pin-wrapper:hover {
  transform: scale(1.1) translateY(-2px);
  background: rgba(14, 22, 38, 0.98);
  border-color: #ffffff;
}

.superpower-pin-flag {
  width: 22px;
  height: 15px;
  border-radius: 3px;
  object-fit: cover;
}

.superpower-pin-name {
  font-family: var(--font-hud);
  font-size: 0.82rem;
  font-weight: 900;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* Modals & Dossier Backdrops */
.historical-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.88);
  backdrop-filter: blur(14px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 20px;
}

.historical-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.historical-dossier-card {
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  background: linear-gradient(135deg, rgba(12, 18, 32, 0.98), rgba(6, 10, 18, 0.99));
  border: 1.5px solid var(--ww1-border);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ww2-theme .historical-dossier-card {
  border-color: var(--ww2-border);
}

.historical-modal-backdrop.open .historical-dossier-card {
  transform: translateY(0) scale(1);
}

.dossier-header {
  position: relative;
  padding: 30px 32px 22px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dossier-nation-info {
  display: flex;
  align-items: center;
  gap: 18px;
}

.dossier-flag-img {
  width: 72px;
  height: 48px;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.2);
}

.dossier-title-block h2 {
  margin: 0 0 4px;
  font-family: var(--font-hud);
  font-size: 2rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.1;
}

.dossier-faction-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-family: var(--font-hud);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-close-dossier {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close-dossier:hover {
  background: #ff4444;
  border-color: #ff4444;
  transform: rotate(90deg);
}

.dossier-body {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dossier-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.dossier-stat-cell {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px 18px;
}

.dossier-stat-label {
  font-size: 0.78rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.dossier-stat-val {
  font-family: var(--font-hud);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ww1-cyan);
}

.ww2-theme .dossier-stat-val {
  color: var(--ww2-amber);
}

/* 1v1 Versus Modal Styling */
.versus-grid-layout {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}

.versus-country-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.versus-select {
  background: rgba(14, 21, 36, 0.95);
  border: 1px solid var(--ww1-border);
  color: #ffffff;
  font-family: var(--font-hud);
  font-size: 1.1rem;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 10px;
  margin-top: 12px;
  width: 100%;
  cursor: pointer;
}

.versus-badge-vs {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ww1-gold), #ff3366);
  color: #ffffff;
  font-family: var(--font-hud);
  font-size: 1.3rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(255, 183, 3, 0.5);
}

.versus-metric-row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.versus-bar-container {
  display: flex;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

/* Compare Coalitions Modal Styling */
.coalition-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.coalition-side-card {
  border-radius: 18px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
}

.coalition-side-card.entente {
  border-color: rgba(0, 243, 255, 0.4);
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.08), rgba(8, 14, 24, 0.95));
}

.coalition-side-card.central {
  border-color: rgba(255, 183, 3, 0.4);
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.08), rgba(8, 14, 24, 0.95));
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .historical-subnav-bar {
    padding: 0 12px;
  }
  .subnav-links-row {
    overflow-x: auto;
  }
  .historical-top-hud {
    top: 114px;
    right: 12px;
  }
  .historical-layer-dock {
    top: auto;
    bottom: 120px;
    left: 12px;
    max-width: 160px;
  }
  .historical-timeline-bar {
    padding: 10px 14px;
  }
  .timeline-years-row {
    flex-wrap: wrap;
  }
  .versus-grid-layout {
    grid-template-columns: 1fr;
  }
  .coalition-comparison-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   APPLE-STANDARD HISTORICAL COUNTRY PROFILE EXTENSION (WW1 & WW2)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Quick Country Search in Hero */
.cp-top-search-wrap {
  width: 100%;
  max-width: 620px;
  margin: 0 auto 20px;
  position: relative;
  z-index: 50;
}
.cp-top-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(14, 21, 36, 0.88);
  border: 1.5px solid rgba(0, 243, 255, 0.35);
  border-radius: 14px;
  padding: 8px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 243, 255, 0.05);
  backdrop-filter: blur(16px);
  transition: all 0.2s ease;
}
.gold-black-theme .cp-top-search-box {
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 215, 0, 0.05);
}
.cp-top-search-box:focus-within {
  border-color: #00f3ff;
  box-shadow: 0 12px 30px rgba(0, 243, 255, 0.25);
}
.gold-black-theme .cp-top-search-box:focus-within {
  border-color: #ffd700;
  box-shadow: 0 12px 30px rgba(255, 215, 0, 0.25);
}
.cp-top-search-input {
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.95rem;
  width: 100%;
  outline: none;
}
.cp-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: #0c1220;
  border: 1.5px solid rgba(0, 243, 255, 0.35);
  border-radius: 14px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gold-black-theme .cp-search-dropdown {
  border-color: rgba(255, 215, 0, 0.4);
}
.cp-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #ffffff;
  transition: all 0.15s;
}
.cp-search-item:hover {
  background: rgba(0, 243, 255, 0.15);
}
.gold-black-theme .cp-search-item:hover {
  background: rgba(255, 215, 0, 0.15);
}

/* Floating Dock Strip for Historical Pages */
.country-profile-body .cp-hero-strip {
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 1240px !important;
  margin: 24px auto 0 !important;
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  background: rgba(14, 21, 36, 0.85) !important;
  backdrop-filter: blur(25px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 20px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7) !important;
  padding: 8px 0 !important;
}

@media (max-width: 1024px) {
  .country-profile-body .cp-hero-strip {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
@media (max-width: 640px) {
  .country-profile-body .cp-hero-strip {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

.country-profile-body .cp-strip-cell {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 12px 14px !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.country-profile-body .cp-strip-cell:last-child {
  border-right: none !important;
}

.country-profile-body .cp-strip-cell:hover {
  background: rgba(0, 243, 255, 0.08) !important;
  transform: translateY(-2px);
}

.gold-black-theme .country-profile-body .cp-strip-cell:hover {
  background: rgba(255, 215, 0, 0.08) !important;
}

.country-profile-body .cp-strip-icon {
  font-size: 1.4rem !important;
  margin-bottom: 4px !important;
}

.country-profile-body .cp-strip-value {
  font-family: var(--font-hud, monospace) !important;
  font-size: 1.35rem !important;
  font-weight: 900 !important;
  color: #ffffff !important;
  margin-bottom: 3px !important;
}

.country-profile-body .cp-strip-label {
  font-family: var(--font-hud, monospace) !important;
  font-size: 0.68rem !important;
  font-weight: 800 !important;
  color: #94a3b8 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  text-align: center !important;
}
