/* ========================================
   INSTALACIONES - SMARTCLINIC
   ======================================== */

body {
  font-family: var(--font-primary);
  color: var(--color-text-primary);
  background: var(--color-white);
}

.container {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ========================================
   HERO
   ======================================== */
.installations-hero {
  background-image: url("../../assets/extras/consultorio.webp");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  padding: calc(var(--header-height) + var(--space-5xl)) 0 var(--space-5xl);
  text-align: center;
  margin-top: var(--header-height);
  position: relative;
  overflow: hidden;
}

.installations-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--hero-overlay-primary);
  z-index: 1;
  animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.installations-hero__content {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  animation: fadeInUp 1s ease-out;
}

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

.installations-hero__label {
  display: inline-block;
  padding: var(--space-xs) var(--space-xl);
  background: rgba(255, 255, 255, 0.15);
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: var(--space-lg);
  backdrop-filter: blur(10px);
  animation: fadeIn 1s ease-out 0.3s backwards;
}

.installations-hero__title {
  font-family: var(--font-display);
  font-size: var(--text-6xl);
  font-weight: var(--weight-bold);
  color: var(--color-white);
  margin-bottom: var(--space-lg);
  line-height: 1.1;
  animation: fadeInUp 1s ease-out 0.2s backwards;
}

.installations-hero__subtitle {
  font-size: var(--text-xl);
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto;
  animation: fadeInUp 1s ease-out 0.4s backwards;
}

/* ========================================
   GALLERY SECTION
   ======================================== */
.installations-gallery {
  padding: var(--space-5xl) 0;
  background: var(--color-white);
}

.gallery-intro {
  text-align: center;
  max-width: 800px;
  margin: 0 auto var(--space-4xl);
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.gallery-intro.animate {
  opacity: 1;
  transform: translateY(0);
}

.gallery-intro__title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  color: var(--color-primary);
  margin-bottom: var(--space-lg);
  position: relative;
  display: inline-block;
}

.gallery-intro__title::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--color-accent);
  transition: width 0.8s ease-out 0.3s;
}

.gallery-intro.animate .gallery-intro__title::after {
  width: 100px;
}

.gallery-intro__text {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  line-height: 1.8;
}

/* ========================================
   LAYOUT: SIDEBAR + GRID
   ======================================== */
.gallery-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-2xl);
  align-items: start;
}
/* ========================================
   CATEGORY SIDEBAR
   ======================================== */
.category-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-xl));
  background: var(--color-off-white);
  padding: var(--space-lg);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s ease-out;
  max-height: calc(100vh - var(--header-height) - var(--space-3xl));
  overflow-y: auto;
  overflow-x: hidden;
}

.category-sidebar.animate {
  opacity: 1;
  transform: translateX(0);
}

/* Scrollbar personalizado para la sidebar */
.category-sidebar::-webkit-scrollbar {
  width: 6px;
}

.category-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.category-sidebar::-webkit-scrollbar-thumb {
  background: var(--color-gray);
  border-radius: 3px;
  transition: background var(--transition-fast);
}

.category-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--color-medium-gray);
}

.category-sidebar__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-primary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-accent);
}

.category-filters {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding-bottom: var(--space-sm);
}

.category-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-white);
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  font-weight: var(--weight-medium);
}

.category-btn:hover {
  background: var(--color-primary-lighter);
  border-color: var(--color-primary);
  transform: translateX(5px);
}

.category-btn.active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
}

.category-btn__icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.category-btn__name {
  font-size: var(--text-xs);
  line-height: 1.3;
}

/* ========================================
   GALLERY GRID
   ======================================== */
.gallery-container {
  min-height: 400px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-xl);
}

.gallery-item {
  position: relative;
  overflow: hidden;
  background: var(--color-off-white);
  aspect-ratio: 4/3;
  border-radius: 12px;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.gallery-item.reveal {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.gallery-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-item__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease; /* Más rápido */
  display: block;
  will-change: opacity; /* Optimización GPU */
}

/* Video */
.gallery-item__video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  will-change: opacity;
}

.gallery-item.playing .gallery-item__image {
  opacity: 0;
}

.gallery-item.playing .gallery-item__video {
  opacity: 1;
}

/* Ocultar video en móviles */
@media (max-width: 768px) {
  .gallery-item__video {
    display: none;
  }
}

/* Overlay con nombre */
.gallery-item__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.7) 60%,
    transparent 100%
  );
  padding: var(--space-xl) var(--space-lg);
  transform: translateY(100%);
  transition: transform var(--transition-base);
}

.gallery-item:hover .gallery-item__overlay,
.gallery-item.show-overlay .gallery-item__overlay {
  transform: translateY(0);
}

.gallery-item__name {
  color: var(--color-white);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Badge decorativo */
.gallery-item::before {
  content: "";
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 10px;
  height: 10px;
  background: var(--color-accent);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0);
  transition: all var(--transition-base);
  z-index: 10;
  box-shadow: 0 0 0 0 rgba(0, 122, 107, 0.4);
}

@keyframes ripple {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 122, 107, 0.4);
  }
  100% {
    box-shadow: 0 0 0 15px rgba(0, 122, 107, 0);
  }
}

/* Sin resultados */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-5xl) 0;
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
}

/* ========================================
   WHATSAPP WIDGET
   ======================================== */
.whatsapp-widget {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-fixed);
  transition: all var(--transition-base);
}

.whatsapp-widget.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.whatsapp-widget__button {
  width: 60px;
  height: 60px;
  background: #25d366;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xl);
  transition: all var(--transition-base);
}

.whatsapp-widget__button:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
}

.whatsapp-widget__button svg {
  width: 32px;
  height: 32px;
}

.whatsapp-widget__badge {
  position: absolute;
  top: -25px;
  right: -10px;
  background: #128c7e;
  color: white;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
  border-radius: 12px;
  opacity: 0;
  animation: badgePulse 1s ease-out 2s forwards,
    pulseBadge 1.2s ease-in-out 3s infinite;
}

@keyframes badgePulse {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulseBadge {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.whatsapp-modal {
  position: fixed;
  bottom: var(--space-5xl);
  right: var(--space-xl);
  width: 320px;
  background: white;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  pointer-events: none;
  transition: all var(--transition-base);
  background-image: url("../../assets/extras/fondo-ws.webp");
  background-size: contain;
  background-position: center;
  border-radius: 12px;
  overflow: hidden;
}

.whatsapp-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.85);
  z-index: 1;
}

.whatsapp-modal.active {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

.whatsapp-modal__header {
  background: #075e54;
  color: white;
  padding: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
}

.whatsapp-modal__header h3 {
  margin: 0;
  font-size: var(--text-lg);
}

.whatsapp-modal__close {
  background: none;
  border: none;
  color: white;
  font-size: var(--text-3xl);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.whatsapp-modal__body {
  padding: var(--space-lg);
  min-height: 150px;
  position: relative;
  z-index: 2;
}

.whatsapp-modal__message {
  background: #dcf8c6;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border-radius: 8px;
  position: relative;
  z-index: 2;
}

.whatsapp-modal__message p {
  margin-bottom: var(--space-sm);
  color: #303030;
  font-size: var(--text-sm);
}

.whatsapp-modal__message p:last-child {
  margin-bottom: 0;
}

.whatsapp-modal__footer {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  position: relative;
  z-index: 2;
}

.whatsapp-modal__input {
  padding: var(--space-md);
  border: 1px solid var(--color-gray);
  border-radius: 8px;
  font-size: var(--text-sm);
  background-color: #f0f0f0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  border-radius: 8px;
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-white);
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
  .installations-hero__title {
    font-size: var(--text-5xl);
  }

  .gallery-layout {
    grid-template-columns: 240px 1fr;
    gap: var(--space-2xl);
  }

  .category-sidebar {
    padding: var(--space-xl);
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-lg);
  }
}

@media (max-width: 768px) {
  .installations-hero {
    padding: calc(var(--header-height) + var(--space-3xl)) 0 var(--space-3xl);
    background-attachment: scroll;
    min-height: 60vh;
  }

  .installations-hero__title {
    font-size: var(--text-4xl);
  }

  .installations-hero__subtitle {
    font-size: var(--text-lg);
  }

  .installations-gallery {
    padding: var(--space-3xl) 0;
  }

  .gallery-intro {
    margin-bottom: var(--space-3xl);
  }

  .gallery-intro__title {
    font-size: var(--text-3xl);
  }

  .gallery-intro__text {
    font-size: var(--text-base);
  }

  /* Sidebar se convierte en horizontal */
  .gallery-layout {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  .category-sidebar {
    position: static;
    padding: var(--space-lg);
  }

  .category-sidebar__title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-md);
  }

  .category-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-sm);
  }

  .category-btn {
    padding: var(--space-sm) var(--space-md);
  }

  .category-btn__icon {
    font-size: var(--text-xl);
  }

  .category-btn__name {
    font-size: var(--text-xs);
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .gallery-item {
    aspect-ratio: 4/3;
  }

  .whatsapp-widget {
    bottom: var(--space-lg);
    right: var(--space-lg);
  }

  .whatsapp-modal {
    width: calc(100% - var(--space-xl) * 2);
    right: var(--space-lg);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-md);
  }

  .installations-hero__title {
    font-size: var(--text-3xl);
  }

  .installations-hero__subtitle {
    font-size: var(--text-base);
  }

  .gallery-intro__title {
    font-size: var(--text-2xl);
  }

  .category-filters {
    grid-template-columns: 1fr;
  }

  .gallery-item__name {
    font-size: var(--text-base);
  }
}
