/* Header Público - Estilo SaaS: 3 zonas, sticky, compacto */
/* Estructura: [Logo] | centro vacío | [ES EN] [Área privada] */

.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.navbar-container {
  display: grid;
  grid-template-columns: minmax(190px, auto) 1fr auto;
  align-items: center;
  padding: 10px 28px;
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  gap: 12px;
  min-height: 56px;
}

.header-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Enlaces públicos (landing): funcionalidades, contacto, demo */
.header-nav-landing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.25rem;
}
.header-nav-landing a {
  color: #334155;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.header-nav-landing a:hover {
  color: #0088cc;
}
@media (max-width: 900px) {
  .header-nav-landing {
    display: none;
  }
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

.logo {
  display: flex;
  align-items: center;
}

.logo a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #333;
}

.logo img {
  height: 44px;
  width: auto;
  display: block;
}

/* Navegación */
.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: #555;
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a:hover {
  color: #1e90ff;
}

.nav-links a:hover::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #1e90ff;
}


/* Selector de idioma: segment control (pill) - ES | EN */
.navbar .language-switch,
.language-switch {
  display: inline-flex !important;
  align-items: stretch;
  gap: 0;
  background: #f2f3f5;
  border-radius: 8px;
  padding: 2px;
  min-height: 30px;
}

.navbar .language-switch .lang-link,
.language-switch .lang-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #5a6575;
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.navbar .language-switch .lang-link:hover,
.language-switch .lang-link:hover {
  color: #5a6b7a;
  background: rgba(0, 0, 0, 0.05);
}

.navbar .language-switch .lang-link.active,
.language-switch .lang-link.active {
  color: #4a5568 !important;
  background: rgba(0, 0, 0, 0.08) !important;
  font-weight: 600;
  cursor: default;
  pointer-events: none;
}

.navbar .language-switch .lang-sep,
.language-switch .lang-sep {
  display: none !important;
}

/* Legacy: selector desplegable (por si se usa en otras vistas) */
.language-selector {
  position: relative;
  display: inline-block;
}

.language {
  display: none; /* Ocultamos el select original */
}

.flag-dropdown {
  position: relative;
  display: inline-block;
}

/* Selector de idioma: botón y opciones con texto ES / EN */
.flag-trigger,
.lang-trigger {
  min-width: 48px;
  min-height: 48px;
  padding: 0 10px;
  border-radius: 6px;
  border: 2px solid #e9ecef;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  background: #fff;
}

.lang-trigger:hover,
.flag-trigger:hover {
  border-color: #1e90ff;
  color: #1e90ff;
  transform: scale(1.02);
}

.flag-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  padding: 8px;
  margin-top: 4px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.flag-dropdown-menu.show {
  display: flex;
  animation: fadeInDown 0.2s ease-out;
}

.flag-option,
.lang-option {
  min-width: 40px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  text-align: center;
}

.flag-option:hover,
.lang-option:hover {
  background: #f8f9fa;
  border-color: #1e90ff;
  color: #1e90ff;
}

.flag-option.active,
.lang-option.active {
  border-color: #1e90ff;
  color: #1e90ff;
  background: rgba(30, 144, 255, 0.08);
}

/* Botones */
.btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* CTA header público: Solicitar una demo (primario) + Área Privada (secundario) */
.navbar .header-right .btn.btn-demo,
.navbar .header-right .btn.btn-cta,
.navbar .header-right .btn.login,
.navbar .header-right .btn.btn-login {
  display: inline-flex !important;
}

/* CTA primario: Solicitar una demo */
.navbar .header-right .btn.btn-demo {
  background: #0096E0;
  color: #fff !important;
  border: none;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 150, 224, 0.25);
}

.navbar .header-right .btn.btn-demo:hover {
  background: #0080c4;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(0, 150, 224, 0.35);
}

/* CTA secundario: Área Privada (outline) */
.navbar .header-right .btn.btn-login {
  background: transparent;
  color: #0096E0 !important;
  border: 2px solid #0096E0;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.navbar .header-right .btn.btn-login:hover {
  background: rgba(0, 150, 224, 0.08);
  color: #0080c4 !important;
  border-color: #0080c4;
}

.btn.btn-cta,
.btn.login {
  background: #0096E0;
  color: #fff !important;
  border: none;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 150, 224, 0.25);
  width: auto;
}

.btn.btn-cta:hover,
.btn.login:hover {
  background: #0080c4;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(0, 150, 224, 0.35);
}

.btn.register {
  background-color: #1e90ff;
  color: #fff;
  border-color: #1e90ff;
}

.btn.register:hover {
  background-color: #0d7ce8;
  border-color: #0d7ce8;
  color: #fff;
}

/* Botón del menú móvil */
.menu-toggle {
  display: none; /* Oculto por defecto, se mostrará en móvil */
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: #555;
  min-width: 48px;
  min-height: 48px;
  padding: 12px;
  border-radius: 4px;
  transition: all 0.3s ease;
  margin-left: 12px; /* Separación del botón de Área Privada */
  align-items: center;
  justify-content: center;
}

.menu-toggle:hover {
  background-color: #f8f9fa;
  color: #1e90ff;
}

/* Botón nav-toggle (alternativo) */
.nav-toggle {
  display: none;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: #555;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.nav-toggle:hover {
  background-color: #f8f9fa;
  color: #1e90ff;
}

/* Menú móvil desplegable (debajo del header, ancho completo) */
.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  background-color: #fff;
  border-top: 1px solid #e9ecef;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 1001;
  padding: 20px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}

.mobile-menu.show {
  display: block !important;
  animation: fadeInDown 0.3s ease-out;
}

.mobile-nav-links {
  list-style: none;
  margin: 0 0 20px 0;
  padding: 0;
}

.mobile-nav-links li {
  margin-bottom: 12px;
}

.mobile-nav-links a {
  color: #555;
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  display: block;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.mobile-nav-links a:hover {
  color: #1e90ff;
}

.mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-actions .language {
  width: 100%;
  margin-bottom: 8px;
}

.mobile-actions .language-selector {
  justify-content: center;
  margin-bottom: 16px;
}

.mobile-actions .language-switch {
  justify-content: center;
  margin-bottom: 12px;
  padding: 4px;
}

.mobile-actions .language-switch .lang-link {
  min-width: 48px;
  padding: 10px 18px;
  font-size: 15px;
}

.mobile-actions .flag-dropdown-menu {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}

.mobile-actions .btn {
  width: 100%;
  justify-content: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .navbar-container {
    padding: 10px 20px;
    max-width: 100%;
  }

  .nav-links {
    gap: 24px;
  }

  .language-switch {
    min-height: 28px;
    padding: 2px;
  }

  .language-switch .lang-link {
    min-width: 30px;
    min-height: 26px;
    padding: 0 8px;
    font-size: 11px;
  }
}

/* Móvil: [Logo] izquierda | [ES EN] [Área privada] derecha */
@media (max-width: 768px) {
  .navbar-container {
    grid-template-columns: auto 1fr;
    padding: 10px 16px;
    gap: 12px;
    min-height: 52px;
  }

  .header-left {
    grid-column: 1;
  }

  .header-center {
    display: none;
  }

  .header-right {
    grid-column: 2;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    min-width: 0;
  }

  .language-switch {
    padding: 2px;
    min-height: 34px;
  }

  .language-switch .lang-link {
    min-width: 36px;
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }

  /* En móvil no se muestra "Solicitar una demo" en el header */
  .navbar .header-right .btn.btn-demo {
    display: none !important;
    visibility: hidden !important;
  }

  .header-right .btn.btn-cta,
  .header-right .btn.btn-login,
  .header-right .btn.login {
    display: inline-flex !important;
    visibility: visible !important;
    width: auto !important;
    min-width: 100px;
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
  }

  .header-right .language-selector {
    display: none;
  }

  .logo img {
    height: 40px;
  }
}

@media (max-width: 480px) {
  .navbar-container {
    padding: 8px 12px;
    min-height: 48px;
  }

  .logo img {
    height: 36px;
  }

  .navbar .header-right .btn.btn-demo {
    display: none !important;
    visibility: hidden !important;
  }

  .header-right .btn.btn-cta,
  .header-right .btn.btn-login,
  .header-right .btn.login {
    min-width: 88px;
    padding: 6px 12px;
    font-size: 12px;
    min-height: 34px;
  }

  .language-switch .lang-link {
    min-width: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  .mobile-menu {
    padding: 16px;
  }

  .mobile-menu .menu-toggle,
  .mobile-menu .nav-toggle {
    display: none !important;
    visibility: hidden !important;
  }
}

/* Animaciones */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Accesibilidad */
.btn:focus,
.menu-toggle:focus,
.language:focus {
  outline: 2px solid #1e90ff;
  outline-offset: 2px;
}

/* Estados activos */
.nav-links a.active {
  color: #1e90ff;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #1e90ff;
}

/* Botón Sidebar Toggle para Móvil (Header Privado) */
.sidebar-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  color: #0088CC;
  font-size: 24px;
  cursor: pointer;
  padding: 8px 12px;
  margin-right: 12px;
  border-radius: 6px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar-toggle-btn:hover {
  background-color: rgba(0, 136, 204, 0.1);
  color: #0070B5;
}

.sidebar-toggle-btn:active {
  background-color: rgba(0, 136, 204, 0.2);
}

/* Mostrar botón hamburguesa solo en resoluciones móviles (< 1024px) */
@media (max-width: 768px) {
  .sidebar-toggle-btn {
    display: block;
  }
}

/* Header privado: hamburguesa + logo en la misma fila que el avatar */
#header-private .header-left {
  gap: 12px;
}

#header-private .navbar-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
