/* =========================================================
   ISTORIEN — STYLE.CSS (Versión Corregida 2 - Controles Izquierdos)
   ========================================================= */

/* ---------------------------------- */
/* VARIABLES DE COLOR */
/* ---------------------------------- */
:root {
  --bg-main: #060b1a;
  --bg-alt: #0d1324;
  --accent-gold: #d4af37;
  --accent-gold-light: rgba(212, 175, 55, 0.16);
  --text-main: #f5f0e8;
  --text-muted: #c2b9aa;
  --border-soft: rgba(244,236,222,0.14);
  --radius-xl: 24px;
  --transition-fast: 180ms ease-out;
}

/* ---------------------------------- */
/* RESET */
/* ---------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(circle at top, #101632 0, #02040A 45%, #000 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------- */
/* WRAPPER */
/* ---------------------------------- */
.app-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 16px;
}


.app-shell {
  width: 100%;
  max-width: 1120px;
  border-radius: 32px;
  border: 1px solid var(--border-soft);
  background:
    radial-gradient(circle at top left, rgba(212,175,55,0.09), transparent 55%),
    linear-gradient(135deg, rgba(12,19,40,0.96), rgba(5,8,20,0.98));
  box-shadow: 0 28px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.02);
  padding: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------------------------------- */
/* HEADER */
/* ---------------------------------- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-logo {
  width: 40px;
  height: 40px;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.2em;
  font-size: 13px;
  text-transform: uppercase;
}

.brand-tagline {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

/* ---------------------------------- */
/* LANGUAGE SWITCH */
/* ---------------------------------- */
.lang-switch {
  display: flex;
  gap: 6px;
  background: rgba(7, 12, 30, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}

.lang-btn.active {
  background: var(--accent-gold-light);
  color: var(--accent-gold);
}

/* ---------------------------------- */
/* MAIN AREA - MODIFICADO PARA PANEL FIJO */
/* ---------------------------------- */
.app-main {
  position: relative;
  flex: 1;
  margin-top: 8px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  background: radial-gradient(circle at top, rgba(14, 23, 55, 0.9), rgba(5, 8, 20, 0.96));
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;

  min-height: 480px;
}

#globe-container {
  position: relative;
  flex: 1;
  /* Limita el ancho del globo para dejar espacio al panel fijo (360px) */
  max-width: calc(100% - 360px); 
  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 420px;
}

/* ---------------------------------- */
/* HELP PANEL - ELIMINADO VÍA HTML, lo ocultamos por si acaso */
/* ---------------------------------- */
.help-panel {
  display: none !important;
}

/* ---------------------------------- */
/* BOTTOM PANEL CONTROLS (Tiempo) - ELIMINADO VÍA HTML, lo ocultamos por si acaso */
/* ---------------------------------- */
.bottom-panel {
  display: none !important;
}

/* ---------------------------------- */
/* EVENT PANEL - FIJO Y VACÍO */
/* ---------------------------------- */
.event-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 360px;
  max-width: 90%;
  background:
    radial-gradient(circle at top left, rgba(212,175,55,0.15), transparent 60%),
    rgba(5,8,20,0.96);
  border-left: 1px solid rgba(244,236,222,0.18);
  box-shadow: -18px 0 40px rgba(0,0,0,0.8);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
  /* CAMBIO CLAVE: Elimina la transformación de ocultamiento y la transición */
  transform: translateX(0) !important; 
  transition: none !important;
}

/* OCULTAMOS EL CONTENIDO DEL PANEL PARA DEJARLO VACÍO */
.event-panel .event-header,
.event-panel .event-body {
    display: none !important;
}


/* SECCIÓN DE BOTONES (Estilos base) */
.btn {
  border-radius: 999px;
  border: 1px solid rgba(244,236,222,0.4);
  padding: 7px 14px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-main);
  background: rgba(5,9,22,0.9);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              transform var(--transition-fast),
              box-shadow var(--transition-fast);
  backdrop-filter: blur(8px);
}

.btn:hover {
  background: rgba(244,236,222,0.08);
  border-color: rgba(244,236,222,0.7);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.6);
}

.btn-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}


/* ---------------------------------- */
/* DESCEND OVERLAY */
/* ---------------------------------- */
/* Se deja la definición visual del overlay por si se activa en JS, pero el JS fue modificado para no usarlo */
.descend-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center,
              rgba(0,0,0,0.55),
              rgba(0,0,0,0.9));
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 200ms linear;
}

.descend-chip {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-gold);
  border-radius: 999px;
  border: 1px solid rgba(212,175,55,0.6);
  padding: 4px 10px;
  background: linear-gradient(120deg, rgba(212,175,55,0.16), rgba(5,8,20,0.94));
  margin-bottom: 6px;
}

.descend-title {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;

}

/* ---------------------------------- */
/* FOOTER */
/* ---------------------------------- */
.app-footer {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(244,236,222,0.1);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.app-footer a {
  color: var(--accent-gold);
  text-decoration: none;
}

@media (max-width: 640px) {
  /* En pantallas pequeñas, el panel sigue siendo fijo, pero ahora ocupa todo el ancho */
  .event-panel {
    width: 100%;
    max-width: 100%;
    /* Dejamos el globo debajo cuando la pantalla es muy pequeña */
    border-left: none;
  }
  #globe-container {
    max-width: 100%;
  }

  /* Ocultar los controles en móviles para no obstruir el globo */
  .controls-column-left {
    display: none;
  }
}

/* ========================================================= */
/* PANEL RUTA HISTÓRICA — Botones estilo FREE */
/* ========================================================= */

.route-title {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  text-align: center;
  color: var(--accent-gold);
  margin-top: 12px;
  margin-bottom: 14px;
}

.route-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 8px;
  overflow-y: auto;
}

/* BOTONES DEL PANEL */

.route-btn {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(244,236,222,0.18);
  background: rgba(5,9,22,0.62);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: 0.2s ease-out;
  backdrop-filter: blur(6px);
}

.route-btn:hover {
  background: rgba(244,236,222,0.08);
  border-color: rgba(244,236,222,0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.6);
}

.route-btn-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

.route-btn-year {
  font-size: 12px;
  color: var(--text);
}

.route-btn-sub {
  font-size: 11px;
  color: var(--text-main);
  opacity: 0.85;
}

/* =========================================================
   TOOLTIP FLOTANTE (CARTEL SOBRE EL MAPA)
   ========================================================= */
.globe-tooltip {
  position: absolute;
  display: none; /* Oculto por defecto */
  pointer-events: none; /* CRUCIAL: Para que el mouse no "choque" con el cartel y parpadee */
  z-index: 100;
  
  /* Estilos copiados de .route-btn para que se vea igual */
  width: 260px; /* Un poco más angosto que el menú lateral */
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(244,236,222,0.4);
  background: rgba(5,9,22,0.9); /* Un poco más oscuro para legibilidad */
  color: var(--text-main);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  
  /* Transición suave de opacidad */
  transition: opacity 0.2s ease-out;
}

/* Aseguramos que los textos internos se vean bien */
.globe-tooltip .route-btn-title {
  font-size: 13px; /* Ligeramente más chico que en el menú */
  margin-bottom: 2px;
}
.globe-tooltip .route-btn-year {
  font-size: 11px;
  margin-bottom: 4px;
}
.globe-tooltip .route-btn-sub {
  font-size: 10px;
  line-height: 1.4;
}

/* Animación de entrada para toda la página */
body {
  animation: pageFadeIn 1s ease-out forwards;
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: scale(0.98); } /* Empieza invisible y un pelín más chico */
  to { opacity: 1; transform: scale(1); }
}

/* =========================================
   NUEVO SISTEMA DE MENÚS (CATEGORÍAS VS LISTA)
   Pegar al final de route.css
   ========================================= */

/* Clase utilitaria para ocultar paneles */
.hidden {
  display: none !important;
}

/* Contenedor de cada vista (Categorías o Lista) */
.panel-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: fadeInView 0.3s ease-out;
}

@keyframes fadeInView {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Estilo especial para las Tarjetas de Categoría (Botones grandes) */
.category-card {
  display: flex !important;
  flex-direction: row !important; /* Icono al lado del texto */
  align-items: center !important;
  gap: 12px !important;
  padding: 18px 16px !important; /* Más grandes */
  border: 1px solid rgba(212, 175, 55, 0.3) !important; /* Borde dorado sutil */
  background: rgba(5,9,22,0.8) !important;
}

.category-card:hover {
  background: linear-gradient(90deg, rgba(212,175,55,0.15), transparent) !important;
  border-color: var(--accent-gold) !important;
  transform: translateX(5px) !important; /* Se mueven a la derecha al pasar el mouse */
}

.cat-icon {
  font-size: 24px;
  width: 30px;
  text-align: center;
}

.cat-arrow {
  margin-left: auto; /* Empuja la flecha a la derecha */
  color: var(--accent-gold);
  font-weight: bold;
  opacity: 0.5;
  font-size: 18px;
}

/* Cabecera del Submenú (Donde va el botón Volver) */
.submenu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 15px 4px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 10px;
  flex-shrink: 0; /* Que no se achique */
}

.back-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 99px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.back-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: rgba(212,175,55,0.1);
}

/* =========================================
   BARRA DE DESPLAZAMIENTO (SCROLLBAR) PREMIUM
   Igual que en los escenarios
   ========================================= */

/* 1. Ancho de la barra */
.route-buttons::-webkit-scrollbar {
    width: 3px; /* Muy fina y elegante */
}

/* 2. El fondo por donde corre la barra (carril) */
.route-buttons::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1); /* Prácticamente invisible */
}

/* 3. La barra móvil (pulgar) con el degradado */
.route-buttons::-webkit-scrollbar-thumb {
    /* Degradado vertical: Dorado -> Azul Oscuro/Negro */
    background: linear-gradient(to bottom, #d4af37, #060b1a); 
    border-radius: 10px; /* Bordes redondeados */
}

/* Opcional: Hover para que brille un poco más al tocarla */
.route-buttons::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #f0c952, #1a2035); 
}

/* =========================================
   BOTÓN DE CAMBIO DE MODO (HEADER)
   ========================================= */

/* Contenedor para alinear botón + idiomas */
.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Estilo del botón "Ver Exploración Libre" */
.btn-mode-switch {
  text-decoration: none;
  font-size: 11px;
  color: var(--accent-gold);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 6px 12px;
  border-radius: 99px;
  text-transform: uppercase;
  transition: 0.2s;
  background: rgba(0,0,0,0.3);
  font-weight: 600;
}
.btn-mode-switch:hover { background: var(--accent-gold); color: #000; }


.btn-mode-switch:hover {
    background: var(--accent-gold);
    color: #000; /* Texto negro sobre fondo dorado */
    box-shadow: 0 0 15px rgba(212,175,55,0.4);
    transform: translateY(-1px);
}