/* ============================================================
   HEADER ACTIONS - Sistema unificado
   Buscador + Botón Contacto + Selector Idioma
   Diseño cohesivo sin herencias
============================================================ */

/* ==================== VARIABLES LOCALES ==================== */
:root {
  --header-action-height: 38px;
  --header-action-font: 'Inter', -apple-system, sans-serif;
  --header-action-font-size: 0.9375rem;
  --header-action-font-weight: 500;
  --header-action-radius: 8px;
  --header-action-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --header-action-color: #1f2937;
  --header-action-bg: #ffffff;
  --header-action-border: #d1d5db;
}

/* ==================== IMPORTANTE: SIN RESETS GLOBALES ==================== */
/* Cada elemento tiene TODOS sus estilos definidos explícitamente */
/* No se hereda NADA de otros archivos CSS */

/* ==================== 1. BUSCADOR ==================== */
.hea-buscador {
  display: flex;
  align-items: center;
  position: relative;
  height: var(--header-action-height);
  margin: 0;
}

.hea-buscador i {
  position: absolute;
  left: 12px;
  font-size: 15px;
  color: #9ca3af;
  pointer-events: none;
  z-index: 1;
}

.hea-buscador input {
  display: block;
  height: var(--header-action-height);
  width: 160px;
  padding: 0 14px 0 36px;
  margin: 0;
  background: var(--header-action-bg);
  border: 1px solid var(--header-action-border);
  border-radius: var(--header-action-radius);
  font-family: var(--header-action-font);
  font-size: var(--header-action-font-size);
  font-weight: var(--header-action-font-weight);
  color: var(--header-action-color);
  line-height: 1;
  transition: var(--header-action-transition);
  outline: none;
  box-sizing: border-box;
}

.hea-buscador input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.hea-buscador input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.hea-buscador button[type="submit"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==================== 2. BOTÓN CONTACTO ==================== */
.btn-contacto {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--header-action-height);
  padding: 0 20px;
  margin: 0;
  background: #002244;
  border: 1px solid #002244;
  border-radius: var(--header-action-radius);
  font-family: var(--header-action-font);
  font-size: var(--header-action-font-size);
  font-weight: 600;
  color: #ffffff;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: var(--header-action-transition);
  white-space: nowrap;
  box-sizing: border-box;
  vertical-align: middle;
}

.btn-contacto:hover {
  background: #003366;
  border-color: #003366;
  transform: translateY(-1px);
}

.btn-contacto:active {
  transform: translateY(0);
}

/* ==================== 3. SELECTOR DE IDIOMA ==================== */
.language-selector {
  display: inline-block;
  position: relative;
}

.lang-current-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--header-action-height);
  padding: 0 14px;
  margin: 0;
  background: var(--header-action-bg);
  border: 1px solid var(--header-action-border);
  border-radius: var(--header-action-radius);
  font-family: var(--header-action-font);
  font-size: var(--header-action-font-size);
  font-weight: 600;
  color: var(--header-action-color);
  line-height: 1;
  cursor: pointer;
  transition: var(--header-action-transition);
  white-space: nowrap;
  min-width: 70px;
  box-sizing: border-box;
  vertical-align: middle;
}

.lang-current-btn:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

.lang-current-btn.active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.lang-code {
  display: inline-block;
  font-size: var(--header-action-font-size);
  font-weight: 600;
  color: inherit;
  line-height: 1;
}

.lang-arrow {
  display: inline-block;
  font-size: 11px;
  transition: transform 0.2s ease;
  line-height: 1;
}

.lang-current-btn.active .lang-arrow {
  transform: rotate(180deg);
}

/* ==================== DROPDOWN DE IDIOMAS ==================== */
.lang-dropdown {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: none;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  z-index: 1001;
  transition: max-height 0.25s ease, opacity 0.25s ease;
}

.lang-dropdown.visible {
  max-height: 200px;
  opacity: 1;
  overflow: visible;
}

.lang-dropdown-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem 3rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: var(--header-action-radius);
  font-family: var(--header-action-font);
  font-size: var(--header-action-font-size);
  font-weight: 500;
  color: var(--header-action-color);
  text-decoration: none;
  cursor: pointer;
  transition: var(--header-action-transition);
  min-width: 130px;
  line-height: 1;
}

.lang-option:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.lang-option.active {
  background: #002244;
  color: white;
  border-color: #002244;
  box-shadow: 0 4px 16px rgba(0, 34, 68, 0.3);
  font-weight: 600;
}

.lang-option.current {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
  font-weight: 600;
}

.lang-icon {
  display: inline-block;
  font-size: 18px;
  width: 24px;
  text-align: center;
  line-height: 1;
}

.lang-flag {
  display: inline-block;
  font-size: 20px;
  line-height: 1;
}

.lang-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lang-name {
  display: inline-block;
  font-size: 0.7rem;
  opacity: 0.7;
  font-weight: 500;
  line-height: 1;
}

.lang-option.active .lang-name {
  opacity: 0.9;
}

/* ==================== OVERLAY ==================== */
.lang-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.02);
  z-index: 1000;
  display: none;
}

.lang-overlay.visible {
  display: block;
}

/* ==================== SELECTOR MÓVIL ==================== */
/* Oculto por defecto en desktop, visible solo en mobile via _navigation.css @media */
.hea-lang-mobile {
  display: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #002244;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-base);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 34, 68, 0.2);
  margin-right: 12px;
  margin-left: 0;
  outline: none;
  box-sizing: border-box;
}

.hea-lang-mobile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 34, 68, 0.3);
}

.hea-lang-mobile:active {
  transform: translateY(0);
}

.hea-lang-mobile.active {
  background: #003366;
}

.lang-code-mobile {
  display: block;
}

/* Panel desplegable móvil */
.lang-mobile-panel {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  background: #ffffff;
  border-bottom: 2px solid #e5e7eb;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  max-height: 0;
  overflow: hidden;
  z-index: 1001;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
}

.lang-mobile-panel.visible {
  max-height: 100px;
  opacity: 1;
  animation: langMobileFadeIn 0.3s ease;
}

/* Contenedor de opciones en horizontal */
.lang-mobile-options {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

/* Cada opción de idioma */
.lang-mobile-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 44px;
  padding: 0 16px;
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.25s ease;
  cursor: pointer;
  box-sizing: border-box;
}

.lang-mobile-option:hover {
  border-color: #002B45;
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 43, 69, 0.15);
}

.lang-mobile-option.active {
  background: #002244;
  border-color: #002244;
  box-shadow: 0 4px 16px rgba(0, 34, 68, 0.25);
}

.lang-mobile-code {
  font-family: var(--font-base);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #0f3a5c;
}

.lang-mobile-option.active .lang-mobile-code {
  color: white;
}

/* Animación de entrada */
@keyframes langMobileFadeIn {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 100px;
  }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .hea-nav .hea-buscador,
  .btn-contacto,
  .language-selector.desktop-only {
    display: none;
  }
}

/* ==================== ACCESIBILIDAD ==================== */
.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;
}
