/* ========================================
   HEADER & NAVIGATION - CSS OPTIMIZADO
   NavegaciÃƒÂ³n responsiva con efectos premium
======================================== */

/* ========================================
   VARIABLES ESPECÃƒFICAS HEADER
======================================== */
:root {
  /* Colores especÃƒÂ­ficos para header */
  --header-bg: rgba(255, 255, 255, 0.95);
  --header-bg-scroll: rgba(255, 255, 255, 0.98);
  --header-border: rgba(59, 130, 246, 0.1);
  --nav-link-color: var(--dark-gray);
  --nav-link-hover: var(--primary-blue);
  --nav-link-active: var(--primary-blue);
  --primary-blue: #3b82f6;
  --secondary-blue: #6366f1;
  --shadow-blue: 0 10px 15px -3px rgba(59, 130, 246, 0.3), 0 4px 6px -2px rgba(59, 130, 246, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  --radius-xl: 12px;
  --gradient-cta: linear-gradient(135deg, #25D366, #128C7E); /* Verde WhatsApp */
  --shadow-xl: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-2xl: 0 6px 20px rgba(0, 0, 0, 0.2);
  
  /* Gradientes para navegaciÃƒÂ³n */
  --gradient-nav-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
  --gradient-mobile-nav: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
  --gradient-cta: linear-gradient(45deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
  
  /* Dimensiones y transiciones */
  --header-height: 80px;
  --header-height-mobile: 70px;
  --nav-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --mobile-nav-width: 100%;
  --logo-size: 2.5rem;
  --logo-size-mobile: 2rem;
}

/* ========================================
   HEADER PRINCIPAL
======================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--gradient-nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--header-border);
  z-index: 1000;
  transition: var(--nav-transition);
  height: var(--header-height);
}

/* Header con scroll */
.header.scrolled {
  background: var(--header-bg-scroll);
  box-shadow: var(--shadow-lg);
  border-bottom-color: rgba(59, 130, 246, 0.15);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  position: relative;
}

/* ========================================
   LOGO
======================================== */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  transition: var(--nav-transition);
  position: relative;
  z-index: 1001;
}

.logo:hover {
  transform: translateY(-2px);
}

.logo-img {
  width: var(--logo-size);
  height: var(--logo-size);
  object-fit: contain;
  background: transparent;
  transition: var(--nav-transition);
}

.logo-text {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
  background: var(--gradient-cta);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo:hover .logo-img {
  transform: rotate(5deg) scale(1.1);
}

/* ========================================
   NAVEGACIÃƒ"N DESKTOP
======================================== */
.nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-1);
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  color: var(--nav-link-color);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
  transition: var(--nav-transition);
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left 0.5s ease;
}

.nav-link:hover::before {
  left: 100%;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--nav-link-hover);
  background: rgba(59, 130, 246, 0.08);
  transform: translateY(-1px);
}

.nav-link.active {
  color: var(--nav-link-active);
  background: rgba(59, 130, 246, 0.12);
  font-weight: 600;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  display: none;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  /*background: var(--gradient-cta);*/
  border-radius: 1px;
}

/* ========================================
   CTA BUTTON HEADER
======================================== */
.cta-button {
  background: var(--gradient-cta);
  color: white;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-xl);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  box-shadow: var(--shadow-blue);
  transition: var(--nav-transition);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
  overflow: hidden;
  min-height: 44px;
}

.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, var(--secondary-blue) 0%, #8b5cf6 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cta-button:hover::before {
  opacity: 1;
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

.cta-button > * {
  position: relative;
  z-index: 1;
}

/* ========================================
   MOBILE MENU TOGGLE
======================================== */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  background: none;
  border: none;
  cursor: pointer;
  color: #000;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  transition: var(--nav-transition);
  position: relative;
  z-index: 1001;
}
/* Las rayitas */
.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  margin: 4px 0;
  background-color: var(--black); /* Ã°Å¸'Ë† cambia aquÃƒÂ­ el color */
  transition: all 0.3s ease;
}

/* Estado activo Ã¢â€ ' se cruza en una X */
.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}
.mobile-menu-toggle:hover {
  background: rgba(59, 130, 246, 0.08);
}


/* ========================================
   MENÃƒÅ¡ HAMBURGUESA
======================================== */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 48px !important;
    height: 48px !important;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: var(--radius-lg);
    transition: var(--nav-transition);
    position: relative;
    z-index: 1001 !important;
}

.mobile-menu-toggle:hover {
    background: rgba(59, 130, 246, 0.08);
}

.hamburger-line {
    display: block;
    width: 24px !important;
    height: 3px !important;
    background-color: var(--dark-gray) !important;
    margin: 3px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 2px !important;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px) !important;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0 !important;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px) !important;
}

/* ========================================
   NAVEGACIÃƒ"N MÃƒ"VIL
======================================== */
.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-8);
    opacity: 0;
}

.mobile-nav.active {
    transform: translateX(0);
    opacity: 1;
}

.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: center;
}

.mobile-nav-item {
    margin: var(--space-4) 0;
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav.active .mobile-nav-item {
    opacity: 1;
    transform: translateX(0);
}

.mobile-nav-item:nth-child(1) { transition-delay: 0.1s; }
.mobile-nav-item:nth-child(2) { transition-delay: 0.2s; }
.mobile-nav-item:nth-child(3) { transition-delay: 0.3s; }
.mobile-nav-item:nth-child(4) { transition-delay: 0.4s; }
.mobile-nav-item:nth-child(5) { transition-delay: 0.5s; }

.mobile-nav-link {
    display: block;
    color: white;
    text-decoration: none;
    font-size: var(--text-2xl);
    font-weight: 600;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    transition: var(--nav-transition);
    position: relative;
}

.mobile-nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.mobile-nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-nav-cta {
    margin-top: var(--space-12);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: 0.6s;
}

.mobile-nav.active .mobile-nav-cta {
    opacity: 1;
    transform: translateY(0);
}

/* CTA mÃƒÂ³vil con icono + texto */
.mobile-nav-cta .cta-button {
    width: auto;               /* Ajusta al contenido */
    min-width: 200px;          /* Ancho mÃƒÂ­nimo para que se vea bien */
    padding: 12px 20px;        /* Espaciado cÃƒÂ³modo */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;                 /* SeparaciÃƒÂ³n entre icono y texto */
    font-size: 1rem;           /* TamaÃƒÂ±o de texto legible */
    border-radius: var(--radius-xl);
    background: var(--gradient-cta);
    color: white;
    box-shadow: var(--shadow-xl);
}

.mobile-nav-cta .cta-button i {
    font-size: 1.25rem;
    color: white;
}

/* Hover */
.mobile-nav-cta .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2xl);
}

/* ========================================
   CTA MÃƒ"VIL
======================================== */
.mobile-nav-cta {
  margin-top: var(--space-12);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  transition-delay: 0.6s;
}

.mobile-nav.active .mobile-nav-cta {
  opacity: 1;
  transform: translateY(0);
}

.mobile-nav-cta .btn {
  background: white;
  color: var(--primary-blue);
  font-weight: 700;
  padding: var(--space-5) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  transition: var(--nav-transition);
  gap: var(--space-3);
  min-height: 56px;
}

.mobile-nav-cta .btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2xl);
  background: rgba(255, 255, 255, 0.95);
}

/* ========================================
   RESPONSIVE DESIGN - HEADER
======================================== */

/* Tablets y pantallas medianas */
@media (max-width: 991.98px) {
  .nav {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .cta-button {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
  }
  
  .cta-button span {
    display: none;
  }
  
  .cta-button i {
    font-size: 1.25rem;
  }
}

/* MÃƒÂ³viles */
@media (max-width: 575.98px) {
  :root {
    --header-height: var(--header-height-mobile);
    --logo-size: var(--logo-size-mobile);
  }
  
  .header {
    height: var(--header-height-mobile);
  }
  
  .header-content {
    height: var(--header-height-mobile);
    padding: 0 var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .logo {
    flex: 0 0 auto;
  }
  
  .logo-text {
    font-size: var(--text-xl);
  }
  
  /* Centrar CTA + Hamburger a la derecha */
  .header-content > :last-child {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }
  
  .header .cta-button {
    width: 48px;
    height: 48px;
    padding: 0 !important;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary) !important;
    box-shadow: var(--shadow-blue) !important;
  }
  
  .header .cta-button span {
    display: none;
  }
  
  .header .cta-button i {
    font-size: 1.25rem;
    color: white;
  }
  
  .mobile-nav-link {
    font-size: var(--text-xl);
  }
  
  .mobile-nav {
    padding: var(--space-6) var(--space-4);
  }
  
  .mobile-nav-cta .btn {
    width: 100%;
    max-width: 280px;
    background: var(--gradient-primary) !important;
    box-shadow: var(--shadow-blue) !important;
  }
}

/* Landscape mÃƒÂ³vil */
@media (max-width: 991.98px) and (orientation: landscape) and (max-height: 500px) {
  .mobile-nav {
    padding: var(--space-4);
  }
  
  .mobile-nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
  }
  
  .mobile-nav-item {
    margin: var(--space-2);
  }
  
  .mobile-nav-link {
    font-size: var(--text-lg);
    padding: var(--space-3);
  }
  
  .mobile-nav-cta {
    margin-top: var(--space-6);
  }
}

/* ========================================
   ANIMACIONES MEJORADAS
======================================== */

/* Efecto de entrada suave */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header {
  animation: fadeInDown 0.6s ease-out;
}

/* Ripple effect para botones */
.nav-link,
.cta-button,
.mobile-nav-link {
  position: relative;
  overflow: hidden;
}

.nav-link::after,
.cta-button::after,
.mobile-nav-link::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.nav-link:active::after,
.cta-button:active::after,
.mobile-nav-link:active::after {
  width: 200px;
  height: 200px;
}

/* ========================================
   ESTADOS DE FOCUS MEJORADOS
======================================== */
.nav-link:focus,
.cta-button:focus,
.mobile-menu-toggle:focus,
.mobile-nav-link:focus {
  outline: 3px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* ========================================
   MEJORAS DE PERFORMANCE
======================================== */
.header {
  contain: layout style;
  will-change: transform, background-color;
}

.mobile-nav {
  contain: layout style;
  will-change: transform;
}

.logo-img,
.hamburger-line {
  will-change: transform;
}

/* ========================================
   EFECTOS SCROLL AVANZADOS
======================================== */
@media (min-width: 992px) {
  /* Header que se oculta al hacer scroll down y aparece al scroll up */
  .header.hide-on-scroll {
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
  }
  
  .header.show-on-scroll {
    transform: translateY(0);
  }
  
  /* Efecto parallax sutil en el logo */
  .logo-img {
    transition: transform 0.3s ease-out;
  }
  
  .header.scrolled .logo-img {
    transform: scale(0.9);
  }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {
  .header {
    position: static;
    background: none;
    box-shadow: none;
    border-bottom: 1px solid #ddd;
  }
  
  .mobile-menu-toggle,
  .mobile-nav,
  .cta-button {
    display: none;
  }
  
  .nav-list {
    gap: var(--space-4);
  }
  
  .nav-link {
    color: #000;
    background: none;
  }
}

/* ========================================
   SCROLL INDICATOR - CORREGIDO
======================================== */

/* Scroll indicator que va dentro del header (ELIMINADO - causaba problemas) */
.scroll-indicator {
  display: none; /* Lo deshabilitamos para evitar conflictos */
}

/* ========================================
   SCROLL INDICATOR FIJO - MEJORADO
======================================== */

.scroll-indicator-fixed {
    position: fixed;
    top: 0 !important; /* Siempre pegado arriba */
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
    z-index: 10001 !important; /* MÁS ALTO que todo */
    transition: width 0.1s ease-out;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    pointer-events: none;
    transform: translateZ(0) translateY(0) !important; /* Forzar posición */
    will-change: width;
    /* IMPORTANTE: Hacer que sea completamente independiente */
    position: fixed !important;
    display: block !important;
}

/* Asegurar que NUNCA se mueva con el header */
.scroll-indicator-fixed {
    /* Estas propiedades hacen que sea completamente independiente */
    transform: translate3d(0, 0, 0) !important;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Estado visible del scroll indicator - mejorado */
.scroll-indicator-fixed.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) scaleX(1) !important;
}

/* Cuando el header está oculto, el scroll indicator debe permanecer visible */
.header.hide-on-scroll + .scroll-indicator-fixed,
.header[style*="translateY(-100%)"] + .scroll-indicator-fixed {
    top: 0 !important;
    transform: translate3d(0, 0, 0) !important;
    z-index: 10001 !important;
}


/* ========================================
   SCROLL INDICATOR INDEPENDIENTE
======================================== */
.scroll-indicator-fixed {
    /* Hacer completamente independiente del header */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
    z-index: 10001 !important; /* SIEMPRE por encima del header */
    transition: width 0.1s ease-out;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    pointer-events: none;
    transform: translate3d(0, 0, 0) !important;
    will-change: width;
    /* Asegurar que sea un elemento de primera capa */
    contain: layout style paint;
    isolation: isolate;
}

/* ========================================
   MEJORAS ADICIONALES
======================================== */

/* Efecto de pulsación suave para el scroll indicator */
@keyframes pulse-scroll {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4); 
    }
    50% { 
        box-shadow: 0 2px 12px rgba(59, 130, 246, 0.6); 
    }
}

/* ========================================
   DARK MODE SUPPORT
======================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --header-bg: rgba(15, 23, 42, 0.95);
    --header-bg-scroll: rgba(15, 23, 42, 0.98);
    --header-border: rgba(59, 130, 246, 0.2);
    --nav-link-color: #e2e8f0;
    --nav-link-hover: #60a5fa;
    --nav-link-active: #3b82f6;
    --gradient-nav-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
  }

  .header {
    background: var(--gradient-nav-bg);
    border-bottom-color: rgba(59, 130, 246, 0.2);
  }

  .header.scrolled {
    background: var(--header-bg-scroll);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    border-bottom-color: rgba(59, 130, 246, 0.25);
  }

  .logo-text {
    color: #f8fafc;
  }

  .nav-link {
    color: var(--nav-link-color);
  }

  .nav-link:hover,
  .nav-link:focus {
    color: var(--nav-link-hover);
    background: rgba(59, 130, 246, 0.15);
  }

  .nav-link.active {
    color: var(--nav-link-active);
    background: rgba(59, 130, 246, 0.2);
  }

  .mobile-menu-toggle:hover {
    background: rgba(59, 130, 246, 0.15);
  }

  .hamburger-line {
    background-color: #e2e8f0 !important;
  }

  .mobile-nav {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }

  .mobile-nav-link {
    color: #f1f5f9;
  }

  .mobile-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .mobile-nav-link.active {
    background: rgba(255, 255, 255, 0.15);
  }
}