/* Tipografía moderna */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700&family=Poppins:wght@400;600&display=swap');

:root {
  --color-principal: #00577D;
  --color-acento: #C89F65;
  --color-claro: #e0f2f9;
  --color-fondo: #f8f5f2;
  --color-texto: #2c2c2c;
  --color-blanco: #ffffff;
}

/* Base */
body {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--color-fondo);
  color: var(--color-texto);
}

/* Encabezado */
header {
  background-color: var(--color-principal);
  color: var(--color-blanco);
  padding: 30px 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.logo {
  height: 140px;
  width: auto;
  cursor: pointer;
  transition: transform 0.2s;
}

.logo:hover {
  transform: scale(1.05);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-container h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.8em;
  margin: 0;
  color: var(--color-blanco);
}

/* Buscador */
.search-box {
  display: flex;
  justify-content: center;
  padding: 20px;
}

#searchInput {
  width: 100%;
  max-width: 400px;
  padding: 12px 16px;
  font-size: 1em;
  border: 1px solid #bbb;
  border-radius: 8px;
  transition: border-color 0.3s;
}

#searchInput:focus {
  border-color: var(--color-acento);
  outline: none;
}

.subtitulo {
  font-size: 1.2em;
  font-weight: 600;
  color: #555;
  margin-top: 10px;
  margin-bottom: 20px;
  text-align: center;
}

/* Índice alfabético */
.indice {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
}

.indice a {
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1em;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.indice a.activo {
  color: var(--color-principal);
  cursor: pointer;
}

.indice a.activo:hover {
  background-color: var(--color-claro);
}

.indice a.inactivo {
  color: #aaa;
  cursor: default;
  pointer-events: none;
}

/* Contenedor de detalle */
.detalle {
  max-width: 800px;
  margin: 40px auto;
  padding: 30px;
  background-color: var(--color-blanco);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.05);
}

/* ===============================
   Selector de idioma
   =============================== */

.idioma-selector {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Botón de idioma */
.idioma-btn {
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: transform 0.2s, box-shadow 0.2s;
}

/* Imagen dentro del botón */
.idioma-btn img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.2s, box-shadow 0.2s;
}

/* Efecto hover */
.idioma-btn:hover img {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Estado activo */
.idioma-btn.active img {
  outline: 2px solid var(--color-principal);
  outline-offset: 2px;
}

/* Estado inactivo */
.idioma-btn.inactivo img {
  filter: grayscale(100%);
}

/* Botón deshabilitado */
.idioma-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* Navegación entre personajes */
.navegacion-personaje {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  gap: 10px;
}

.navegacion-personaje button {
  background-color: var(--color-principal);
  color: var(--color-blanco);
  border: none;
  padding: 12px 24px;
  font-size: 1em;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.navegacion-personaje button:hover {
  background-color: #0078a0;
}

.navegacion-personaje button:disabled {
  background-color: #ccc;
  color: #666;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Lista de personajes */
.personajes-lista {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.personajes-lista button {
  padding: 12px 20px;
  font-size: 1.3em;
  border: none;
  border-radius: 8px;
  background-color: #f1e8dc;
  cursor: pointer;
  transition: background-color 0.3s;
}

.personajes-lista button:hover {
  background-color: #e5d8c2;
}



/* Audio */
audio {
  display: block;
  margin: 30px auto;
  width: 100%;
  max-width: 500px;
}

/* Galería */
.carousel {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 500px;
  margin: 30px auto;
}

.carousel img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  transition: opacity 0.5s ease-in-out;
}

/* Botones estilo Facebook */
.carousel button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: #fff;
  border: none;
  color: #333;
  font-size: 1.6rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover */
.carousel button:hover:not(:disabled) {
  background-color: #f9f9f9;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Disabled */
.carousel button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Posición fuera de la imagen */
.carousel .prev {
  left: -50px; /* 👈 fuera de la imagen */
}

.carousel .next {
  right: -50px; /* 👈 fuera de la imagen */
}

/* Indicadores */
.carousel-indicadores {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.indicador {
  width: 10px;
  height: 10px;
  background-color: #ccc;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.indicador.activo {
  background-color: var(--color-principal);
}


/* Spinner */
.spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-size: 1.2em;
  color: #555;
}

.loader {
  border: 6px solid #e5e7eb;
  border-top: 6px solid var(--color-acento);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Sin audio */
.sin-audio {
  text-align: center;
  font-style: italic;
  color: #888;
  margin: 20px 0;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  background-color: #f4f4f4;
  font-size: 0.9em;
  color: #333;
}

.footer-logos {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}

.footer-logo {
  height: 40px;
  max-width: 120px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.footer-logo:hover {
  transform: scale(1.1);
}

.footer-links {
  margin-top: 10px;
}

.footer-links a {
  color: #006699;
  text-decoration: none;
  margin: 0 8px;
}

.footer-links a:hover {
  text-decoration: underline;
}

.carousel button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.85);
  border: none;
  color: #333;
  font-size: 1.8rem;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.carousel button:hover:not(:disabled) {
  background-color: #fff;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.carousel button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.carousel .prev {
  left: 10px;
}

.carousel .next {
  right: 10px;
}

.carousel-indicadores {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.indicador {
  width: 10px;
  height: 10px;
  background-color: #ccc;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.indicador.activo {
  background-color: var(--color-principal);
}

.paginacion {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.paginacion button {
  background-color: var(--color-principal);
  color: var(--color-blanco);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.paginacion button:hover:not(:disabled) {
  background-color: #0078a0;
}

.paginacion button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.paginacion button.activo {
  background-color: var(--color-acento);
  font-weight: bold;
}

/* Lightbox */
.lightbox {
  display: none; /* oculto por defecto */
  position: fixed;
  z-index: 9999;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.8);
}

.lightbox-contenido {
  display: block;
  margin: auto;
  max-width: 90%;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox .cerrar {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.lightbox .cerrar:hover {
  color: var(--color-acento);
}


.font-size-controls {
  text-align: center;
  margin: 10px 0;
}
.font-size-controls button {
  background-color: var(--color-principal);
  color: var(--color-blanco);
  border: none;
  padding: 8px 12px;
  margin: 0 5px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 2.5em;
  font-weight: bold;
}


.search-box {
  display: none;
}

#indice {
  display: none !important;
}

/* ===================== MAPA ===================== */
.mapa-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 30px auto 0 auto; /* centrado y margen superior */
  text-align: center;
}

#mapaFondo {
  width: 100%;
  height: auto;
  display: block;
}

.mapa-titulo {
  font-size: 2rem;
  font-weight: 600;
  color: #00577D;
  margin-bottom: 0.3em;
}

.mapa-subtitulo {
  font-size: 1.1rem;
  color: #444;
  margin-bottom: 1em;
}

.mapa-punto {
  position: absolute;
  border-radius: 50%;
  cursor: pointer;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  border: 2px solid white;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
  color: white;

  /* Transición para fade-in y transform */
  opacity: 0; /* empieza invisible */
  transition: transform 0.2s, opacity 0.3s ease;
}


.mapa-punto:hover {
  transform: translate(-20%, -20%) scale(1.2);
}

.mapa-punto-num {
  pointer-events: none; /* no bloquea click */
}

.mapa-enlace-indice {
  text-align: center;
  margin-top: 15px;
}

.mapa-enlace-indice a {
  color: #004080;
  text-decoration: underline;
  font-weight: 500;
}

/* ===================== BOTONES FLOTANTES ===================== */
.botones-flotantes {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.btn-flotante {
  background-color: #00577D;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
  transition: transform 0.2s, background-color 0.2s;
}

.btn-flotante:hover {
  background-color: #0073a8;
  transform: scale(1.1);
}

.btn-mapa { order: 1; }
.btn-indice { order: 2; }

/* ===================== FICHA MAPA ===================== */
.ficha-mapa {
  margin: 1em 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ficha-mapa iframe {
  width: 100%;
  height: 300px;
  border: 0;
}

.creditos {
  font-size: 0.9em;
  color: #666;
  font-style: italic;
  margin-top: 10px;
  text-align: center;
}

/* ===================== POPUP PERSONAJE ===================== */
.popup-personaje {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px); /* desenfoque elegante */
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.popup-personaje[aria-hidden="false"] .popup-contenido {
  animation: popupFadeZoom 0.3s ease forwards;
}

.popup-contenido {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  max-width: 90%;
  width: 320px;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);

  /* NUEVO → limitar alto en móviles y permitir scroll */
  max-height: 80vh;
  overflow-y: auto;
}

.popup-contenido img {
  max-width: 100%;
  height: auto;
  margin-bottom: 10px;
  border-radius: 6px;

  /* NUEVO → limitar alto máximo para pantallas pequeñas */
  max-height: 50vh;
  object-fit: contain;
}

#popupImagen {
  max-width: 200px;
  height: auto;
  margin: 10px auto;
  display: block;
  border-radius: 8px;
}

#popupQR {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.qr-texto {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 6px; /* espacio entre texto y QR */
  text-align: center;
}

.popup-contenido button,
.btn-ver-ficha {
  background-color: #00577D;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.popup-contenido button:hover,
.btn-ver-ficha:hover {
  background-color: #003f55;
}

.popup-cerrar {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.5rem;
  cursor: pointer;
  border: none;
  background: none;
  color: #333;
}

.popup-cerrar:hover {
  color: #00577D;
}

/* ===================== ANIMACIONES ===================== */
@keyframes popupFadeZoom {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}



/**
  * Ajustes móviles adicionales
  * Eliminado flex-direction: column; de header-content para mejor diseño
  */
@media (max-width: 600px) {

  .logo-container h1 {
    font-size: 1.2em;
  }

  .personajes-lista button {
    font-size: 1em;
    padding: 16px 24px;
    margin-top: 10px;
  }

  #indice h2 {
    font-size: 1.8em;
    text-align: center;
    margin-bottom: 10px;
  }

  .detalle h2 {
    font-size: 1.8em;
  }

  .font-size-controls button {    
    font-size: 2.0em;
  }

  .logo {
    height: 100px;
  }

  .header-content {    
    align-items: center;
    text-align: center;
  }

  .logo-container {
    flex-direction: column;
    gap: 10px;
  }

  .navegacion-personaje {
    flex-direction: column;
    align-items: stretch;
  }

  .navegacion-personaje button {
    width: 100%;
  }

  .popup-contenido {
    width: 90%;
    padding: 15px;
  }

  .popup-contenido img {
    max-height: 40vh;
  }
}

