* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #071018;
  color: #eaf2ff;
}

body {
  min-height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  background: linear-gradient(180deg, #0d1722 0%, #0b1420 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  overflow-x: hidden;
  backdrop-filter: blur(8px);
}

.sidebar-logo,
.sidebar img {
  display: block;
  width: 100%;
  max-width: 220px;
  margin: 0 auto 10px;
  image-rendering: pixelated;
}

.panel {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

h1,
h2 {
  margin: 0 0 12px;
}

h1 {
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0.02em;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.muted {
  color: #9fb3c8;
  margin-top: 0;
  line-height: 1.45;
}

.field {
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #b8cae0;
}

input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #111d2a;
  color: white;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  border-color: rgba(159, 197, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

button {
  border: 0;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  background: #3b82f6;
  color: white;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.18);
}

button:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

button.secondary {
  background: #223244;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.status {
  margin-top: 12px;
  color: #9fb3c8;
  font-size: 14px;
  line-height: 1.45;
}

/* CARDS / RESULTADOS */

.results {
  display: grid;
  gap: 12px;
}

.card {
  background: linear-gradient(180deg, #111d2a 0%, #0f1924 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.3;
}

.card a {
  color: #9fc5ff;
  text-decoration: none;
}

.card a:hover {
  text-decoration: underline;
}

.meta {
  font-size: 13px;
  color: #9fb3c8;
  margin-bottom: 8px;
  line-height: 1.35;
  word-break: break-word;
}

.summary {
  font-size: 14px;
  color: #d7e5f6;
  line-height: 1.5;
}

.results-panel {
  background: rgba(255, 255, 255, 0.015);
}

.brief-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.brief-item {
  padding: 8px 0;
}

.brief-item a {
  display: inline-block;
  font-size: 14px;
  line-height: 1.4;
}

/* PANEL DERECHO */

.main-panel {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at center, rgba(27, 52, 92, 0.18) 0%, rgba(5, 11, 18, 0) 50%),
    linear-gradient(180deg, #050b12 0%, #07111b 100%);
}

.live-feed-section {
  flex: 0 0 auto;
  padding: 12px 16px 0;
}

.map-section {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 420px;
  padding: 12px 16px 12px;
  display: flex;
}

.dashboard-section {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0 16px 16px;
}

/* MAPA */

.map-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 420px;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(27, 52, 92, 0.18) 0%, rgba(5, 11, 18, 0) 50%),
    linear-gradient(180deg, #050b12 0%, #07111b 100%);
  border: 1px solid rgba(120, 170, 255, 0.12);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  transform: none;
}

/* LIVE FEED */

.retro-ticker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.retro-ticker-top {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  z-index: auto;
  pointer-events: none;
}

.retro-ticker-label {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(20, 4, 4, 0.94);
  border: 1px solid rgba(255, 80, 80, 0.28);
  color: #ff9f9f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(255, 60, 60, 0.12);
}

.retro-ticker-window {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(24, 6, 6, 0.96) 0%, rgba(12, 2, 2, 0.96) 100%);
  border: 1px solid rgba(255, 70, 70, 0.24);
  min-height: 34px;
  display: flex;
  align-items: center;
  box-shadow:
    inset 0 0 20px rgba(255, 0, 0, 0.06),
    0 0 14px rgba(255, 30, 30, 0.1);
}

.retro-ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 56px;
  white-space: nowrap;
  padding-left: 100%;
  animation: retroTickerScroll 95s linear infinite;
}

.retro-ticker-item {
  color: #ff3b3b;
  font-family: "Courier New", monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 4px rgba(255, 0, 0, 0.5),
    0 0 8px rgba(255, 0, 0, 0.22);
  text-transform: uppercase;
}

@keyframes retroTickerScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* DASHBOARD */

.top-dashboard {
  position: relative;
  padding: 0;
  pointer-events: auto;
}

.hud-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
  align-items: stretch;
}

.hud-card {
  background: linear-gradient(180deg, rgba(10, 18, 30, 0.9) 0%, rgba(8, 14, 24, 0.88) 100%);
  border: 1px solid rgba(120, 170, 255, 0.16);
  border-radius: 16px;
  padding: 12px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  min-width: 0;
  min-height: 100%;
}

.hud-title {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #8fc0ff;
  text-transform: uppercase;
}

.hud-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hud-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hud-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hud-grid-1 {
  grid-template-columns: 1fr;
}

.hud-metric {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
  min-height: 66px;
}

.hud-label {
  display: block;
  font-size: 11px;
  color: #94a9c6;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  line-height: 1.25;
}

.hud-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #edf5ff;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}

.hud-change {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
}

.hud-stack {
  display: grid;
  gap: 10px;
}

.hud-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hud-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.hud-line .hud-label {
  flex: 0 0 46%;
  margin-bottom: 0;
}

.hud-line .hud-value {
  flex: 1 1 auto;
  text-align: right;
}

.hud-ticker {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(10, 18, 30, 0.9) 0%, rgba(8, 14, 24, 0.88) 100%);
  border: 1px solid rgba(120, 170, 255, 0.16);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.ticker-item {
  font-size: 13px;
  color: #dbe8ff;
}

.status-card .hud-value,
.risk-card .hud-value,
.hotspots-card .hud-value {
  font-size: 14px;
}

.hotspots-card .hud-grid {
  grid-template-columns: 1fr;
}

.hotspots-card .hud-metric {
  padding: 8px 10px;
  min-height: 58px;
}

/* POPUP DE PAÍS */

.country-popup {
  min-width: 250px;
  max-width: 290px;
  color: #dbe8ff;
}

.country-popup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.country-popup-title {
  font-size: 15px;
  font-weight: 800;
  color: #eaf2ff;
}

.country-popup-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #8fc0ff;
  text-transform: uppercase;
}

.country-popup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.country-popup-metric {
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.country-popup-label {
  display: block;
  font-size: 10px;
  color: #94a9c6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}

.country-popup-value {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #edf5ff;
  line-height: 1.3;
  word-break: break-word;
}

.country-popup-topic {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  line-height: 1.45;
  color: #cfe0f7;
}

/* MARCADORES MAPA */

.news-marker {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.news-marker:hover {
  transform: scale(1.08);
}

/* RADAR GLOBAL */

.radar-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.radar-title {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8fc0ff;
  font-weight: 800;
}

.radar-box {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: center;
}

.radar-svg {
  width: 220px;
  height: 220px;
  display: block;
  filter: drop-shadow(0 0 10px rgba(120, 170, 255, 0.08));
}

.radar-meta {
  display: grid;
  gap: 8px;
}

.radar-stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.radar-stat-label {
  font-size: 12px;
  color: #9fb3c8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.radar-stat-value {
  font-size: 13px;
  font-weight: 700;
  color: #edf5ff;
}

/* RADAR POR PAÍS */

.country-radar-card {
  background: linear-gradient(180deg, #111d2a 0%, #0f1924 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.country-radar-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.country-radar-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.country-radar-meta {
  font-size: 12px;
  color: #9fb3c8;
  text-align: right;
}

.country-radar-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 14px;
  align-items: center;
}

.country-radar-visual svg {
  width: 170px;
  height: 170px;
  display: block;
  margin: 0 auto;
}

.country-radar-stats {
  display: grid;
  gap: 8px;
}

/* MAPLIBRE POPUP OVERRIDE */

.maplibregl-popup-content {
  background: linear-gradient(180deg, #101924 0%, #0b131c 100%);
  color: #edf5ff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.maplibregl-popup-close-button {
  color: #dbe8ff;
  font-size: 16px;
}

.maplibregl-popup-tip {
  border-top-color: #0b131c !important;
  border-bottom-color: #0b131c !important;
}

/* ESCRITORIO GRANDE */

@media (min-width: 901px) {
  .map-section {
    min-height: 520px;
  }

  .map-wrap {
    min-height: 520px;
  }
}

@media (min-width: 1500px) {
  .app {
    grid-template-columns: 400px 1fr;
  }

  .map-section {
    min-height: 560px;
  }

  .map-wrap {
    min-height: 560px;
  }

  .hud-row {
    grid-template-columns: repeat(5, minmax(190px, 1fr));
  }
}

/* ESCRITORIO MEDIO */

@media (max-width: 1480px) {
  .hud-row {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .hotspots-card {
    grid-column: span 2;
  }
}

@media (max-width: 1280px) {
  .hud-row {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .status-card,
  .risk-card,
  .hotspots-card {
    grid-column: auto;
  }

  .hud-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 340px 1fr;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 19px;
  }

  .hud-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud-row {
    grid-template-columns: repeat(2, minmax(165px, 1fr));
  }

  .hud-value {
    font-size: 14px;
  }
}

/* MÓVIL / TABLET */

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .sidebar {
    order: 1;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .main-panel {
    order: 2;
    display: flex;
    flex-direction: column;
    min-height: auto;
  }

  .live-feed-section {
    order: 1;
    padding: 10px;
  }

  .map-section {
    order: 2;
    padding: 10px;
    min-height: auto;
  }

  .dashboard-section {
    order: 3;
    padding: 0 10px 12px;
  }

  .map-wrap {
    min-height: 58vh;
    height: 58vh;
    border-radius: 14px;
  }

  #map {
    transform: none;
  }

  .retro-ticker-wrap {
    gap: 8px;
  }

  .retro-ticker-label {
    padding: 6px 8px;
    font-size: 10px;
  }

  .retro-ticker-window {
    min-height: 32px;
  }

  .retro-ticker-item {
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  .hud-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hud-card {
    padding: 10px;
    border-radius: 12px;
  }

  .hud-grid,
  .hud-grid-compact,
  .hud-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud-grid-1 {
    grid-template-columns: 1fr;
  }

  .hud-metric {
    min-height: 58px;
    padding: 8px;
  }

  .hud-value {
    font-size: 13px;
  }

  .hud-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .hud-line .hud-label,
  .hud-line .hud-value {
    text-align: left;
    flex: none;
  }

  .hud-ticker {
    padding: 8px 10px;
  }

  .ticker-item {
    font-size: 12px;
  }

  .country-popup {
    min-width: 220px;
    max-width: 250px;
  }

  .country-popup-grid {
    grid-template-columns: 1fr 1fr;
  }

  .radar-box {
    grid-template-columns: 1fr;
  }

  .radar-svg {
    width: 100%;
    max-width: 240px;
    height: auto;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
  }

  .country-radar-layout {
    grid-template-columns: 1fr;
  }

  .country-radar-visual svg {
    width: 180px;
    height: 180px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 18px;
  }
}

/* MÓVIL PEQUEÑO */

@media (max-width: 640px) {
  .panel {
    padding: 14px;
  }

  .map-wrap {
    min-height: 60vh;
    height: 60vh;
  }

  .hud-row {
    grid-template-columns: 1fr;
  }

  .hud-grid,
  .hud-grid-compact,
  .hud-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud-value {
    font-size: 13px;
  }

  .retro-ticker-item {
    font-size: 11px;
    letter-spacing: 0.04em;
  }

  .country-popup-grid {
    grid-template-columns: 1fr;
  }
}
