/* ==========================================================================
   CARRUSEL 3D COVERFLOW - ESTILO PREMIUM
   Inspirado exactamente en la animación 3D de alta fidelidad
   Compatible con Web, WordPress, React, CMS y cualquier sitio web.
   ========================================================================== */

:root {
  --carrusel-bg-start: #0a0f1d;
  --carrusel-bg-mid: #0f1c3f;
  --carrusel-bg-end: #050811;
  --carrusel-accent: #3b82f6;
  --carrusel-accent-glow: rgba(59, 130, 246, 0.45);
  --card-width: 280px;
  --card-height: 430px;
  --card-radius: 22px;
  --card-spacing: 70%;
  --transition-speed: 0.65s;
  --transition-easing: cubic-bezier(0.25, 1, 0.35, 1);
}

@media (max-width: 900px) {
  :root {
    --card-width: 230px;
    --card-height: 355px;
    --card-spacing: 65%;
  }
}

@media (max-width: 600px) {
  :root {
    --card-width: 195px;
    --card-height: 300px;
    --card-spacing: 58%;
    --card-radius: 18px;
  }
}

/* Reset básico dentro del contenedor */
.carrusel-3d-wrapper * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Contenedor Principal */
.carrusel-3d-wrapper {
  position: relative;
  width: 100%;
  min-height: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: hidden;
  padding: 20px 10px 40px 10px;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #ffffff;
  border-radius: 24px;
}

/* Efecto de luz ambiental de fondo */
.carrusel-ambient-glow {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--carrusel-accent-glow) 0%, rgba(30, 64, 175, 0.15) 45%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 1;
}

/* Título de Encabezado Opcional */
.carrusel-header {
  position: relative;
  z-index: 10;
  text-align: center;
  margin-bottom: 25px;
}

.carrusel-header .badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.3);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 10px;
  backdrop-filter: blur(8px);
}

.carrusel-header h2 {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Escenario 3D */
.carrusel-stage {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: var(--card-height);
  perspective: 1200px;
  perspective-origin: 50% 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  touch-action: pan-y;
  cursor: grab;
}

.carrusel-stage:active {
  cursor: grabbing;
}

/* Track contenedor de tarjetas */
.carrusel-track {
  position: relative;
  width: var(--card-width);
  height: var(--card-height);
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tarjeta individual */
.carrusel-card {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--card-width);
  height: var(--card-height);
  border-radius: var(--card-radius);
  overflow: hidden;
  background: #111827;
  cursor: pointer;
  will-change: transform, opacity, filter;
  transition: transform var(--transition-speed) var(--transition-easing),
              opacity var(--transition-speed) var(--transition-easing),
              filter var(--transition-speed) var(--transition-easing),
              box-shadow var(--transition-speed) var(--transition-easing);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  backface-visibility: hidden;
}

/* Imagen dentro de la tarjeta */
.carrusel-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  border-radius: var(--card-radius);
}

/* Capa de reflejo / brillo sutil */
.carrusel-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
  border-top-left-radius: var(--card-radius);
  border-top-right-radius: var(--card-radius);
}

/* Capa de sombra para tarjetas laterales */
.carrusel-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 17, 0.4);
  pointer-events: none;
  transition: opacity var(--transition-speed) var(--transition-easing);
  opacity: 1;
  z-index: 3;
}

/* Tarjeta Activa (Centro) */
.carrusel-card.is-active {
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8),
              0 0 35px var(--carrusel-accent-glow),
              0 0 0 2px rgba(255, 255, 255, 0.25);
}

.carrusel-card.is-active::after {
  opacity: 0; /* Tarjeta activa sin filtro oscuro */
}

/* Sombra / Reflejo en el piso */
.carrusel-card-reflection {
  position: absolute;
  bottom: -45px;
  left: 10%;
  width: 80%;
  height: 25px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, transparent 70%);
  filter: blur(8px);
  pointer-events: none;
  z-index: -1;
  transition: opacity var(--transition-speed) var(--transition-easing);
}

/* Botones de Navegación Circular (Iguales al video) */
.carrusel-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.25s ease;
  outline: none;
}

.carrusel-nav-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.8);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 255, 255, 0.3);
}

.carrusel-nav-btn:active {
  transform: translateY(-50%) scale(0.96);
}

.carrusel-nav-btn.prev {
  left: 20px;
}

.carrusel-nav-btn.next {
  right: 20px;
}

.carrusel-nav-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 600px) {
  .carrusel-nav-btn {
    width: 42px;
    height: 42px;
  }
  .carrusel-nav-btn.prev {
    left: 8px;
  }
  .carrusel-nav-btn.next {
    right: 8px;
  }
  .carrusel-nav-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Barra Inferior: Contador, Controles y Call to Action */
.carrusel-footer {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 30px;
  gap: 15px;
}

/* Indicador de posición / Contador */
.carrusel-counter {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(15, 23, 42, 0.6);
  padding: 6px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.carrusel-counter .current-num {
  color: #60a5fa;
  font-size: 1.1rem;
  font-weight: 800;
}

/* Barra de progreso animada */
.carrusel-progress-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.carrusel-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Botón de Reproducción / Pausa */
.carrusel-toggle-play {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.carrusel-toggle-play:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* Texto Call to Action como en el video */
.carrusel-cta-text {
  font-size: 0.82rem;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.2s ease;
}

.carrusel-cta-text span {
  color: #60a5fa;
}

/* Modal / Lightbox para ver la imagen en grande */
.carrusel-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.carrusel-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.carrusel-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalScaleUp 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes modalScaleUp {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.carrusel-modal-content img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.carrusel-modal-close {
  position: absolute;
  top: -45px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: background 0.2s ease;
}

.carrusel-modal-close:hover {
  background: rgba(255, 255, 255, 0.4);
}
