/* ================================================================
   catalogo.css — Estilos para el Catálogo Interactivo KatePin
   ================================================================ */

:root {
  --primary-color: #FE988A;
  --secondary-color: #946BB7;
  --accent-color: #ADC9F1;
  --bg-color: #fefcfd;
  --bg-color-light: #ffffff;
  --text-main: #41364f;
  --text-muted: #7a7a7a;
  --glass-bg: rgba(254, 252, 253, 0.85);
  --glass-border: rgba(65, 54, 79, 0.1);
  --shadow-subtle: 0 4px 20px 0 rgba(65, 54, 79, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Raleway', sans-serif;
  overflow: hidden; 
}

/* ── ESTILOS GLOBALES & DECORACIÓN FONDO ─────────────────────── */
.bg-decorations {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg-decorations .blob {
  position: absolute;
  filter: blur(100px);
  opacity: 0.4;
  border-radius: 50%;
  animation: floatBg 20s infinite alternate ease-in-out;
}
.blob-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: var(--secondary-color); }
.blob-2 { bottom: -10%; right: -10%; width: 60vw; height: 60vw; background: var(--primary-color); animation-delay: -5s; }

@keyframes floatBg {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5%, 10%) scale(1.1); }
}







/* ── LOGO SUPERIOR CENTRAL Y TEXTO GUÍA ─────────────────────── */
.top-logo-link {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: block;
  pointer-events: auto;
  transition: transform 0.3s ease;
}

.top-logo-link:hover {
  transform: translateX(-50%) scale(1.05);
}

.top-logo-link img {
  height: 45px;
  width: auto;
  object-fit: contain;
  display: block;
  opacity: 0.95;
  filter: drop-shadow(0px 2px 4px rgba(65, 54, 79, 0.1));
}

.catalog-hint-text {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  font-family: 'Raleway', sans-serif !important;
  font-weight: 700 !important;
  font-size: 1.05rem !important;
  color: #FF5A8D !important; /* Rosa oficial KatePin */
  text-align: center;
  margin: 0;
  padding: 0;
  letter-spacing: 0.5px;
  white-space: nowrap !important;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(255, 90, 141, 0.25);
  display: none !important; /* Oculto por defecto */
}

.catalog-hint-text.visible {
  display: block !important;
}

@media (max-width: 768px) {
  /* Ocultar el logo superior y el texto si estamos en la cuadrícula */
  body:not(.carousel-active) .top-logo-link {
    display: none !important;
  }
  body:not(.carousel-active) .catalog-hint-text {
    display: none !important;
  }
  
  .top-logo-link {
    top: 15px;
  }
  .top-logo-link img {
    height: 38px;
  }
  .catalog-hint-text {
    top: 56px;
    font-size: 0.92rem !important;
  }
}

/* ── LAYOUT PRINCIPAL ────────────────────────────────────────── */
.cat-layout {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* ── BARRA LATERAL (SIDEBAR) ─────────────────────────────────── */
.cat-sidebar {
  width: 280px;
  height: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 40px 20px;
  box-shadow: var(--shadow-subtle);
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-spacer {
  height: 45px; /* Compensa el espacio que ocupaba el logo */
  margin-bottom: 20px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.cat-menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cat-menu-item {
  display: flex;
  flex-direction: column;
}

/* El texto principal de categoría: color rosa característico y fuente Nunito redondeada */
.cat-menu-btn {
  background: none;
  border: none;
  font-family: 'Nunito', 'Raleway', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--primary-color);
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 8px 12px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}
.cat-menu-btn:hover, .cat-menu-item.active .cat-menu-btn {
  background: rgba(254, 152, 138, 0.1); 
  transform: translateX(5px);
}

.cat-submenu {
  list-style: none;
  margin-top: 5px;
  margin-left: 15px;
  display: none;
  flex-direction: column;
  gap: 8px;
}
.cat-menu-item.active .cat-submenu {
  display: flex;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.cat-submenu li a {
  text-decoration: none;
  font-family: 'Nunito', 'Raleway', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.3s ease;
  padding: 5px 12px;
  display: block;
  border-radius: 6px;
}
.cat-submenu li a:hover, .cat-submenu li.active a {
  color: var(--secondary-color);
  background: rgba(148, 107, 183, 0.08);
  font-weight: 700;
  transform: translateX(3px);
}

/* ── MÓVIL: OVERLAY Y HAMBURGUESA ────────────────────────────── */
.cat-mobile-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  width: 45px;
  height: 45px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  z-index: 1500;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  backdrop-filter: blur(8px);
}
.cat-mobile-toggle .hamburger-line {
  width: 20px;
  height: 2px;
  background-color: var(--primary-color);
  border-radius: 2px;
}
.cat-mobile-close {
  display: none;
  background: none;
  border: none;
  font-size: 2.5rem;
  color: var(--text-main);
  position: absolute;
  top: 15px;
  right: 20px;
  cursor: pointer;
  line-height: 1;
}
.cat-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(65, 54, 79, 0.4);
  backdrop-filter: blur(3px);
  z-index: 900;
  opacity: 0;
  transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
  .cat-mobile-toggle { display: flex; }
  
  .cat-sidebar {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-100%);
    width: 280px;
    z-index: 1000;
  }
  .cat-sidebar.open {
    transform: translateX(0);
  }
  .cat-mobile-close { display: block; z-index: 1001; }
  .cat-sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
}

/* ── VISOR PRINCIPAL (CARRUSEL) ──────────────────────────────── */
.cat-viewer {
  position: relative;
  flex: 1;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.carousel-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
}
.carousel-container.active {
  opacity: 1;
  visibility: visible;
}

.carousel-track {
  display: flex;
  gap: 30px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  height: 75%; 
  align-items: center;
  -ms-overflow-style: none;
  scrollbar-width: none;
  cursor: grab;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track.dragging {
  cursor: grabbing;
  scroll-snap-type: none; 
  scroll-behavior: auto;
}

.carousel-padding {
  flex: 0 0 0px; 
}

.carousel-slide {
  flex: 0 0 auto;
  scroll-snap-stop: always;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  transition: transform 0.4s ease, opacity 0.4s ease;
  transform: scale(0.9);
  opacity: 0.5;
  user-select: none;
}
.carousel-slide img {
  height: 100%;
  width: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: var(--shadow-subtle);
  pointer-events: none;
}
.carousel-slide.is-centered {
  transform: scale(1);
  opacity: 1;
}

/* Controles carrusel */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(254, 252, 253, 0.5); /* Más traslúcido */
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  width: 50px; height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(4px); /* Menos blur para ver a través */
  opacity: 0.6; /* Flechas más traslúcidas por defecto */
  transition: all 0.3s ease;
}
.carousel-btn:hover {
  background: var(--glass-bg);
  opacity: 1; /* Se vuelve más visible al pasar el mouse/tocar */
  transform: translateY(-50%) scale(1.1);
}
.carousel-btn.prev { left: 30px; }
.carousel-btn.next { right: 30px; }

/* Indicador de páginas */
.page-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg);
  padding: 6px 16px;
  border-radius: 20px;
  font-family: 'Nunito', 'Raleway', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-main);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  z-index: 10;
}

/* ── LOADING SPINNER ─────────────────────────────────────────── */
.loader-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
.loader-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.spinner {
  width: 50px; height: 50px;
  border: 4px solid rgba(65,54,79,0.1);
  border-left-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .carousel-container {
    align-items: flex-start !important;
    padding-top: 90px !important; /* Acerca el carrusel exactamente debajo del texto */
  }
  .carousel-track {
    height: 65%; /* Ajuste de altura para que se vea perfecto */
  }
  .carousel-slide {
    /* max-width removed for exact image bounds */ /* Reducido para dejar más espacio a los lados */
  }
  .carousel-btn {
    width: 35px; height: 35px;
    font-size: 1rem;
    opacity: 0.2; /* Aún más traslúcidas en móvil */
  }
  .carousel-btn.prev { left: 5px; }
  .carousel-btn.next { right: 5px; }
}


/* ── VISTA DE CUADRÍCULA MÓVIL (GRID) ────────────────────────── */
.mobile-grid-view {
  display: none; /* Oculto en escritorio */
  width: 100%;
  height: 100vh;
  padding: 20px; /* Reducido para quitar el gap del logo */
  overflow-y: auto;
  z-index: 50;
  position: relative;
}
.mobile-grid-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 25px;
  gap: 15px;
}
.btn-full-catalog {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 4px 15px rgba(254, 152, 138, 0.4);
  cursor: pointer;
  width: 100%;
  max-width: 300px;
  transition: transform 0.2s ease;
}
.btn-full-catalog:active { transform: scale(0.95); }

.grid-breadcrumb {
  width: 100%;
  text-align: left;
}
.btn-back-grid {
  background: none;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  color: var(--secondary-color);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 5px;
}
.back-arrow { font-size: 1.5rem; line-height: 1; }

.mobile-grid-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding-bottom: 50px;
}
.grid-book {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.grid-book-cover {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--glass-bg);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(65, 54, 79, 0.15);
  border: 2px solid var(--glass-border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.grid-book:active .grid-book-cover { transform: scale(0.95); }
.grid-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.grid-book-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  text-align: center;
  line-height: 1.2;
}

/* ── BOTÓN FLOTANTE MÓVIL ────────────────────────────── */
.btn-floating-back {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 6px 14px; /* Más pequeño */
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.85rem; /* Más pequeño */
  box-shadow: 0 4px 15px rgba(148, 107, 183, 0.4);
  z-index: 2000;
}

@media (max-width: 768px) {
  /* En móvil, el contenedor del grid es visible y el cat-layout (sidebar + carousel) se oculta por defecto */
  .mobile-grid-view {
    display: block;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 1;
    visibility: visible;
  }
  .cat-layout {
    display: flex;
    position: absolute;
    top: 0; left: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  body.carousel-active .mobile-grid-view {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    pointer-events: none;
  }
  body.carousel-active .cat-layout {
    opacity: 1;
    visibility: visible;
    position: relative;
  }
  /* En móvil el sidebar ya no se usa, lo ocultamos siempre */
  body.carousel-active .cat-sidebar {
    display: none !important;
  }
  /* Mostramos el botón flotante solo cuando el carrusel está activo */
  body.carousel-active .btn-floating-back {
    display: block;
  }
  /* Ocultamos el page-counter original porque estorba al botón flotante, o lo movemos */
  body.carousel-active .page-indicator {
    bottom: 70px;
  }

  /* Ocultar paginación en carrusel móvil para evitar conflictos con el botón de volver */
  body.carousel-active .page-indicator {
    display: none;
  }

  /* Ajustar top logo si está activo el grid */
  
}

.mobile-grid-container {
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 1;
  transform: scale(1);
}
.mobile-grid-container.fade-out {
  opacity: 0;
  transform: scale(0.95);
}


/* ── BOTÓN Y MODAL DE ZOOM ────────────────────────────── */
.btn-zoom {
  display: none;
  position: absolute;
  top: 75px; /* Debajo del logo */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(254, 252, 253, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-zoom:hover { background: var(--glass-bg); }
body.carousel-active .btn-zoom {
  display: flex;
  align-items: center;
  gap: 6px;
}
@media (min-width: 769px) {
  body.carousel-active .btn-zoom { display: none; /* Solo en móvil */ }
}

.zoom-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.92);
  z-index: 999999 !important;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}
.zoom-modal.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.zoom-modal img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  transform: scale(1);
  transition: transform 0.2s ease;
}
.btn-zoom-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 2rem;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-grid-logo {
  height: 45px;
  object-fit: contain;
  margin-bottom: 5px;
  filter: drop-shadow(0px 2px 4px rgba(65, 54, 79, 0.1));
}
@media (max-width: 768px) {
  /* Ocultar el logo fixed original cuando estamos en el grid (no carousel-active) */
  body:not(.carousel-active) 
}


/* ── CAPA DE HOTSPOTS Y LUPAS INDIVIDUALES PARA CADA PIN ────── */
.carousel-slide {
  position: relative;
}

.pin-hotspots-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.pin-hotspot {
  position: absolute;
  pointer-events: auto !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 50;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.pin-lupa-btn, .pin-lupa-btn * {
  pointer-events: none !important;
}

.pin-lupa-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(254, 252, 253, 0.35); /* Mucho más transparente */
  backdrop-filter: blur(3px);
  border: 1px solid rgba(148, 107, 183, 0.4);
  color: rgba(148, 107, 183, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 0.45; /* Opacidad sutil para no tapar el pin */
  transform: scale(0.9);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: floatLupa 2.5s ease-in-out infinite alternate;
}

@keyframes floatLupa {
  0% { transform: scale(0.9) translateY(0px); }
  100% { transform: scale(0.95) translateY(-3px); }
}

.pin-hotspot:hover .pin-lupa-btn,
.pin-hotspot:active .pin-lupa-btn {
  opacity: 1;
  transform: scale(1.15) translateY(-2px);
  background: var(--secondary-color);
  color: white;
  box-shadow: 0 6px 20px rgba(148, 107, 183, 0.5);
  animation: none;
}

.pin-hotspot:hover {
  background: rgba(148, 107, 183, 0.12);
  outline: 1.5px dashed rgba(148, 107, 183, 0.4);
}

/* Ocultar botón de zoom global viejo */
#btn-zoom, .btn-zoom {
  display: none !important;
}

/* Título de pin en el modal de zoom */
.zoom-pin-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  color: white;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  z-index: 10000;
}


/* ── BLOQUEO DE ESCALADO Y ESTABILIDAD VISUAL ────────────────── */
html, body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}

@media (min-width: 769px) {
  .cat-layout {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
  }
  .cat-sidebar {
    flex-shrink: 0;
    width: 280px;
    min-width: 280px;
    max-width: 280px;
  }
  .cat-viewer {
    flex: 1;
    min-width: 0;
    height: 100vh;
  }
  .carousel-slide {
    /* aspect-ratio removed for exact image bounds */
    max-height: 80vh;
  }
  .carousel-slide img {
    /* aspect-ratio removed for exact image bounds */
    object-fit: contain;
  }
}


/* ── CONTENEDOR EXACTO DE LA IMAGEN DE LA PÁGINA ────────────── */
.slide-media-wrapper {
  position: relative;
  display: inline-block;
  height: 100%;
  width: auto;
  line-height: 0;
}

.slide-media-wrapper img {
  height: 100%;
  width: auto;
  display: block;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: var(--shadow-subtle);
  pointer-events: none;
}

.pin-hotspots-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}


/* ── CONTENEDOR LOGO & TEXTO GUÍA ───────────────────────────── */
.top-logo-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 100;
  }
  

  /* Ocultar lupas y bordes completamente en móvil */
  .pin-lupa-btn {
    display: none !important;
  }
  .pin-hotspot {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
  .pin-hotspot:hover,
  .pin-hotspot:active {
    background: transparent !important;
    outline: none !important;
  }
}
