/* ============================================================
   SUB-NAV — Barra de navegación compacta, estética = home
   ============================================================ */

/* ── Contenedor fijo ─────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  transform: translateZ(0);   /* capa GPU propia — sobre el canvas WebGL */
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
}

nav.top-nav {
  display: block !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  justify-content: unset;
  box-shadow: none !important;
}

/* ── Fila centrada ───────────────────────────────────────── */
.section-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 0 12px;
  box-sizing: border-box;
  /* Sin overflow en desktop → dropdown no queda recortado en Y */
}

/* ── Wrapper ─────────────────────────────────────────────── */
.section-item {
  position: relative;
  flex-shrink: 0;
}

/* ── Botón — texto NEGRO sobre fondo de sección ──────────── */
.section-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  /* Desktop grande — mismo "peso visual" que el home */
  padding: 14px 34px;
  font-size: 1.05em;
  font-family: 'Fira Code', monospace;
  font-weight: bold;
  text-decoration: none;
  color: #000000;            /* letra negra — legible sobre cualquier fondo */
  border: 3px solid black;   /* reborde negro siempre */
  position: relative;
  z-index: 1;
  transition: color 0.35s ease-in, transform 0.3s ease, box-shadow 0.3s ease;
  white-space: nowrap;
  cursor: pointer;
  /* mismo text-shadow del home para profundidad */
  text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}

.section-btn:hover {
  transform: scale(1.06);
  border: 3px solid black;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

.dropdown-arrow {
  font-size: 0.75em;
  line-height: 1;
  transition: transform 0.2s;
}

/* ── Fondos por sección — exactos al home ────────────────── */
/* Solo background y border-color; el texto queda en #000000  */
.glob-war-btn  { background-color: red; }
.int-sec-btn   { background-color: darkblue;   color: #aad4ff; } /* azul oscuro → letra clara */
.climate-btn   { background-color: lightgreen; }
.eco-corp-btn  { background-color: yellow; }
.popl-up-btn   { background-color: orange; }

/* ── Hover — colores neón iguales al home ────────────────── */
.glob-war-btn:hover  { color: #39ff14; }
.int-sec-btn:hover   { color: #ff69b4; }
.climate-btn:hover   { color: #ff4500; }
.eco-corp-btn:hover  { color: #00fff2; }
.popl-up-btn:hover   { color: #0066ff; }

/* ── Botón activo: borde brillante ──────────────────────── */
.section-item.current .section-btn {
  box-shadow: 0 0 12px 3px rgba(0,0,0,0.5), 0 0 0 2px rgba(255,255,255,0.4);
}
.section-item.current:hover .dropdown-arrow,
.section-item.current.open  .dropdown-arrow {
  transform: rotate(180deg);
}

/* ── Dropdown ────────────────────────────────────────────── */
.section-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateZ(0);
  min-width: 200px;
  background: rgba(4, 4, 4, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 6px 0;
  z-index: 99999;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.85);
}

/* Puente para no perder hover al moverse al dropdown */
.section-item.current::after {
  content: '';
  position: absolute;
  top: 100%;
  left: -10px;
  right: -10px;
  height: 14px;
  z-index: 99998;
}

.section-item.current:hover .section-dropdown,
.section-item.current.open  .section-dropdown {
  display: block;
  animation: dropFade 0.14s ease;
}

@keyframes dropFade {
  from { opacity: 0; transform: translateX(-50%) translateY(-5px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.section-dropdown a {
  display: block;
  padding: 8px 18px;
  font-size: 0.75em;
  font-family: 'Fira Code', monospace;
  color: #ccc;
  text-decoration: none;
  text-shadow: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.section-dropdown a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ================================================================
   MÓVIL — Panel de detalle en la MITAD INFERIOR (≤ 768px)
   Sustituye el "display:none" del graphPanel por layout vertical
   ================================================================ */
@media (max-width: 768px) {
  /* Columna vertical: grafo arriba, detalle abajo */
  main.split-screen.show-detail {
    flex-direction: column !important;
    height: 100vh !important;
  }

  /* Grafo ocupa la mitad superior — NO se oculta */
  main.split-screen.show-detail #graphPanel {
    display: block !important;
    flex: none !important;
    width: 100% !important;
    height: 50vh !important;
    min-height: 0 !important;
    overflow: hidden;
  }

  /* Panel de detalle ocupa la mitad inferior */
  main.split-screen.show-detail #detailPanel {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    height: 50vh !important;
    overflow-y: auto;
    border-top: 2px solid rgba(57, 255, 20, 0.4);
  }

  /* El contenido del panel se muestra siempre cuando está abierto */
  main.split-screen.show-detail #detailContent {
    display: flex !important;
  }
}

/* ── Detail image — larger display ──────────────────────── */
.detail-img {
  width: 100%;
  max-height: 28vh;
  object-fit: contain;
  display: block;
  margin-bottom: 10px;
}

/* ── Ver conexiones button ───────────────────────────────── */
#verConexionesBtn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 5px;
  color: #aaffaa;
  font-family: 'Fira Code', monospace;
  font-size: 0.82em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#verConexionesBtn:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

/* ── Volver al grafo completo — floating overlay ─────────── */
#volverGrafoBtn {
  display: none;
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9990;
  padding: 7px 20px;
  background: rgba(0,0,0,0.82);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 5px;
  color: #fff;
  font-family: 'Fira Code', monospace;
  font-size: 0.82em;
  cursor: pointer;
  white-space: nowrap;
}
#volverGrafoBtn.visible { display: block; }

/* ── Móvil — nav más pequeño ≤ 800px ────────────────────── */
@media (max-width: 800px) {
  .section-buttons {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 8px;
  }
  .section-buttons::-webkit-scrollbar { display: none; }

  .section-btn {
    padding: 7px 14px;
    font-size: 0.72em;
    border-width: 2px;
  }

  /* En móvil con overflow-x el dropdown escapa al contenedor → fixed */
  .section-dropdown {
    position: fixed !important;
    left: 50% !important;
    top: 52px !important;
    transform: translateX(-50%) translateZ(0) !important;
  }
}

@media (max-width: 480px) {
  .section-btn {
    padding: 6px 10px;
    font-size: 0.65em;
  }
  .section-dropdown { min-width: 160px; }
  .section-dropdown a { font-size: 0.7em; padding: 7px 14px; }
}
