/* ==========================================================================
   NAVBAR — diseño moderno con drawer mobile real
   ========================================================================== */

/* ── CONTENEDOR PRINCIPAL ────────────────────────────────── */

.navbar-content {
  width: 100%;
  background: rgba(0, 37, 53, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition:
    background 0.4s ease,
    box-shadow 0.4s ease;
  z-index: 1000;
}

.sticky {
  background: rgba(0, 20, 35, 0.97);
  box-shadow: 0 2px 30px rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(59, 137, 173, 0.25);
}

/* ── BARRA DE NAV ────────────────────────────────────────── */

.navbar {
  display: flex;
  align-items: center;
  padding: 0 2rem;
  height: 68px;
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── LOGO ────────────────────────────────────────────────── */

.navbar .navbar-brand {
  flex-shrink: 0;
}

.navbar .logo {
  width: 140px;
  display: block;
  transition: opacity 0.2s;
}

.navbar .logo:hover {
  opacity: 0.85;
}

.navbar .menu-logo-mobile {
  display: none;
}

/* ── LANGUAGE PICKER ─────────────────────────────────────── */

.language-picker {
  position: relative;
  display: inline-block;
  margin-left: 1rem;
  flex-shrink: 0;
}

#select-lang {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 6px 28px 6px 34px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  letter-spacing: 0.3px;
}

#select-lang:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

#select-lang:focus {
  outline: none;
  border-color: rgba(59, 137, 173, 0.7);
  box-shadow: 0 0 0 2px rgba(59, 137, 173, 0.2);
}

.language-picker::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 13px;
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  border-radius: 2px;
}

.language-picker::after {
  content: '▾';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  pointer-events: none;
}

.language-picker[data-selected='en']::before {
  background-image: url('https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.5.0/flags/4x3/us.svg');
}
.language-picker[data-selected='es']::before {
  background-image: url('https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.5.0/flags/4x3/es.svg');
}
.language-picker[data-selected='ru']::before {
  background-image: url('https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.5.0/flags/4x3/ru.svg');
}
.language-picker[data-selected='pt']::before {
  background-image: url('https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.5.0/flags/4x3/pt.svg');
}

/* ── MENU DESKTOP ────────────────────────────────────────── */

.menu {
  display: flex;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0 0 0 auto;
  gap: 2px;
  position: relative;
}

.menu li {
  list-style: none;
  margin-top: 0;
}

.menu a {
  display: block;
  text-decoration: none;
  padding: 0.4em 0.85em;
  margin-right: 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.3px;
  border-radius: 6px;
  transition:
    color 0.2s,
    background 0.2s;
  white-space: nowrap;
}

.menu a:hover {
  color: #fff;
  background: rgba(59, 137, 173, 0.2);
  transition: all 0.2s;
}

/* Dropdown desktop — botón Contacto */
.menu .dropdown-desktop .btn-info {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  padding: 0.4em 0.85em;
  letter-spacing: 0.3px;
  transition: all 0.2s;
}

.menu .dropdown-desktop .btn-info:hover {
  background: rgba(59, 137, 173, 0.2);
  border-color: rgba(59, 137, 173, 0.5);
  color: #fff;
}

.navbar .dropdown-item {
  color: var(--darken_blue);
  font-size: 14px;
}

.menu .dropdown-mobile {
  display: none;
}

/* ── HAMBURGER ───────────────────────────────────────────── */

.navbar .menu-bar {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.2s;
  margin-left: auto;
  flex-shrink: 0;
  z-index: 1100;
  /* altura fija = 3 líneas de 2px + 2 gaps de 7px = 30px área visual */
  width: 44px;
  height: 44px;
  align-items: center;
}

.navbar .menu-bar:hover {
  background: rgba(255, 255, 255, 0.08);
}

.menu-bar .line-1,
.menu-bar .line-2,
.menu-bar .line-3 {
  display: block;
  height: 2px;
  background-color: #fff;
  border-radius: 2px;
  /* transition en todas las propiedades que cambian */
  transition:
    transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease,
    width 0.3s ease;
  transform-origin: center center;
}

.navbar .menu-bar .line-1 {
  width: 24px;
}
.navbar .menu-bar .line-2 {
  width: 18px;
}
.navbar .menu-bar .line-3 {
  width: 12px;
}

/* ── X abierto ───────────────────────────────────────────────
   Las líneas 1 y 3 están separadas por 12px (gap real entre ellas).
   Para cruzarse en el centro cada una se mueve 6px hacia el medio.
   ─────────────────────────────────────────────────────────── */
.navbar .menu-bar.is-open .line-1 {
  width: 24px;
  transform: translateY(9px) rotate(45deg);
}

.navbar .menu-bar.is-open .line-2 {
  opacity: 0;
  width: 0;
}

.navbar .menu-bar.is-open .line-3 {
  width: 24px;
  transform: translateY(-9px) rotate(-45deg);
}

/* ── MOBILE — drawer desde la derecha ────────────────────── */

@media screen and (max-width: 1000px) {
  .navbar {
    padding: 0 1.25rem;
    justify-content: space-between;
  }

  .navbar .menu-bar {
    display: flex;
    order: 3;
  }

  .language-picker {
    order: 2;
    margin-left: auto;
    margin-right: 0.75rem;
  }

  /* Drawer desde la derecha */
  .navbar .menu {
    position: fixed;
    top: 0;
    right: 0;
    width: min(300px, 80vw);
    height: 100dvh;
    background: rgba(0, 22, 38, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid rgba(255, 255, 255, 0.07);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 88px 1.25rem 2rem;
    gap: 2px;
    margin: 0;
    transform: translateX(110%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    overflow-y: auto;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
  }

  /* Drawer abierto */
  .navbar .menu.menu-toggle {
    transform: translateX(0);
  }

  .menu li {
    width: 100%;
    margin-top: 0;
  }

  .menu a {
    padding: 0.8em 1em;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.82);
    border-radius: 8px;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition:
      background 0.2s,
      color 0.2s,
      padding-left 0.2s;
  }

  .menu a:hover {
    background: rgba(59, 137, 173, 0.2);
    color: #fff;
    padding-left: 1.35em;
  }

  /* Ocultar dropdown desktop, mostrar dropdown mobile */
  .menu .dropdown-desktop {
    display: none;
  }

  .menu .dropdown-mobile {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .menu .dropdown-mobile .btn-info {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 15px;
    padding: 0.8em 1em;
    width: 100%;
    text-align: left;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .menu .dropdown-mobile .btn-info:hover {
    background: rgba(59, 137, 173, 0.2);
    color: #fff;
  }

  .menu .dropdown-mobile .dropdown-menu {
    position: static !important;
    transform: none !important;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    border-radius: 8px;
    padding: 4px 0;
    margin-top: 4px;
  }

  .menu .dropdown-mobile .dropdown-item {
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    padding: 0.65em 1.25em;
    border-radius: 6px;
    transition:
      background 0.2s,
      color 0.2s;
    display: block;
  }

  .menu .dropdown-mobile .dropdown-item:hover {
    background: rgba(59, 137, 173, 0.18);
    color: #fff;
  }

  /* Overlay oscuro detrás del drawer */
  body.drawer-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1040;
    animation: fadeOverlay 0.3s ease forwards;
  }

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

@media screen and (max-width: 480px) {
  .navbar {
    padding: 0 1rem;
  }

  .navbar .logo {
    width: 115px;
  }

  .language-picker {
    display: none;
  }
}
