/**
 * Hero Banner Carousel Interactivo con Soporte Multimedia Avanzado
 * Versión: 2.1 - Con comportamiento de video-container mejorado
 * Compatible con Drupal 8/9/10
 */

/* Reset y Variables CSS */
:root {
  --coal: #000000;
  --salt: #ffffff;
  --dark-sky: #1a1a1a;
  --transition-duration: 0.8s;
  --transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
  --text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  --control-bg: rgba(255,255,255,0.1);
  --control-hover-bg: rgba(255,255,255,0.2);
  --accent-color: #007bff;
  --z-content: 11;
  --z-overlay: 10;
  --z-controls: 20;
  --z-loader: 30;
}

/* Contenedor Principal con altura responsiva mejorada */
#hero-banner-advanced {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 400px;
  overflow: hidden;
  background: var(--coal);
}

/* Media queries para altura del contenedor */
@media (max-width: 1700px) {
  #hero-banner-advanced {
    height: 80vh;
  }
}

@media (max-width: 1400px) {
  #hero-banner-advanced {
    height: 75vh;
  }
}

@media (max-width: 1060px) {
  #hero-banner-advanced {
    height: 60vh;
    min-height: 500px;
  }
}

@media screen and (max-width: 768px) {
  #hero-banner-advanced {
    height: 75vh;
    min-height: 600px;
  }
}

@media (max-width: 600px) {
  #hero-banner-advanced {
    min-height: 650px;
  }
}

@media (max-width: 500px) {
  #hero-banner-advanced {
    min-height: 700px;
  }
}

/* Loading Screen */
.hero-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #929292 0%, #979797 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loader);
  transition: opacity 0.5s ease;
}

.hero-loader.loaded {
  opacity: 0;
  pointer-events: none;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Carousel Container */
.hero-carousel {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Slides */
.hero-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-duration) var(--transition-easing),
              visibility var(--transition-duration) var(--transition-easing),
              transform var(--transition-duration) var(--transition-easing);
  transform: scale(1.1);
  overflow: hidden; /* Asegurar que no se vean bordes */
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.hero-slide.next {
  transform: translateX(100%);
}

.hero-slide.prev {
  transform: translateX(-100%);
}

/* Slides con video - ajustes específicos */
.hero-slide[data-type="video"] {
  background: #000; /* Fondo negro para videos */
}

.hero-slide[data-type="video"] .slide-media {
  transform: scale(1.3); /* Escalar ligeramente el contenedor del video */
}

/* Media Container */
.slide-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden; /* Ocultar cualquier desbordamiento */
  background: #000; /* Fondo negro para evitar bordes blancos */
}

.slide-image,
.slide-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.slide-video {
  background: #000;
  /* Asegurar que el video cubra completamente el contenedor */
  min-width: 100%;
  min-height: 100%;
  /* Forzar el video a llenar completamente el contenedor */
  transform: scale(1.01); /* Escalar ligeramente para eliminar bordes */
  border: none;
  outline: none;
}

/* Overlay Mask */
.slide-overlay {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgb(0 10 18 / 70%);
  z-index: var(--z-overlay);
  pointer-events: none;
}

/* Content */
.slide-content {
  position: relative;
  padding: 8% 0;
  color: var(--salt);
  text-align: left;
  z-index: var(--z-content);
  top: 50%;
  transform: translate(0, -50%);
  max-width: 1170px;
  line-height: 1.1;
  width: 90%;
  margin: 0 auto;
}

@media (max-width: 1400px) {
  .slide-content {
    padding: 8% 0 7% 0;
    max-width: unset;
    top: 47%;
  }
}

/* Animaciones de contenido */
.slide-content.animate-in .subtitle {
  animation: slideInUp 0.8s ease forwards;
  animation-delay: 0.2s;
  opacity: 0;
}

.slide-content.animate-in .title {
  animation: slideInUp 0.8s ease forwards;
  animation-delay: 0.4s;
  opacity: 0;
}

.slide-content.animate-in .description {
  animation: slideInUp 0.8s ease forwards;
  animation-delay: 0.5s;
  opacity: 0;
}

.slide-content.animate-in .cta-button {
  animation: slideInUp 0.8s ease forwards;
  animation-delay: 0.6s;
  opacity: 0;
}

@keyframes slideInUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Textos */
.subtitle {
  font-size: 1.35rem;
  font-weight: 300;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 1rem;
  color: rgba(255,255,255,0.9);
  text-shadow: var(--text-shadow);
}

.title {
  width: 100%;
  color: var(--salt);
  font-weight: bold;
  font-size: 3.18em;
  line-height: 1.2em;
  padding: 20px 0 20px 0;
  text-shadow: var(--text-shadow);
  clear: both;
}

@media (max-width: 1400px) {
  .title,
  .description {
    width: 100%;
  }
}

.description {
  margin-top: 10px;
  line-height: 1.6;
  font-size: 1.2em;
  width: 80%;
  padding: 0 0 20px 0;
  color: var(--salt);
}

.description.xxlarge {
  font-size: 1.5em;
}

.cta-button {
  display: inline-block;
  padding: 1rem 2.5rem;
  background: var(--accent-color);
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 600;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 2px solid transparent;
  text-shadow: none;
  margin-top: 20px;
}

.cta-button:hover {
  background: transparent;
  border-color: white;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Navigation Controls */
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-controls);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 2rem;
  pointer-events: none;
}

.nav-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--control-bg);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  font-size: 1.5rem;
}

.nav-button:hover:not(:disabled) {
  background: var(--control-hover-bg);
  transform: scale(1.1);
  border-color: white;
}

.nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-button:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

/* Indicators */
.carousel-indicators {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  z-index: var(--z-controls);
  list-style: none;
  padding: 0;
  margin: 0;
}

.indicator {
  width: 60px;
  height: 4px;
  background: rgba(255,255,255,0.3);
  backdrop-filter: blur(10px);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.indicator:hover {
  background: rgba(255,255,255,0.5);
}

.indicator.active {
  background: rgba(255,255,255,0.5);
}

.indicator-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: white;
  transition: width linear;
}

.indicator.active .indicator-progress {
  width: 100%;
}

/* Video Controls */
.video-controls {
  position: absolute;
  bottom: 3rem;
  right: 3rem;
  z-index: var(--z-controls);
  display: flex;
  gap: 1rem;
  align-items: center;
}

.video-control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--control-bg);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  position: relative;
}

.video-control-btn:hover {
  background: var(--control-hover-bg);
  transform: scale(1.1);
  border-color: white;
  box-shadow: 0 4px 15px rgba(255,255,255,0.2);
}

.video-control-btn:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

/* SVG Icons Styling */
.video-control-btn svg {
  width: 20px;
  height: 20px;
  color: white;
  transition: all 0.3s ease;
  transform-origin: center center;
}

.video-control-btn:hover svg {
  color: white;
  transform: scale(1.1);
}

.play-icon,
.pause-icon,
.volume-icon,
.mute-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Hide/Show states for icons */
.play-icon.hidden,
.pause-icon.hidden,
.volume-icon.hidden,
.mute-icon.hidden {
  display: none;
}

.volume-icon,
.volume-toggle, 
.mute-icon {
  display: none !important;
}


.volume-slider {
  width: 0;
  opacity: 0;
  transition: all 0.3s ease;
  margin-left: -10px;
}

.volume-slider.active {
  width: 100px;
  opacity: 1;
  margin-left: 0;
}

.volume-slider input {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.3);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 2px;
}

.volume-slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: white;
  cursor: pointer;
  border-radius: 50%;
}

.volume-slider input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: white;
  cursor: pointer;
  border-radius: 50%;
  border: none;
}

/* Mobile Styles */
@media (max-width: 768px) {
  .slide-content {
    text-align: center;
    padding: 0 1rem;
    top: 50%;
    transform: translate(0, -50%);
  }

  .title {
    font-size: 2.4rem; /* Aumentado 20%: 2rem * 1.2 = 2.4rem */
    padding: 15px 0;
  }

  .description {
    font-size: 1rem;
    width: 100%;
  }

  .subtitle {
    font-size: 1.05rem; /* Aumentado 20%: 0.875rem * 1.2 = 1.05rem */
  }

  .cta-button {
    padding: 0.875rem 2rem;
    font-size: 0.875rem;
  }

  .nav-button {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }

  .carousel-nav {
    padding: 0 1rem;
  }

  .carousel-indicators {
    bottom: 2rem;
  }

  .indicator {
    width: 40px;
  }

  .video-controls {
    bottom: 2rem;
    right: 1rem;
    flex-direction: column;
  }

  .video-control-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .volume-slider {
    display: none;
  }

  .slide-image-mobile {
    display: block;
  }

  .slide-image-desktop {
    display: none;
  }
  
  /* Asegurar que el video se vea completo en móvil */
  .slide-video {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    object-position: center;
  }
}

@media (max-width: 500px) {
  .title {
    font-size: 2.1rem; /* Aumentado 20%: 1.75rem * 1.2 = 2.1rem */
  }

  .description {
    font-size: 0.95rem;
  }

  .slide-content {
    padding: 0 15px;
  }
}

@media (min-width: 769px) {
  .slide-image-mobile {
    display: none;
  }

  .slide-image-desktop {
    display: block;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Touch Indicators */
.touch-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  color: white;
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-controls);
  transition: opacity 0.3s ease;
}

.touch-indicator.show {
  opacity: 1;
}
