/* =============================================================
   NAVBAR.CSS — Futunet (Mobile-First Responsive)
   Consolidated — no duplicate overrides.
   ============================================================= */

/* ── 1. NAVBAR PRINCIPAL ── */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: var(--navbar-height-mobile);
  display: flex; align-items: center;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-bottom: 1px solid rgba(17, 24, 39, 0.05);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
              box-shadow .3s ease,
              background .3s ease,
              height .3s ease;
}
#navbar.scrolled {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  box-shadow: 0 12px 32px rgba(10, 112, 162, 0.06);
}
#navbar.nav-hidden {
  transform: translateY(-100%);
}

/* ── COMPACT SEARCH BAR (visible on scroll) ── */
.nav-search-compact {
  display: none;
  align-items: center;
  position: relative;
  flex: 0 1 340px;
  margin-left: auto;
  margin-right: 8px;
  height: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0 12px;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(-4px);
}
.nav-search-compact__icon {
  width: 16px; height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.nav-search-compact__input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Outfit', sans-serif;
  font-size: .84rem;
  color: var(--text-primary);
  padding: 0 8px;
  min-width: 0;
}
.nav-search-compact__input::placeholder { color: var(--text-muted); }
.nav-search-compact:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(10, 112, 162, 0.08);
}

/* Show search when scrolled past hero OR when a banner slide is active */
#navbar.scrolled .nav-search-compact {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
/* When hero slide is showing and logo is visible, hide navbar logo+search */
#navbar.hero-slide-active:not(.scrolled) .nav-search-compact {
  display: none;
}
#navbar.hero-slide-active:not(.scrolled) .nav-logo {
  opacity: 0;
  pointer-events: none;
}
/* When banner slide is active, always show navbar logo+search */
#navbar.banner-slide-active .nav-search-compact {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
#navbar.banner-slide-active .nav-logo {
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}
/* Give navbar a solid background on banner slides */
#navbar.banner-slide-active {
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(10, 112, 162, 0.08);
}
/* Override nav-hero-logo-hidden when banner is active */
#navbar.nav-hero-logo-hidden.banner-slide-active .nav-logo {
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}
#navbar.nav-hero-logo-hidden:not(.banner-slide-active) .nav-search-compact {
  display: none;
}

/* ── 2. NAV INNER ── */
.nav-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 clamp(18px, 2.6vw, 38px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
}

/* ── 3. LOGO ── */
.nav-logo {
  display: flex; align-items: center;
  flex: 0 0 auto;
  position: relative; z-index: 1;
  transition: opacity 0.24s ease, visibility 0.24s ease, transform 0.24s ease;
}
.nav-logo img {
  width: auto;
  height: 34px;
  display: block;
  transform-origin: left center;
  transition: transform 0.3s ease, height 0.3s ease;
  object-fit: contain;
  object-position: left center;
  pointer-events: auto;
}
.nav-logo-name {
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.3rem;
}

#navbar.nav-hero-logo-hidden .nav-logo {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
}

/* ── 4. MENÚ DESKTOP (oculto en mobile) ── */
.nav-menu {
  display: none; align-items: center; gap: 4px;
  margin-left: auto;
  list-style: none; position: relative; z-index: 2;
}
.nav-menu li a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  font-size: .9rem; font-weight: 600;
  color: var(--text-muted);
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: var(--transition);
}
.nav-menu li a:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-color: rgba(11, 126, 181, 0.08);
}
.nav-menu li a.active,
.nav-menu li a[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-pale);
  border-color: rgba(11, 126, 181, 0.12);
}

/* ── 5. WHATSAPP BUTTON ── */
.nav-wa-btn {
  display: flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, #25d366, #20bd5a);
  color: #fff !important;
  min-height: 46px;
  padding: 0 18px !important;
  border-radius: 50px !important;
  font-weight: 700 !important; font-size: .85rem !important;
  transition: all .3s !important;
  box-shadow: 0 10px 24px rgba(37,211,102,0.24);
  position: relative;
  z-index: 2;
}
.nav-wa-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(37,211,102,0.35) !important;
}

/* ── 6. HAMBURGUESA (visible en mobile) ── */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  margin-left: auto;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: .3s;
}

/* ── 7. MENÚ MOBILE ── */
.mobile-menu {
  display: flex; flex-direction: column;
  position: fixed;
  top: var(--navbar-height-mobile);
  left: 0; right: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 16px 16px 20px;
  gap: 8px;
  z-index: 899;
  max-height: calc(100svh - var(--navbar-height-mobile));
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  border-radius: 0 0 22px 22px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s;
  pointer-events: none;
}
.mobile-menu.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.mobile-menu a {
  display: flex;
  align-items: center;
  min-height: 48px;
  font-size: .98rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: var(--transition);
}
.mobile-menu a:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.mobile-menu a.active,
.mobile-menu a[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-pale);
  border-color: rgba(11, 126, 181, 0.12);
}

/* ── 8. RESPONSIVE — DESKTOP (≥1024px) ── */
@media (min-width: 1024px) {
  #navbar { height: 82px; }
  #navbar.scrolled { height: 68px; }
  .nav-inner { padding: 0 clamp(22px, 3vw, 42px); }
  .nav-logo img {
    height: 36px;
  }
  #navbar.scrolled .nav-logo img {
    height: 34px;
  }
  .nav-logo-name { font-size: 1.5rem; }
  .nav-menu { display: flex; }
  .hamburger { display: none; }
  .mobile-menu { top: 82px; }
}

/* ── 9. RESPONSIVE — LARGE DESKTOP (≥1200px) ── */
@media (min-width: 1200px) {
  .nav-logo img {
    height: 38px;
  }
  #navbar.scrolled .nav-logo img {
    height: 35px;
  }
}

/* ── 10. RESPONSIVE — MOBILE & TABLET (≤1023px) ── */
@media (max-width: 1023px) {
  .nav-search-compact {
    flex: 1 1 auto !important;
    margin-left: 6px;
    margin-right: 6px;
    height: 36px;
    padding: 0 10px;
  }
  .mobile-menu {
    padding-bottom: 24px;
  }
  #navbar {
    height: 64px;
  }
  #navbar.nav-hero-logo-hidden {
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .nav-inner {
    padding: 0 12px 0 12px;
    gap: 8px;
  }
  #navbar.nav-hero-logo-hidden:not(.banner-slide-active) .nav-inner {
    justify-content: flex-end;
  }
  .nav-logo img {
    height: 26px;
  }
  .hamburger {
    min-width: 44px;
    min-height: 44px;
    gap: 4px;
    padding: 8px;
  }
  #navbar.nav-hero-logo-hidden:not(.banner-slide-active) .hamburger {
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(17, 24, 39, 0.16);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 25, 35, 0.12);
  }
  .hamburger span { width: 20px; }
  .mobile-menu {
    top: 64px;
    padding: 12px 12px 16px;
    gap: 4px;
    border-radius: 0 0 18px 18px;
  }
  .mobile-menu a {
    min-height: 44px;
    font-size: .92rem;
    padding: 10px 14px;
    border-radius: 12px;
  }
}
