/* ═══════════════════════════════════════════════════════════════════════════
   APPLE-STANDARD ULTRA-REALISTIC DESIGN SYSTEM (COUNTRY PROFILE v9)
   Glassmorphism 2.0 · SF Pro Micro-Icon Typography · Billion-Dollar Aesthetics
   ═══════════════════════════════════════════════════════════════════════════ */

.country-page {
  --bg: var(--bg-primary, #06090e);
  --surface: var(--bg-card, rgba(15, 23, 38, 0.75));
  --surface-hover: var(--panel-highlight, rgba(22, 34, 54, 0.85));
  --accent: #22d3ee;
  --text: var(--color-text-primary, #ffffff);
  --text-secondary: var(--color-text-secondary, #94a3b8);
  --muted: var(--color-text-tertiary, rgba(255, 255, 255, 0.65));
  --hair: var(--border-color, rgba(255, 255, 255, 0.08));
  --hud: var(--font-hud, 'BBC Reith Sans', 'Reith Sans', 'JetBrains Mono', 'Rajdhani', monospace);
  --display: var(--font-display, 'BBC Reith Sans', 'Reith Sans', 'Plus Jakarta Sans', 'Outfit', 'Inter', sans-serif);
  --sans: var(--font-body, 'BBC Reith Sans', 'Reith Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
  --c-color: var(--accent);
  --c-rgb: 34, 211, 238;
  
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-family: var(--display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.country-page * {
  box-sizing: border-box;
}

/* GLOBAL STRICT ICON SIZING SAFEGUARDS - PREVENTS ANY SVG FROM BLOWING UP */
.country-page svg {
  max-width: 100%;
}

.cp-svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cp-svg-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  max-width: 24px;
  max-height: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HERO SECTION (Apple Vision Pro / iOS 18 Glass Studio)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-hero {
  position: relative;
  width: 100%;
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: visible;
  background: radial-gradient(circle at 50% 0%, rgba(var(--c-rgb), 0.15) 0%, var(--bg) 75%);
  padding: 40px 24px 120px 24px;
}

.cp-particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.cp-hero-flag-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.06;
  filter: blur(12px) saturate(180%);
}

.cp-hero-glow {
  position: absolute;
  inset: -80px;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(var(--c-rgb), 0.18) 0%, transparent 65%);
  animation: appleGlowBreathe 7s ease-in-out infinite alternate;
}

@keyframes appleGlowBreathe {
  0% { opacity: 0.6; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1.06); }
}

.cp-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: 
    radial-gradient(ellipse at 50% 60%, transparent 30%, var(--bg) 100%),
    linear-gradient(180deg, transparent 40%, var(--bg) 100%);
}

.cp-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  animation: appleHeroEnter 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow: visible;
}

@keyframes appleHeroEnter {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cp-hero-flag {
  width: 220px;
  height: 146px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 20px 50px rgba(0, 0, 0, 0.8),
    0 0 50px rgba(var(--c-rgb), 0.35);
  background: rgba(15, 23, 38, 0.6);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.cp-hero-flag:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 30px 70px rgba(0, 0, 0, 0.9),
    0 0 80px rgba(var(--c-rgb), 0.55);
}

.cp-hero-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Country hero stability */
.cp-hero-glow {
  animation: none !important;
  transition: none !important;
  transform: none !important;
  opacity: 0.72 !important;
}

.cp-hero-flag-bg {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

.cp-hero-title {
  font-family: var(--display);
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-align: center;
  text-shadow: 
    0 0 30px rgba(var(--c-rgb), 0.6),
    0 6px 24px rgba(0, 0, 0, 0.9);
}

.cp-hero-subtitle {
  font-family: var(--hud);
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
  text-transform: none;
  letter-spacing: 2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.cp-hero-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}

.cp-badge {
  font-family: var(--hud);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 6px 18px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  white-space: nowrap;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 8px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.cp-badge-code {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  letter-spacing: 3px;
}

.cp-badge-rank {
  color: var(--accent);
  background: rgba(var(--c-rgb), 0.15);
  border-color: rgba(var(--c-rgb), 0.4);
  text-shadow: 0 0 12px rgba(var(--c-rgb), 0.6);
}

.cp-badge-tier {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* Apple Floating Dock Strip */
.cp-hero-strip {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 1200px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: rgba(12, 18, 30, 0.82);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 20px 50px rgba(0, 0, 0, 0.75);
  padding: 10px 0;
}

.cp-strip-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cp-strip-cell:last-child {
  border-right: none;
}

.cp-strip-cell:hover {
  background: rgba(var(--c-rgb), 0.12);
}

.cp-strip-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(var(--c-rgb), 0.14);
  border: 1px solid rgba(var(--c-rgb), 0.35);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(var(--c-rgb), 0.25);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cp-strip-cell:hover .cp-strip-icon {
  background: rgba(var(--c-rgb), 0.28);
  box-shadow: 0 0 25px rgba(var(--c-rgb), 0.6);
  transform: scale(1.12) translateY(-2px);
}

.cp-strip-icon svg {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  filter: drop-shadow(0 0 4px rgba(var(--c-rgb), 0.5));
}

.cp-strip-value {
  font-family: var(--hud);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-light, var(--accent, #ffffff));
  margin-bottom: 2px;
  text-shadow: 0 0 16px var(--glow, rgba(0, 113, 227, 0.4));
}

.cp-strip-label {
  font-family: var(--hud);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   APPLE GLASS SECTIONS & CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-section {
  position: relative;
  padding: 55px 40px;
  max-width: 1300px;
  margin: 0 auto;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.cp-section-title {
  font-family: var(--hud);
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: #ffffff;
  text-shadow: 0 0 12px var(--c-color);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cp-section-title svg {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
}

.cp-section-line {
  width: 100%;
  height: 1px;
  margin-bottom: 28px;
  background: linear-gradient(90deg, rgba(var(--c-rgb), 0.6), transparent 80%);
  opacity: 0.4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   OVERVIEW & MAP (Apple Maps Dark HUD)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-overview-grid {
  display: grid;
  grid-template-columns: 44% 56%;
  gap: 28px;
  align-items: stretch;
}

.cp-map-wrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 16px 40px rgba(0, 0, 0, 0.7);
  background: rgba(12, 18, 30, 0.7);
}

.cp-map {
  height: 480px;
  width: 100%;
  background: #090e17;
}

.cp-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: rgba(12, 18, 30, 0.75);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 16px 40px rgba(0, 0, 0, 0.7);
}

.cp-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.25s ease;
  opacity: 0;
  transform: translateX(18px);
}

.cp-field.cp-visible {
  opacity: 1;
  transform: translateX(0);
}

.cp-field:hover {
  background: rgba(var(--c-rgb), 0.1);
  border-color: rgba(var(--c-rgb), 0.3);
}

.cp-field-label {
  font-family: var(--hud);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cp-field-label .cp-svg-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  opacity: 0.9;
}

.cp-field-label .cp-svg-icon svg {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
}

.cp-field-value {
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CULTURE & RELIGION CARDS (COMPACT ELEGANT APPLE MICRO-CARDS)
   ═══════════════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════════
   CULTURE & RELIGION (APPLE GLASSMORPHIC 2.0 SPECIFICATION)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-culture {
  position: relative;
  width: 100%;
}

.cp-religion-row {
  width: 100%;
  margin-bottom: 28px;
  background: rgba(12, 18, 30, 0.82);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 26px 28px;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 20px 50px rgba(0, 0, 0, 0.75);
}

.cp-col-label {
  font-family: var(--hud);
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 0 10px var(--c-color);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cp-bar-wrap {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 12px 30px rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.cp-bar {
  display: flex;
  height: 54px;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
}

.cp-bar-group {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cp-bar-seg-parent {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  position: relative;
  z-index: 1;
}

.cp-bar-seg-label {
  font-family: var(--hud);
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.cp-bar-seg-children {
  position: absolute;
  inset: 0;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.cp-bar-group.cp-expanded .cp-bar-seg-children {
  opacity: 1;
  pointer-events: auto;
}

.cp-bar-seg-child {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Micro-Cards below Religion Bar */
.cp-rel-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 22px;
}

.cp-rel-card-wrapper {
  position: relative;
  z-index: 1;
  flex: 0 1 auto;
}

.cp-rel-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cp-rel-card:hover,
.cp-rel-card.cp-highlight {
  background: rgba(var(--c-rgb), 0.16);
  border-color: rgba(var(--c-rgb), 0.5);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 16px 36px rgba(0, 0, 0, 0.7),
    0 0 25px rgba(var(--c-rgb), 0.35);
}

.cp-rel-icon-circle {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cp-rel-icon-circle svg,
.cp-rel-icon-circle img {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  display: block;
}

.cp-rel-name {
  font-family: var(--hud);
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

.cp-rel-pct {
  font-family: var(--hud);
  font-size: 1rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(var(--c-rgb), 0.5);
}

/* Sub-denominations dropdown */
.cp-rel-card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  flex: 0 1 auto;
}

/* Sub-denominations dropdown - Inline layout to prevent overflow clipping */
.cp-rel-card-subs {
  display: none;
  width: 100%;
  min-width: 200px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2);
  flex-direction: column;
  gap: 6px;
}

.cp-rel-card-wrapper.cp-expanded .cp-rel-card-subs {
  display: flex;
}

.cp-rel-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cp-rel-expand-icon {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  margin-left: 8px;
  transition: transform 0.3s ease;
}

.cp-rel-card-wrapper.cp-expanded .cp-rel-expand-icon {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Ethnic & Languages Grid */
.cp-culture-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.cp-culture-col {
  min-width: 0;
  background: rgba(12, 18, 30, 0.82);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 24px 26px;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 20px 50px rgba(0, 0, 0, 0.75);
}

/* Legend items for Ethnic Groups */
.cp-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  margin-top: 18px;
}

/* Language Bars */
.cp-lang-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.cp-lang-name {
  font-family: var(--hud);
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.cp-lang-track {
  flex: 1;
  height: 24px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.cp-lang-fill {
  height: 100%;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.cp-lang-pct {
  font-family: var(--hud);
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DETAILED INTELLIGENCE GRID (Apple Spec Grid with Strict Micro-Icons)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-ext-group {
  margin-bottom: 28px;
  background: rgba(12, 18, 30, 0.75);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 20px 24px;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 16px 40px rgba(0, 0, 0, 0.75);
}

.cp-ext-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cp-ext-title {
  font-family: var(--hud);
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: #ffffff;
  text-shadow: 0 0 10px var(--c-color);
}

.cp-ext-icon {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cp-ext-icon svg {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
}

.cp-ext-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.cp-ext-cell {
  flex: 0 1 calc(33.333% - 12px);
  min-width: 210px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.cp-ext-cell:hover {
  background: rgba(var(--c-rgb), 0.1);
  border-color: rgba(var(--c-rgb), 0.35);
  transform: translateY(-2px);
}

.cp-ext-cell-icon {
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* STRICT OVERRIDE FOR ALL CELL SVGS - FORBID GIANT SIZES */
.cp-ext-cell-icon svg,
.cp-ext-cell svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  display: block !important;
}

.cp-ext-cell-label {
  font-family: var(--hud);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-ext-cell-value {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POWER INDEX & GAUGES (CENTERED INNER CIRCLE VALUE & ICON)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-power-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 36px;
  background: rgba(12, 18, 30, 0.75);
  backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 20px 50px rgba(0, 0, 0, 0.75);
}

.cp-arc-above svg,
.cp-arc-below svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
}

.cp-gauges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.cp-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 120px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cp-gauge:hover {
  background: rgba(var(--c-rgb), 0.1);
  border-color: rgba(var(--c-rgb), 0.35);
  transform: translateY(-3px);
}

.cp-gauge-circle-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cp-gauge-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.cp-gauge-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
  text-align: center;
}

.cp-gauge-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.cp-gauge-icon svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
}

.cp-gauge-val {
  font-family: var(--hud);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-light, var(--accent, #ffffff));
  text-shadow: 0 0 10px var(--glow, rgba(0, 0, 0, 0.9));
  line-height: 1;
}

.cp-gauge-name {
  font-family: var(--hud);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ffffff;
  text-shadow: 0 0 8px var(--c-color);
  text-align: center;
}

.cp-gauge-rank {
  font-family: var(--hud);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  padding: 2px 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CATEGORY RANKING BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-rankings-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.cp-rank-card {
  flex: 0 1 180px;
  height: 180px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(12, 18, 30, 0.75);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 12px 30px rgba(0, 0, 0, 0.6);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cp-rank-card:hover {
  border-color: rgba(var(--c-rgb), 0.45);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 20px 45px rgba(0, 0, 0, 0.8),
    0 0 30px rgba(var(--c-rgb), 0.3);
}

.cp-rank-icon-wrap {
  width: 38px;
  height: 38px;
  max-width: 38px;
  max-height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--c-rgb), 0.12);
}

.cp-rank-icon-wrap svg {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
}

.cp-rank-num {
  font-family: var(--hud);
  font-size: 2.8rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
}

.cp-rank-card.gold {
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 215, 0, 0.4), 0 0 25px rgba(255, 215, 0, 0.2);
}

.cp-rank-card.gold .cp-rank-num {
  color: #FFD700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HQ RETURN BUTTON & FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-hq {
  width: 100%;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  margin-top: 30px;
}

.cp-hq-btn {
  position: relative;
  z-index: 1;
  padding: 14px 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(var(--c-rgb), 0.14);
  border: 1px solid rgba(var(--c-rgb), 0.4);
  border-radius: 24px;
  color: #ffffff;
  font-family: var(--hud);
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-decoration: none;
  backdrop-filter: blur(20px);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 12px 30px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cp-hq-btn:hover {
  background: rgba(var(--c-rgb), 0.3);
  border-color: rgba(var(--c-rgb), 0.8);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 20px 50px rgba(0, 0, 0, 0.75),
    0 0 40px rgba(var(--c-rgb), 0.6);
  transform: translateY(-2px) scale(1.02);
}

/* Responsive Rules */
@media (max-width: 1024px) {
  .cp-overview-grid { grid-template-columns: 1fr; }
  .cp-power-top { grid-template-columns: 1fr; }
  .cp-ext-grid { grid-template-columns: repeat(2, 1fr); }
  .cp-hero-strip { grid-template-columns: repeat(3, 1fr); bottom: 12px; }
}

@media (max-width: 768px) {
  .cp-section { padding: 40px 16px; }
  .cp-hero-strip { grid-template-columns: repeat(3, 1fr); position: relative; bottom: 0; transform: none; left: 0; width: 100%; border-radius: 18px; margin-top: 20px; }
  .cp-culture-grid { grid-template-columns: 1fr; }
  .cp-ext-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CIRCULAR LITERACY RING STYLES
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-literacy-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 24px auto 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cp-literacy-ring {
  position: absolute;
  inset: 0;
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.cp-literacy-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 8px;
}

.cp-literacy-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8px;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 0 8px var(--accent));
}

.cp-literacy-val {
  position: relative;
  z-index: 2;
  font-family: var(--hud);
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95);
  line-height: 1;
  margin-top: -16px;
}

.cp-literacy-label {
  position: relative;
  z-index: 2;
  font-family: var(--hud);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-top: 8px;
  text-align: center;
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════════
   BILLION-DOLLAR LUXURY DESIGN SYSTEM & HIGH-PERFORMANCE ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --luxury-gold-glow: rgba(212, 175, 55, 0.35);
  --luxury-cyan-glow: rgba(0, 240, 255, 0.35);
  --luxury-emerald-glow: rgba(16, 185, 129, 0.35);
  --luxury-rose-glow: rgba(244, 63, 94, 0.35);
  --luxury-purple-glow: rgba(168, 85, 247, 0.35);
  --glass-backdrop-blur: blur(24px) saturate(190%);
  --ease-out-cubic: cubic-bezier(0.16, 1, 0.3, 1);
}

/* 60fps Micro Keyframe Animations */
@keyframes luxury-pulse {
  0%, 100% {
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.15), inset 0 0 10px rgba(212, 175, 55, 0.05);
  }
  50% {
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.3), inset 0 0 18px rgba(212, 175, 55, 0.12);
  }
}

@keyframes shimmer-sweep {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes bar-grow {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes float-badge {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes capital-ring-ping {
  0% {
    transform: scale(0.8);
    opacity: 0.9;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Billion Dollar Glassmorphic Cards */
.luxury-glass-card {
  background: var(--bg-card, rgba(15, 15, 13, 0.85)) !important;
  backdrop-filter: var(--glass-backdrop-blur);
  -webkit-backdrop-filter: var(--glass-backdrop-blur);
  border: 1px solid var(--border-color, rgba(212, 175, 55, 0.2)) !important;
  border-radius: 16px !important;
  transition: all 0.35s var(--ease-out-cubic) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  will-change: transform, box-shadow;
}

.luxury-glass-card:hover {
  transform: translateY(-4px) scale(1.008) !important;
  border-color: var(--border-glow, rgba(212, 175, 55, 0.55)) !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6), 0 0 25px var(--luxury-gold-glow) !important;
}

/* Map Leaflet Enhancements (Preserving Map Functionality) */
.leaflet-container {
  background: #060605 !important;
  font-family: inherit !important;
}

.leaflet-control-zoom {
  border: 1px solid rgba(212, 175, 55, 0.3) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  backdrop-filter: var(--glass-backdrop-blur) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-control-zoom a {
  background: rgba(12, 12, 10, 0.85) !important;
  color: #d4af37 !important;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2) !important;
  transition: all 0.25s var(--ease-out-cubic) !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(212, 175, 55, 0.2) !important;
  color: #ffffff !important;
  box-shadow: inset 0 0 10px rgba(212, 175, 55, 0.4) !important;
}

.leaflet-popup-content-wrapper {
  background: rgba(10, 10, 8, 0.92) !important;
  backdrop-filter: var(--glass-backdrop-blur) !important;
  border: 1px solid rgba(212, 175, 55, 0.4) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 20px rgba(212, 175, 55, 0.25) !important;
  color: #ffffff !important;
}

.leaflet-popup-tip {
  background: rgba(10, 10, 8, 0.92) !important;
  border: 1px solid rgba(212, 175, 55, 0.4) !important;
}

/* Capital City Pulsing Marker */
.capital-pulse-marker {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Top 3 Rankings Gold / Silver / Bronze Badges */
.rank-badge-1 {
  background: linear-gradient(135deg, #ffe066 0%, #d4af37 50%, #997a15 100%) !important;
  color: #000000 !important;
  font-weight: 900 !important;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.6) !important;
  border: 1px solid #fff5cc !important;
  animation: float-badge 3s ease-in-out infinite !important;
}

.rank-badge-2 {
  background: linear-gradient(135deg, #ffffff 0%, #c0c0c0 50%, #707070 100%) !important;
  color: #000000 !important;
  font-weight: 900 !important;
  box-shadow: 0 0 15px rgba(192, 192, 192, 0.5) !important;
  border: 1px solid #ffffff !important;
}

.rank-badge-3 {
  background: linear-gradient(135deg, #f6a87a 0%, #cd7f32 50%, #7c4412 100%) !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  box-shadow: 0 0 15px rgba(205, 127, 50, 0.5) !important;
  border: 1px solid #ffd1a4 !important;
}

/* Winner Highlights for Comparison Mode */
.cmp-winner-glow {
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25), inset 0 0 10px rgba(16, 185, 129, 0.1) !important;
  border-radius: 12px !important;
  transition: all 0.3s var(--ease-out-cubic) !important;
}

.cmp-winner-glow:hover {
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.4), inset 0 0 15px rgba(16, 185, 129, 0.2) !important;
}

/* Detail Row Hover Polish */
.cp-field, .detail-item {
  transition: all 0.25s var(--ease-out-cubic) !important;
}

.cp-field:hover, .detail-item:hover {
  background: rgba(212, 175, 55, 0.08) !important;
  transform: translateX(4px) !important;
  border-left: 3px solid #d4af37 !important;
}

/* ═══════════════════════════════════════════════════════════════════
    APPLE HIG STANDARDS LIGHT MODE (PURE-WHITE / LIGHT THEME)
   Ultra-Clean macOS Sonoma & iOS 18 Light Aesthetic
   ═══════════════════════════════════════════════════════════════════ */

[data-theme="pure-white"], [data-theme="light"] {
  --bg-primary:          #f5f5f7 !important;
  --bg-secondary:        #ffffff !important;
  --bg-card:             rgba(255, 255, 255, 0.78) !important;
  --border-color:        rgba(0, 0, 0, 0.08) !important;
  --border-glow:         rgba(0, 113, 227, 0.35) !important;
  --panel-highlight:     rgba(0, 113, 227, 0.06) !important;
  --header-bg:           rgba(255, 255, 255, 0.82) !important;
  --control-bg:          rgba(255, 255, 255, 0.88) !important;
  --color-cyan:          #0071e3 !important;
  --color-cyan-dim:      #005bb5 !important;
  --color-text-primary:  #1d1d1f !important;
  --color-text-secondary:#6e6e73 !important;
  --color-text-tertiary: #86868b !important;
  --accent-rgb:          0, 113, 227 !important;
  --grid-rgb:            0, 113, 227 !important;
  --shadow-glow:         0 8px 30px rgba(0, 0, 0, 0.04), 0 0 20px rgba(0, 113, 227, 0.08) !important;
  --map-bg:              #e5e5ea !important;
  --glass-backdrop-blur: blur(30px) saturate(190%) !important;
}

/* Base Typography & Background */
[data-theme="pure-white"] body, [data-theme="light"] body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  background-color: #f5f5f7 !important;
  background-image: none !important;
  color: #1d1d1f !important;
}

/* Apple Translucent Top Navigation Bar */
[data-theme="pure-white"] .top-nav, [data-theme="light"] .top-nav,
[data-theme="pure-white"] header, [data-theme="light"] header {
  background: rgba(255, 255, 255, 0.82) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.03) !important;
  backdrop-filter: blur(28px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
}

/* Apple Glassmorphic Elevated Cards & Panels */
[data-theme="pure-white"] .glass-card, [data-theme="light"] .glass-card,
[data-theme="pure-white"] .cmp-card, [data-theme="light"] .cmp-card,
[data-theme="pure-white"] .team-top, [data-theme="light"] .team-top,
[data-theme="pure-white"] .modal-content, [data-theme="light"] .modal-content,
[data-theme="pure-white"] .profile-card, [data-theme="light"] .profile-card,
[data-theme="pure-white"] .luxury-glass-card, [data-theme="light"] .luxury-glass-card,
[data-theme="pure-white"] .side-panel, [data-theme="light"] .side-panel {
  background: rgba(255, 255, 255, 0.84) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
  color: #1d1d1f !important;
  border-radius: 18px !important;
  backdrop-filter: blur(28px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] .glass-card:hover, [data-theme="light"] .glass-card:hover,
[data-theme="pure-white"] .cmp-card:hover, [data-theme="light"] .cmp-card:hover,
[data-theme="pure-white"] .luxury-glass-card:hover, [data-theme="light"] .luxury-glass-card:hover {
  transform: translateY(-4px) scale(1.006) !important;
  border-color: rgba(0, 113, 227, 0.35) !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08), 0 0 25px rgba(0, 113, 227, 0.15) !important;
}

/* Apple Typography Headers & Titles */
[data-theme="pure-white"] h1, [data-theme="light"] h1,
[data-theme="pure-white"] h2, [data-theme="light"] h2,
[data-theme="pure-white"] h3, [data-theme="light"] h3,
[data-theme="pure-white"] .card-title, [data-theme="light"] .card-title,
[data-theme="pure-white"] .nav-brand span, [data-theme="light"] .nav-brand span {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif !important;
  font-weight: 700 !important;
  color: #1d1d1f !important;
  -webkit-text-fill-color: #1d1d1f !important;
  background: none !important;
  text-shadow: none !important;
  letter-spacing: -0.015em !important;
}

/* Apple iOS Segmented Control Tabs & Navigation Links */
[data-theme="pure-white"] .nav-link, [data-theme="light"] .nav-link {
  color: #6e6e73 !important;
  font-weight: 500 !important;
  border-radius: 980px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] .nav-link:hover, [data-theme="light"] .nav-link:hover,
[data-theme="pure-white"] .nav-link.active, [data-theme="light"] .nav-link.active {
  color: #0071e3 !important;
  background: rgba(0, 113, 227, 0.08) !important;
  text-shadow: none !important;
}

[data-theme="pure-white"] .tab-btn, [data-theme="light"] .tab-btn {
  color: #515154 !important;
  background: rgba(120, 120, 128, 0.08) !important;
  border: none !important;
  border-radius: 980px !important;
  font-weight: 500 !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] .tab-btn.active, [data-theme="light"] .tab-btn.active {
  background: #ffffff !important;
  color: #0071e3 !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  border-radius: 980px !important;
}

/* Apple Action Buttons & Pill Controls */
[data-theme="pure-white"] button:not(.modal-close-btn):not(.btn-clear):not(.selected-item-remove):not(.btn-clear-countries),
[data-theme="light"] button:not(.modal-close-btn):not(.btn-clear):not(.selected-item-remove):not(.btn-clear-countries) {
  font-weight: 600 !important;
  background: #0071e3 !important;
  border: none !important;
  color: #ffffff !important;
  border-radius: 980px !important;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.28) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] button:not(.modal-close-btn):not(.btn-clear):hover,
[data-theme="light"] button:not(.modal-close-btn):not(.btn-clear):hover {
  background: #0077ed !important;
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.38) !important;
}

/* Apple Form Controls & Search Inputs */
[data-theme="pure-white"] input, [data-theme="light"] input,
[data-theme="pure-white"] select, [data-theme="light"] select,
[data-theme="pure-white"] .search-input, [data-theme="light"] .search-input {
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 12px !important;
  color: #1d1d1f !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] input:focus, [data-theme="light"] input:focus,
[data-theme="pure-white"] select:focus, [data-theme="light"] select:focus,
[data-theme="pure-white"] .search-input:focus, [data-theme="light"] .search-input:focus {
  border-color: #0071e3 !important;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18) !important;
  outline: none !important;
}

/* Apple Table & Detail Row Hover Highlights */
[data-theme="pure-white"] .cp-field, [data-theme="light"] .cp-field,
[data-theme="pure-white"] .detail-item, [data-theme="light"] .detail-item,
[data-theme="pure-white"] tr, [data-theme="light"] tr {
  color: #1d1d1f !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] .cp-field:hover, [data-theme="light"] .cp-field:hover,
[data-theme="pure-white"] .detail-item:hover, [data-theme="light"] .detail-item:hover,
[data-theme="pure-white"] tr:hover, [data-theme="light"] tr:hover {
  background: rgba(0, 113, 227, 0.05) !important;
  border-left: 3px solid #0071e3 !important;
  color: #1d1d1f !important;
}

/* Apple Leaflet Map Controls Light Mode */
[data-theme="pure-white"] .leaflet-control-zoom, [data-theme="light"] .leaflet-control-zoom {
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

[data-theme="pure-white"] .leaflet-control-zoom a, [data-theme="light"] .leaflet-control-zoom a {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #0071e3 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="pure-white"] .leaflet-control-zoom a:hover, [data-theme="light"] .leaflet-control-zoom a:hover {
  background: #0071e3 !important;
  color: #ffffff !important;
}

[data-theme="pure-white"] .leaflet-popup-content-wrapper, [data-theme="light"] .leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(25px) saturate(190%) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12) !important;
  color: #1d1d1f !important;
}

[data-theme="pure-white"] .leaflet-popup-tip, [data-theme="light"] .leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.95) !important;
}


/* ═══════════════════════════════════════════════════════════════════
    MASTER APPLE HIG LIGHT MODE (COMPREHENSIVE PIXEL-PERFECT SUITE)
   Covers 100% of all UI components, modals, cards, charts, bars,
   tables, dropdowns, popups, sidebars, footers & map controls!
   ═══════════════════════════════════════════════════════════════════ */

[data-theme="pure-white"], [data-theme="light"] {
  --bg-primary:          #f5f5f7 !important;
  --bg-secondary:        #ffffff !important;
  --bg-card:             rgba(255, 255, 255, 0.82) !important;
  --border-color:        rgba(0, 0, 0, 0.08) !important;
  --border-glow:         rgba(0, 113, 227, 0.35) !important;
  --panel-highlight:     rgba(0, 113, 227, 0.06) !important;
  --header-bg:           rgba(255, 255, 255, 0.84) !important;
  --control-bg:          rgba(255, 255, 255, 0.9) !important;
  --color-cyan:          #0071e3 !important;
  --color-cyan-dim:      #005bb5 !important;
  --color-text-primary:  #1d1d1f !important;
  --color-text-secondary:#6e6e73 !important;
  --color-text-tertiary: #86868b !important;
  --accent-rgb:          0, 113, 227 !important;
  --grid-rgb:            0, 113, 227 !important;
  --shadow-glow:         0 8px 30px rgba(0, 0, 0, 0.04), 0 0 20px rgba(0, 113, 227, 0.08) !important;
  --map-bg:              #e5e5ea !important;
  --glass-backdrop-blur: blur(30px) saturate(190%) !important;
}

/* 1. Global Page Background & Body Typography */
[data-theme="pure-white"] body, [data-theme="light"] body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  background-color: #f5f5f7 !important;
  background-image: none !important;
  color: #1d1d1f !important;
}

/* 2. Top Header Navigation Bar & Menus */
[data-theme="pure-white"] .top-nav, [data-theme="light"] .top-nav,
[data-theme="pure-white"] header, [data-theme="light"] header,
[data-theme="pure-white"] .nav-header, [data-theme="light"] .nav-header {
  background: rgba(255, 255, 255, 0.84) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.03) !important;
  backdrop-filter: blur(28px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
}

[data-theme="pure-white"] .nav-dropdown, [data-theme="light"] .nav-dropdown,
[data-theme="pure-white"] .menu-dropdown, [data-theme="light"] .menu-dropdown,
[data-theme="pure-white"] .search-dropdown, [data-theme="light"] .search-dropdown {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12) !important;
  border-radius: 16px !important;
  backdrop-filter: blur(30px) saturate(190%) !important;
}

/* 3. All Cards, Panels, Modals, Sections */
[data-theme="pure-white"] .glass-card, [data-theme="light"] .glass-card,
[data-theme="pure-white"] .cmp-card, [data-theme="light"] .cmp-card,
[data-theme="pure-white"] .team-top, [data-theme="light"] .team-top,
[data-theme="pure-white"] .modal-content, [data-theme="light"] .modal-content,
[data-theme="pure-white"] .profile-card, [data-theme="light"] .profile-card,
[data-theme="pure-white"] .luxury-glass-card, [data-theme="light"] .luxury-glass-card,
[data-theme="pure-white"] .side-panel, [data-theme="light"] .side-panel,
[data-theme="pure-white"] .bottom-panel, [data-theme="light"] .bottom-panel,
[data-theme="pure-white"] .dock-panel, [data-theme="light"] .dock-panel,
[data-theme="pure-white"] .intel-panel, [data-theme="light"] .intel-panel,
[data-theme="pure-white"] .culture-card, [data-theme="light"] .culture-card,
[data-theme="pure-white"] .ally-card, [data-theme="light"] .ally-card,
[data-theme="pure-white"] .war-quote-box, [data-theme="light"] .war-quote-box,
[data-theme="pure-white"] .stat-card, [data-theme="light"] .stat-card,
[data-theme="pure-white"] .rankings-container, [data-theme="light"] .rankings-container {
  background: rgba(255, 255, 255, 0.86) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
  color: #1d1d1f !important;
  border-radius: 18px !important;
  backdrop-filter: blur(28px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] .glass-card:hover, [data-theme="light"] .glass-card:hover,
[data-theme="pure-white"] .cmp-card:hover, [data-theme="light"] .cmp-card:hover,
[data-theme="pure-white"] .luxury-glass-card:hover, [data-theme="light"] .luxury-glass-card:hover,
[data-theme="pure-white"] .stat-card:hover, [data-theme="light"] .stat-card:hover {
  transform: translateY(-4px) scale(1.006) !important;
  border-color: rgba(0, 113, 227, 0.35) !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08), 0 0 25px rgba(0, 113, 227, 0.15) !important;
}

/* 4. Headings & Typography */
[data-theme="pure-white"] h1, [data-theme="light"] h1,
[data-theme="pure-white"] h2, [data-theme="light"] h2,
[data-theme="pure-white"] h3, [data-theme="light"] h3,
[data-theme="pure-white"] h4, [data-theme="light"] h4,
[data-theme="pure-white"] .card-title, [data-theme="light"] .card-title,
[data-theme="pure-white"] .nav-brand span, [data-theme="light"] .nav-brand span,
[data-theme="pure-white"] .cp-badge-rank, [data-theme="light"] .cp-badge-rank {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif !important;
  font-weight: 700 !important;
  color: #1d1d1f !important;
  -webkit-text-fill-color: #1d1d1f !important;
  background: none !important;
  text-shadow: none !important;
  letter-spacing: -0.015em !important;
}

[data-theme="pure-white"] p, [data-theme="light"] p,
[data-theme="pure-white"] span:not(.cp-bar-seg-label):not(.badge-text), [data-theme="light"] span:not(.cp-bar-seg-label):not(.badge-text),
[data-theme="pure-white"] label, [data-theme="light"] label,
[data-theme="pure-white"] .sub-text, [data-theme="light"] .sub-text {
  color: #1d1d1f !important;
}

/* 5. Apple Segmented Controls & Buttons */
[data-theme="pure-white"] .nav-link, [data-theme="light"] .nav-link {
  color: #515154 !important;
  font-weight: 500 !important;
  border-radius: 980px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] .nav-link:hover, [data-theme="light"] .nav-link:hover,
[data-theme="pure-white"] .nav-link.active, [data-theme="light"] .nav-link.active {
  color: #0071e3 !important;
  background: rgba(0, 113, 227, 0.08) !important;
  text-shadow: none !important;
}

[data-theme="pure-white"] .tab-btn, [data-theme="light"] .tab-btn,
[data-theme="pure-white"] .compare-nav-btn, [data-theme="light"] .compare-nav-btn {
  color: #515154 !important;
  background: rgba(120, 120, 128, 0.08) !important;
  border: none !important;
  border-radius: 980px !important;
  font-weight: 500 !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] .tab-btn.active, [data-theme="light"] .tab-btn.active,
[data-theme="pure-white"] .compare-nav-btn.active, [data-theme="light"] .compare-nav-btn.active {
  background: #ffffff !important;
  color: #0071e3 !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  border-radius: 980px !important;
}

[data-theme="pure-white"] button:not(.modal-close-btn):not(.btn-clear):not(.selected-item-remove):not(.btn-clear-countries),
[data-theme="light"] button:not(.modal-close-btn):not(.btn-clear):not(.selected-item-remove):not(.btn-clear-countries) {
  font-weight: 600 !important;
  background: #0071e3 !important;
  border: none !important;
  color: #ffffff !important;
  border-radius: 980px !important;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.28) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] button:not(.modal-close-btn):not(.btn-clear):hover,
[data-theme="light"] button:not(.modal-close-btn):not(.btn-clear):hover {
  background: #0077ed !important;
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.38) !important;
}

/* 6. Form Controls & Inputs */
[data-theme="pure-white"] input, [data-theme="light"] input,
[data-theme="pure-white"] select, [data-theme="light"] select,
[data-theme="pure-white"] .search-input, [data-theme="light"] .search-input,
[data-theme="pure-white"] .country-suggestion-item, [data-theme="light"] .country-suggestion-item {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 12px !important;
  color: #1d1d1f !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] input:focus, [data-theme="light"] input:focus,
[data-theme="pure-white"] select:focus, [data-theme="light"] select:focus,
[data-theme="pure-white"] .search-input:focus, [data-theme="light"] .search-input:focus {
  border-color: #0071e3 !important;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18) !important;
  outline: none !important;
}

/* 7. Country Detail Page Overview Fields & Demographics Cards */
[data-theme="pure-white"] .cp-field, [data-theme="light"] .cp-field,
[data-theme="pure-white"] .detail-item, [data-theme="light"] .detail-item,
[data-theme="pure-white"] tr, [data-theme="light"] tr,
[data-theme="pure-white"] .cp-rel-card-wrapper, [data-theme="light"] .cp-rel-card-wrapper {
  color: #1d1d1f !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="pure-white"] .cp-field-label, [data-theme="light"] .cp-field-label,
[data-theme="pure-white"] .cp-rel-name, [data-theme="light"] .cp-rel-name {
  color: #1d1d1f !important;
  font-weight: 600 !important;
}

[data-theme="pure-white"] .cp-field-value, [data-theme="light"] .cp-field-value,
[data-theme="pure-white"] .cp-rel-pct, [data-theme="light"] .cp-rel-pct {
  color: #0071e3 !important;
  font-weight: 700 !important;
}

[data-theme="pure-white"] .cp-field:hover, [data-theme="light"] .cp-field:hover,
[data-theme="pure-white"] .detail-item:hover, [data-theme="light"] .detail-item:hover,
[data-theme="pure-white"] tr:hover, [data-theme="light"] tr:hover {
  background: rgba(0, 113, 227, 0.05) !important;
  border-left: 3px solid #0071e3 !important;
  color: #1d1d1f !important;
}

/* 8. Leaflet Map Controls & Popups */
[data-theme="pure-white"] .leaflet-control-zoom, [data-theme="light"] .leaflet-control-zoom {
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

[data-theme="pure-white"] .leaflet-control-zoom a, [data-theme="light"] .leaflet-control-zoom a {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #0071e3 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="pure-white"] .leaflet-control-zoom a:hover, [data-theme="light"] .leaflet-control-zoom a:hover {
  background: #0071e3 !important;
  color: #ffffff !important;
}

[data-theme="pure-white"] .leaflet-popup-content-wrapper, [data-theme="light"] .leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(25px) saturate(190%) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12) !important;
  color: #1d1d1f !important;
}

[data-theme="pure-white"] .leaflet-popup-tip, [data-theme="light"] .leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.95) !important;
}

/* 9. Corporate Footer */
[data-theme="pure-white"] .corporate-footer, [data-theme="light"] .corporate-footer,
[data-theme="pure-white"] footer, [data-theme="light"] footer {
  background: rgba(255, 255, 255, 0.88) !important;
  border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: #6e6e73 !important;
}


/* ═══════════════════════════════════════════════════════════════════
    APPLE HIG LIGHT MODE (UNIVERSAL PIXEL-PERFECT SUITE)
   Catches 100% of all UI cards, SVG elements, modal guides, popovers,
   ranks, compare containers, context menus & country cards!
   ═══════════════════════════════════════════════════════════════════ */

[data-theme="pure-white"], [data-theme="light"] {
  --bg-primary:          #f5f5f7 !important;
  --bg-secondary:        #ffffff !important;
  --bg-card:             rgba(255, 255, 255, 0.9) !important;
  --border-color:        rgba(0, 0, 0, 0.08) !important;
  --border-glow:         rgba(0, 113, 227, 0.35) !important;
  --panel-highlight:     rgba(0, 113, 227, 0.06) !important;
  --header-bg:           rgba(255, 255, 255, 0.85) !important;
  --control-bg:          rgba(255, 255, 255, 0.92) !important;
  --color-cyan:          #0071e3 !important;
  --color-cyan-dim:      #005bb5 !important;
  --color-text-primary:  #1d1d1f !important;
  --color-text-secondary:#6e6e73 !important;
  --color-text-tertiary: #86868b !important;
  --accent-rgb:          0, 113, 227 !important;
  --grid-rgb:            0, 113, 227 !important;
  --shadow-glow:         0 8px 30px rgba(0, 0, 0, 0.04), 0 0 20px rgba(0, 113, 227, 0.08) !important;
  --map-bg:              #e5e5ea !important;
  --glass-backdrop-blur: blur(30px) saturate(190%) !important;
}

/* 1. Force Light Backgrounds on All Container Divs, Cards & Modals */
[data-theme="pure-white"] div:not(.leaflet-tile-container *):not(.capital-pulse-marker *),
[data-theme="light"] div:not(.leaflet-tile-container *):not(.capital-pulse-marker *) {
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="pure-white"] .intel-country-card, [data-theme="light"] .intel-country-card,
[data-theme="pure-white"] .intel-col, [data-theme="light"] .intel-col,
[data-theme="pure-white"] .gtab-visual, [data-theme="light"] .gtab-visual,
[data-theme="pure-white"] .gmodal-content, [data-theme="light"] .gmodal-content,
[data-theme="pure-white"] .guide-modal-content, [data-theme="light"] .guide-modal-content,
[data-theme="pure-white"] .pct-context-menu, [data-theme="light"] .pct-context-menu,
[data-theme="pure-white"] .country-card-small, [data-theme="light"] .country-card-small,
[data-theme="pure-white"] .rankings-row, [data-theme="light"] .rankings-row,
[data-theme="pure-white"] .rank-card, [data-theme="light"] .rank-card,
[data-theme="pure-white"] .compare-card, [data-theme="light"] .compare-card {
  background: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04) !important;
  color: #1d1d1f !important;
  border-radius: 16px !important;
  backdrop-filter: blur(28px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
}

/* 2. Text Override for Context Menus, Intel Section Cards & SVG Guide Items */
[data-theme="pure-white"] .intel-country-title strong, [data-theme="light"] .intel-country-title strong,
[data-theme="pure-white"] .intel-data-label, [data-theme="light"] .intel-data-label,
[data-theme="pure-white"] .intel-col-title, [data-theme="light"] .intel-col-title,
[data-theme="pure-white"] .source-item, [data-theme="light"] .source-item,
[data-theme="pure-white"] .pct-context-menu *, [data-theme="light"] .pct-context-menu * {
  color: #1d1d1f !important;
}

[data-theme="pure-white"] .intel-data-val, [data-theme="light"] .intel-data-val,
[data-theme="pure-white"] .intel-overview-item strong, [data-theme="light"] .intel-overview-item strong {
  color: #0071e3 !important;
  font-weight: 700 !important;
}

/* 3. SVG Elements in Light Mode */
[data-theme="pure-white"] svg text, [data-theme="light"] svg text {
  fill: #1d1d1f !important;
}

[data-theme="pure-white"] svg rect[fill="rgba(15,15,13,0.96)"], [data-theme="light"] svg rect[fill="rgba(15,15,13,0.96)"],
[data-theme="pure-white"] svg rect[fill="rgba(8,8,6,0.96)"], [data-theme="light"] svg rect[fill="rgba(8,8,6,0.96)"] {
  fill: #ffffff !important;
  stroke: rgba(0, 0, 0, 0.12) !important;
}

[data-theme="pure-white"] .selected-item, [data-theme="light"] .selected-item,
[data-theme="pure-white"] .modal-header, [data-theme="light"] .modal-header,
[data-theme="pure-white"] .modal-content, [data-theme="light"] .modal-content,
[data-theme="pure-white"] .modal-grid-item, [data-theme="light"] .modal-grid-item,
[data-theme="pure-white"] .profile-grid-card, [data-theme="light"] .profile-grid-card,
[data-theme="pure-white"] .pgc-value, [data-theme="light"] .pgc-value,
[data-theme="pure-white"] .percent-badge-input, [data-theme="light"] .percent-badge-input,
[data-theme="pure-white"] .empty-state, [data-theme="light"] .empty-state {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #1d1d1f !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="pure-white"] .percent-badge-input, [data-theme="light"] .percent-badge-input {
  color: #0071e3 !important;
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

[data-theme="pure-white"] .modal-grid-item:hover, [data-theme="light"] .modal-grid-item:hover,
[data-theme="pure-white"] .profile-grid-card:hover, [data-theme="light"] .profile-grid-card:hover {
  background: rgba(0, 113, 227, 0.05) !important;
  border-color: #0071e3 !important;
}

/* BRUTE FORCE LIGHT THEME OVERRIDES FOR STUBBORN CARDS AND CONTAINERS */
[data-theme="pure-white"] .intel-card,
[data-theme="pure-white"] .hero-overlay,
[data-theme="pure-white"] .cp-hero-overlay,
[data-theme="pure-white"] .military-stats,
[data-theme="pure-white"] .economy-stats,
[data-theme="pure-white"] .demographics-stats,
[data-theme="pure-white"] .card,
[data-theme="pure-white"] .panel,
[data-theme="pure-white"] .glass-panel,
[data-theme="pure-white"] .modal,
[data-theme="pure-white"] .modal-body,
[data-theme="pure-white"] .stats-grid,
[data-theme="pure-white"] .stat-card,
[data-theme="pure-white"] .chart-container,
[data-theme="pure-white"] .table-container,
[data-theme="pure-white"] .ranking-card,
[data-theme="pure-white"] .compare-card,
[data-theme="pure-white"] .country-header,
[data-theme="pure-white"] .overview-container,
[data-theme="pure-white"] .detail-section,
[data-theme="pure-white"] .data-table,
[data-theme="pure-white"] .data-row,
[data-theme="pure-white"] .info-window,
[data-theme="pure-white"] .map-tooltip,
[data-theme="pure-white"] .leaflet-popup-content-wrapper,
[data-theme="pure-white"] .leaflet-popup-tip,
[data-theme="light"] .intel-card,
[data-theme="light"] .hero-overlay,
[data-theme="light"] .cp-hero-overlay,
[data-theme="light"] .military-stats,
[data-theme="light"] .economy-stats,
[data-theme="light"] .demographics-stats,
[data-theme="light"] .card,
[data-theme="light"] .panel,
[data-theme="light"] .glass-panel,
[data-theme="light"] .modal,
[data-theme="light"] .modal-body,
[data-theme="light"] .stats-grid,
[data-theme="light"] .stat-card,
[data-theme="light"] .chart-container,
[data-theme="light"] .table-container,
[data-theme="light"] .ranking-card,
[data-theme="light"] .compare-card,
[data-theme="light"] .country-header,
[data-theme="light"] .overview-container,
[data-theme="light"] .detail-section,
[data-theme="light"] .data-table,
[data-theme="light"] .data-row,
[data-theme="light"] .info-window,
[data-theme="light"] .map-tooltip,
[data-theme="light"] .leaflet-popup-content-wrapper,
[data-theme="light"] .leaflet-popup-tip {
    background-color: var(--bg-card, #ffffff) !important;
    background: var(--bg-card, #ffffff) !important;
    color: var(--text, #1d1d1f) !important;
    border-color: var(--border-color, rgba(0,0,0,0.1)) !important;
}

[data-theme="pure-white"] .text-muted,
[data-theme="pure-white"] .subtext,
[data-theme="pure-white"] .label,
[data-theme="light"] .text-muted,
[data-theme="light"] .subtext,
[data-theme="light"] .label {
    color: var(--text-secondary, #515154) !important;
}

[data-theme="pure-white"] th,
[data-theme="pure-white"] td,
[data-theme="light"] th,
[data-theme="light"] td {
    border-bottom-color: var(--border-color, rgba(0,0,0,0.1)) !important;
}

/* Fix for right click context menus and popups from JS that might generate raw styles */
[data-theme="pure-white"] .context-menu,
[data-theme="pure-white"] .custom-context-menu,
[data-theme="pure-white"] #context-menu,
[data-theme="light"] .context-menu,
[data-theme="light"] .custom-context-menu,
[data-theme="light"] #context-menu,
[data-theme="pure-white"] .leaflet-popup-content,
[data-theme="light"] .leaflet-popup-content {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.15) !important;
    color: #1d1d1f !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .context-menu-item:hover,
[data-theme="pure-white"] .custom-context-menu li:hover,
[data-theme="pure-white"] #context-menu li:hover,
[data-theme="light"] .context-menu-item:hover,
[data-theme="light"] .custom-context-menu li:hover,
[data-theme="light"] #context-menu li:hover {
    background: rgba(0, 113, 227, 0.1) !important;
    color: #0071e3 !important;
}

/* Right click menu specific selectors inside app.js */
[data-theme="pure-white"] .intel-popup,
[data-theme="light"] .intel-popup,
[data-theme="pure-white"] .intel-popup-content,
[data-theme="light"] .intel-popup-content,
[data-theme="pure-white"] .country-popup,
[data-theme="light"] .country-popup {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #1d1d1f !important;
    border: 1px solid rgba(0,0,0,0.15) !important;
}

/* SPECIFIC OVERRIDE FOR RIGHT CLICK CONTEXT MENU */
[data-theme="pure-white"] #pct-context-menu,
[data-theme="light"] #pct-context-menu,
[data-theme="pure-white"] #pct-context-menu * ,
[data-theme="light"] #pct-context-menu * {
    background-color: rgba(255, 255, 255, 0.95) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #1d1d1f !important;
    text-shadow: none !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] #pct-context-menu .pct-menu-header,
[data-theme="light"] #pct-context-menu .pct-menu-header {
    background: rgba(0,0,0,0.05) !important;
    border-bottom: 1px solid rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] #pct-context-menu .pct-menu-action-btn:hover,
[data-theme="light"] #pct-context-menu .pct-menu-action-btn:hover {
    background: rgba(0, 113, 227, 0.1) !important;
    color: #0071e3 !important;
}

[data-theme="pure-white"] #pct-context-menu .pct-menu-action-btn svg,
[data-theme="light"] #pct-context-menu .pct-menu-action-btn svg {
    stroke: currentColor !important;
}

/* Specific override for Dossier popup */
[data-theme="pure-white"] #geopolitical-dossier,
[data-theme="light"] #geopolitical-dossier {
    background: rgba(255,255,255,0.95) !important;
    border: 1px solid rgba(0,0,0,0.15) !important;
    color: #1d1d1f !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
}

[data-theme="pure-white"] #geopolitical-dossier .dossier-header,
[data-theme="light"] #geopolitical-dossier .dossier-header {
    background: rgba(0,0,0,0.05) !important;
    border-bottom: 1px solid rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] #geopolitical-dossier .dossier-info-val,
[data-theme="light"] #geopolitical-dossier .dossier-info-val,
[data-theme="pure-white"] #geopolitical-dossier .dossier-name,
[data-theme="light"] #geopolitical-dossier .dossier-name {
    color: #1d1d1f !important;
    text-shadow: none !important;
}

[data-theme="pure-white"] #geopolitical-dossier .dossier-info-key,
[data-theme="light"] #geopolitical-dossier .dossier-info-key {
    color: #515154 !important;
}

[data-theme="pure-white"] #geopolitical-dossier .dossier-action-btn,
[data-theme="light"] #geopolitical-dossier .dossier-action-btn {
    background: rgba(0,0,0,0.05) !important;
    color: #1d1d1f !important;
    border-color: rgba(0,0,0,0.15) !important;
}

[data-theme="pure-white"] #geopolitical-dossier .dossier-action-btn:hover,
[data-theme="light"] #geopolitical-dossier .dossier-action-btn:hover {
    background: rgba(0, 113, 227, 0.1) !important;
    color: #0071e3 !important;
    border-color: #0071e3 !important;
}

[data-theme="pure-white"] #geopolitical-dossier .dossier-action-btn.primary,
[data-theme="light"] #geopolitical-dossier .dossier-action-btn.primary {
    background: #0071e3 !important;
    color: #fff !important;
}

/* DYNAMIC AUTO-GENERATED LIGHT THEME OVERRIDES FOR EVERY DARK ELEMENT */
[data-theme="pure-white"] .cp-hero-flag, [data-theme="light"] .cp-hero-flag {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] /* Apple Floating Dock Strip */
.cp-hero-strip, [data-theme="light"] /* Apple Floating Dock Strip */
.cp-hero-strip {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .cp-map-wrap, [data-theme="light"] .cp-map-wrap {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .cp-map, [data-theme="light"] .cp-map {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .cp-info, [data-theme="light"] .cp-info {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .cp-religion-row, [data-theme="light"] .cp-religion-row {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .cp-bar-wrap, [data-theme="light"] .cp-bar-wrap {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] /* Sub-denominations dropdown - Inline layout to prevent overflow clipping */
.cp-rel-card-subs, [data-theme="light"] /* Sub-denominations dropdown - Inline layout to prevent overflow clipping */
.cp-rel-card-subs {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .cp-culture-col, [data-theme="light"] .cp-culture-col {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .cp-lang-track, [data-theme="light"] .cp-lang-track {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] /* ═══════════════════════════════════════════════════════════════════════════
   DETAILED INTELLIGENCE GRID (Apple Spec Grid with Strict Micro-Icons)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-ext-group, [data-theme="light"] /* ═══════════════════════════════════════════════════════════════════════════
   DETAILED INTELLIGENCE GRID (Apple Spec Grid with Strict Micro-Icons)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-ext-group {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] /* ═══════════════════════════════════════════════════════════════════════════
   POWER INDEX & GAUGES (CENTERED INNER CIRCLE VALUE & ICON)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-power-top, [data-theme="light"] /* ═══════════════════════════════════════════════════════════════════════════
   POWER INDEX & GAUGES (CENTERED INNER CIRCLE VALUE & ICON)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-power-top {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .cp-rank-card, [data-theme="light"] .cp-rank-card {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] /* Map Leaflet Enhancements (Preserving Map Functionality) */
.leaflet-container, [data-theme="light"] /* Map Leaflet Enhancements (Preserving Map Functionality) */
.leaflet-container {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .leaflet-control-zoom a, [data-theme="light"] .leaflet-control-zoom a {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .leaflet-popup-content-wrapper, [data-theme="light"] .leaflet-popup-content-wrapper {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] .leaflet-popup-tip, [data-theme="light"] .leaflet-popup-tip {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] /* Base Typography & Background */
[data-theme="pure-white"] body, [data-theme="light"] /* Base Typography & Background */
[data-theme="pure-white"] body {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] /* Apple Action Buttons & Pill Controls */
[data-theme="pure-white"] button:not(.modal-close-btn):not(.btn-clear):not(.selected-item-remove):not(.btn-clear-countries), [data-theme="light"] /* Apple Action Buttons & Pill Controls */
[data-theme="pure-white"] button:not(.modal-close-btn):not(.btn-clear):not(.selected-item-remove):not(.btn-clear-countries) {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="pure-white"] /* 1. Global Page Background & Body Typography */
[data-theme="pure-white"] body, [data-theme="light"] /* 1. Global Page Background & Body Typography */
[data-theme="pure-white"] body {
    background: var(--bg-card, #ffffff) !important;
    color: var(--color-text-primary, #1d1d1f) !important;
    border-color: rgba(0,0,0,0.1) !important;
}


/* ===================================================================
   PURE WHITE THEME OVERRIDES IN COUNTRY.CSS (PURGES SHADOWS & CARDS)
   =================================================================== */

body[data-theme="pure-white"] *,
body[data-theme="pure-white"] *::before,
body[data-theme="pure-white"] *::after,
body[data-theme="light"] *,
body[data-theme="light"] *::before,
body[data-theme="light"] *::after {
  text-shadow: none !important;
  filter: none !important;
}

body[data-theme="pure-white"] .cp-hero,
body[data-theme="pure-white"] .cp-hero-card,
body[data-theme="pure-white"] .cp-hero-strip,
body[data-theme="pure-white"] .cp-strip-cell,
body[data-theme="pure-white"] .cp-info,
body[data-theme="pure-white"] .cp-map-wrap,
body[data-theme="pure-white"] .cp-map,
body[data-theme="pure-white"] .cp-ext-group,
body[data-theme="pure-white"] .cp-ext-cell,
body[data-theme="pure-white"] .cp-rank-card,
body[data-theme="pure-white"] .cp-rel-card,
body[data-theme="pure-white"] .cp-gauge,
body[data-theme="pure-white"] .cp-power-top,
body[data-theme="pure-white"] .cp-section,
body[data-theme="light"] .cp-hero,
body[data-theme="light"] .cp-hero-card,
body[data-theme="light"] .cp-hero-strip,
body[data-theme="light"] .cp-strip-cell,
body[data-theme="light"] .cp-info,
body[data-theme="light"] .cp-map-wrap,
body[data-theme="light"] .cp-map,
body[data-theme="light"] .cp-ext-group,
body[data-theme="light"] .cp-ext-cell,
body[data-theme="light"] .cp-rank-card,
body[data-theme="light"] .cp-rel-card,
body[data-theme="light"] .cp-gauge,
body[data-theme="light"] .cp-power-top,
body[data-theme="light"] .cp-section {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04) !important;
  background: #ffffff !important;
  color: #1d1d1f !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

body[data-theme="pure-white"] .cp-gauge-val,
body[data-theme="light"] .cp-gauge-val {
  color: #1d1d1f !important;
  -webkit-text-fill-color: #1d1d1f !important;
}

body[data-theme="pure-white"] .cp-gauge-name,
body[data-theme="light"] .cp-gauge-name {
  color: #6e6e73 !important;
  -webkit-text-fill-color: #6e6e73 !important;
}

body[data-theme="pure-white"] .cp-hero-title,
body[data-theme="light"] .cp-hero-title {
  color: #1d1d1f !important;
  -webkit-text-fill-color: #1d1d1f !important;
}

body[data-theme="pure-white"] .cp-hero-subtitle,
body[data-theme="light"] .cp-hero-subtitle {
  color: #6e6e73 !important;
  -webkit-text-fill-color: #6e6e73 !important;
}

body[data-theme="pure-white"] #cp-map,
body[data-theme="pure-white"] .cp-map-wrap,
body[data-theme="light"] #cp-map,
body[data-theme="light"] .cp-map-wrap {
  background: #f8fafc !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   PERFECT CENTERING & STYLING FOR RETURN TO HQ BUTTON & CANVAS
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-hq {
  width: 100% !important;
  max-width: 1200px !important;
  height: 120px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  position: relative !important;
  overflow: hidden !important;
  margin: 40px auto 30px auto !important;
  clear: both !important;
}

.cp-tactical-canvas {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
  z-index: 0 !important;
}

.cp-hq-btn {
  position: relative !important;
  z-index: 2 !important;
  margin: 0 auto !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
}

/* Apple Pure White Theme styling for Return to HQ button */
body[data-theme="pure-white"] .cp-hq-btn,
body[data-theme="light"] .cp-hq-btn {
  background: #0071e3 !important;
  color: #ffffff !important;
  border: 1px solid #0071e3 !important;
  box-shadow: 0 4px 16px rgba(0, 113, 227, 0.25) !important;
  text-shadow: none !important;
  font-weight: 700 !important;
  border-radius: 30px !important;
  padding: 14px 40px !important;
}

body[data-theme="pure-white"] .cp-hq-btn span,
body[data-theme="light"] .cp-hq-btn span {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

body[data-theme="pure-white"] .cp-hq-btn:hover,
body[data-theme="light"] .cp-hq-btn:hover {
  background: #0077ed !important;
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.35) !important;
  transform: translateY(-2px) !important;
}


/* BBC Editorial Typography Rules for Country Profile */
.country-page .cp-header-title {
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: -0.03em;
}

.country-page .cp-stat-val,
.country-page .cp-gauge-val,
.country-page .cp-field-val,
.country-page .cp-rank-num,
.country-page .cp-rank-val {
  font-variant-numeric: tabular-nums lining-nums;
}


/* Country Specific Dynamic Palette Polish: Charts, Gauges & Numbers */
.country-page .cp-stat-val,
.country-page .cp-gauge-val,
.country-page .cp-rank-num,
.country-page .cp-power-tier,
.country-page .cp-field-label {
  color: var(--accent-light, var(--accent, inherit));
}

.country-page .cp-strip-cell svg,
.country-page .cp-field-label svg {
  color: var(--accent-light, var(--accent, currentColor));
}

.country-page .cp-tab-btn.active {
  border-color: var(--accent) !important;
  color: var(--accent-light, var(--accent, #ffffff)) !important;
  box-shadow: 0 0 15px var(--glow, rgba(0, 113, 227, 0.35)) !important;
}

.country-page .cp-bar-fill,
.country-page .cp-res-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-light, var(--accent))) !important;
}
