/* Módulo Detalle de Visita Moderno - Mobile First */

:root {
  --c-primary: #0b3d91;
  --c-secondary: #10a2d8;
  --c-accent: #f9b233;
  --c-bg: #f5f5dd;
  --c-dark: #1a202c;
  --c-light: #f7fafc;
  --c-white: #ffffff;
  --c-shadow: rgba(0, 0, 0, 0.1);
  --c-shadow-lg: rgba(0, 0, 0, 0.2);
  --c-shadow-xl: rgba(0, 0, 0, 0.3);
  --transition: all 0.3s ease;
  --border-radius: 0.8rem;
  --success-color: #2d8a47;
  --warning-color: #f59e0b;
  --danger-color: #dc2626;
  --info-color: #0891b2;
}

/* Reset y base */
* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  line-height: 1.6;
  color: var(--c-dark);
  overflow-x: hidden;
}

/* Container principal */
.visita-detail-container {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--c-bg), #f0f4e6);
  position: relative;
}

/* Header con botón de regreso */
.detail-header {
  background: var(--c-white);
  padding: 1rem;
  box-shadow: 0 2px 10px var(--c-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.back-button {
  background: var(--c-primary);
  color: var(--c-white);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px var(--c-shadow);
}

.back-button:hover {
  background: var(--c-secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--c-shadow-lg);
}

.back-button:active {
  transform: scale(0.95);
}

.header-info {
  flex: 1;
}

.breadcrumb-text {
  color: var(--c-dark);
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.breadcrumb-text i {
  color: var(--c-secondary);
}

/* Hero section */
.hero-section {
  background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
  color: var(--c-white);
  text-align: center;
  padding: 2rem 1rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none"><path d="M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z" opacity=".25" fill="%23ffffff"></path></svg>')
    no-repeat;
  background-size: cover;
  opacity: 0.1;
}

.hero-content {
  position: relative;
  z-index: 3;
}

.hero-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  line-height: 1.2;
}

.hero-meta {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.image-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(10px);
}

/* Onda blanca */
.hero-waves {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  overflow: hidden;
  z-index: 2;
}

.hero-waves .wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 115%;
  height: 27%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none"><path d="M985.66,92.83C906.67,72,823.78,31,743.84,14.19c-82.26-17.34-168.06-16.33-250.45.39-57.84,11.73-114,31.07-172,41.86A600.21,600.21,0,0,1,0,27.35V120H1200V95.8C1132.19,118.92,1055.71,111.31,985.66,92.83Z" fill="%23f5f5dd"></path></svg>')
    repeat-x;
  animation: waveFloat 6s ease-in-out infinite;
}

/* Contenido principal */
.gallery-main {
  background: var(--c-bg);
  position: relative;
  z-index: 3;
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Imagen principal destacada */
.featured-image-container {
  margin-bottom: 3rem;
}

.featured-image {
  position: relative;
  background: var(--c-white);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 8px 25px var(--c-shadow-lg);
  transition: var(--transition);
}

.featured-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px var(--c-shadow-xl);
}

.main-image {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  background: #f8f9fa;
  transition: var(--transition);
  cursor: pointer;
}

.main-image:hover {
  transform: scale(1.02);
  filter: brightness(1.05);
}

.main-image:active {
  transform: scale(0.98);
}

/* Indicador visual para click */
.click-indicator {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
  z-index: 5;
}

.featured-image:hover .click-indicator {
  opacity: 1;
  transform: scale(1.1);
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.featured-image:hover .image-overlay {
  opacity: 1;
}

.expand-button {
  background: var(--c-white);
  color: var(--c-dark);
  border: none;
  padding: 1rem 1.5rem;
  border-radius: 2rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.expand-button:hover {
  background: var(--c-accent);
  color: var(--c-dark);
  transform: scale(1.05);
}

/* Controles de navegación */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  color: var(--c-dark);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 10px var(--c-shadow);
  opacity: 0.8;
}

.nav-btn:hover {
  background: var(--c-secondary);
  color: var(--c-white);
  transform: translateY(-50%) scale(1.1);
  opacity: 1;
}

.nav-prev {
  left: 1rem;
}

.nav-next {
  right: 1rem;
}

/* Indicador de posición */
.position-indicator {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.8);
  color: var(--c-white);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Galería de miniaturas */
.thumbnails-section {
  margin-bottom: 3rem;
}

.thumbnails-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--c-dark);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.thumbnails-title i {
  color: var(--c-secondary);
}

.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}

.thumbnail-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  border: 3px solid transparent;
}

.thumbnail-item.active {
  border-color: var(--c-secondary);
  transform: scale(1.05);
}

.thumbnail-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px var(--c-shadow-lg);
}

.thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.thumbnail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.thumbnail-item:hover .thumbnail-overlay {
  opacity: 1;
}

.thumbnail-overlay i {
  color: var(--c-white);
  font-size: 1.5rem;
}

/* Estado vacío */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--c-dark);
  opacity: 0.7;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: var(--c-secondary);
}

.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--c-dark);
}

.empty-state p {
  font-size: 1rem;
}

/* Evento relacionado */
.related-event {
  background: var(--c-white);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 15px var(--c-shadow);
  text-align: center;
  margin-top: 2rem;
}

.related-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--c-dark);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.related-title i {
  color: var(--c-success);
}

.event-button {
  background: linear-gradient(135deg, var(--c-success), #16a34a);
  color: var(--c-white);
  text-decoration: none;
  padding: 1rem 2rem;
  border-radius: 2rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(45, 138, 71, 0.3);
}

.event-button:hover {
  color: var(--c-white);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 138, 71, 0.4);
}

.event-button:active {
  transform: scale(0.98);
}

/* Botón flotante scroll top */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--c-secondary);
  color: var(--c-white);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px var(--c-shadow-lg);
  z-index: 1000;
}

.scroll-top-btn.visible {
  display: flex;
}

.scroll-top-btn:hover {
  background: var(--c-primary);
  transform: translateY(-2px);
}

/* Animaciones */
@keyframes waveFloat {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  50% {
    transform: translateX(-10px) scale(1.02);
  }
}

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

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

.featured-image-container {
  animation: fadeInUp 0.6s ease forwards;
}

.thumbnails-section {
  animation: slideInRight 0.8s ease forwards;
  animation-delay: 0.2s;
}

.related-event {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.4s;
}

/* Media queries */
@media (max-width: 480px) {
  .detail-header {
    padding: 0.8rem;
  }

  .back-button {
    width: 40px;
    height: 40px;
  }

  .hero-section {
    padding: 1.5rem 1rem 3rem;
  }

  .gallery-main {
    padding: 1.5rem 0.8rem;
  }

  .thumbnails-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.8rem;
  }

  .nav-btn {
    width: 40px;
    height: 40px;
  }

  .nav-prev {
    left: 0.5rem;
  }

  .nav-next {
    right: 0.5rem;
  }

  .position-indicator {
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .scroll-top-btn {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}

@media (min-width: 481px) and (max-width: 767px) {
  .thumbnails-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (min-width: 768px) {
  .gallery-main {
    padding: 3rem 2rem;
  }

  .thumbnails-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
  }

  .hero-section {
    padding: 3rem 1rem 5rem;
  }
}

@media (min-width: 1024px) {
  .thumbnails-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .featured-image-container {
    margin-bottom: 4rem;
  }
}

/* Optimización para pantallas táctiles */
@media (hover: none) and (pointer: coarse) {
  .thumbnail-item:hover {
    transform: none;
  }

  .thumbnail-item:active {
    transform: scale(0.95);
  }

  .nav-btn:hover {
    transform: translateY(-50%);
  }

  .image-overlay {
    opacity: 0.8;
  }
}

/* Estados de focus para accesibilidad */
.back-button:focus,
.nav-btn:focus,
.thumbnail-item:focus,
.expand-button:focus,
.event-button:focus {
  outline: 3px solid var(--c-accent);
  outline-offset: 2px;
}

/* Loading states */
.main-image {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.main-image.loaded {
  animation: none;
  background: transparent;
}

.main-image.error {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
}

.thumbnail-image.error {
  background: #f8f9fa;
  border: 1px dashed #dee2e6;
  opacity: 0.7;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}
