/* ─────────────────────────────────────────────
   NAV DROPDOWN — nav-dropdown.css
   Visas dropdown in the main navbar
   ───────────────────────────────────────────── */

/* Fix: nav-links has overflow-x:auto which clips absolutely-positioned children.
   Override it to visible so the dropdown menu can escape. */
.nav-links {
  overflow: visible !important;
}

/* ─── WRAPPER ──────────────────────────────────── */
.nav-dropdown {
  position: relative;
}

/* ─── TRIGGER ──────────────────────────────────── */
.nav-dropdown__trigger {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
}

.nav-dropdown__chevron {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-dropdown.is-open .nav-dropdown__chevron,
.nav-dropdown__trigger[aria-expanded="true"] .nav-dropdown__chevron {
  transform: rotate(180deg);
  opacity: 0.8;
}

/* ─── MENU ─────────────────────────────────────── */
.nav-dropdown__menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  /* Fondo blanco como las cards del sitio */
  background: #1F2745;
  border: 1px solid var(--line-soft, rgba(23, 33, 43, 0.08));
  border-radius: 18px;
  box-shadow: var(--shadow-soft, 0 8px 32px rgba(15, 23, 42, 0.10)), 0 2px 8px rgba(15, 23, 42, 0.05);
  /* Padding superior = gap visual (8px) + padding real (6px) para que el
     cursor no tenga que "saltar" un hueco al pasar del trigger al menú */
  padding: 14px 6px 6px;
  z-index: 9999;

  /* Fade + slide-down */
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s;
}

/* Puente invisible: cubre el espacio entre el trigger y el menú para que
   el hover no se interrumpa al mover el cursor hacia abajo */
.nav-dropdown__menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

/* Desktop: hover opens (CSS) */
@media (hover: hover) and (min-width: 768px) {
  .nav-dropdown:hover .nav-dropdown__menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s;
  }
}

/* JS-controlled: click / keyboard open */
.nav-dropdown.is-open .nav-dropdown__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s;
}

/* ─── ITEMS ─────────────────────────────────────── */
.nav-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  /* Color de texto del sitio */
  color: var(--text, #17212b);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-dropdown__item:hover,
.nav-dropdown__item:focus-visible {
  /* Hover con el acento del sitio */
  background: rgba(47, 122, 130, 0.10);
  color: var(--accent, #2f7a82);
  outline: none;
}

.nav-dropdown__item.is-active {
  background: rgba(47, 122, 130, 0.12);
  color: var(--accent, #2f7a82);
  font-weight: 600;
}

/* ─── ITEM ICON ─────────────────────────────────── */
.nav-dropdown__item-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* Fondo del icono coherente con la paleta */
  background: rgba(47, 122, 130, 0.10);
  border-radius: 10px;
  color: var(--accent, #2f7a82);
  transition: background 0.12s ease;
}

.nav-dropdown__item-icon svg {
  width: 15px;
  height: 15px;
}

.nav-dropdown__item:hover .nav-dropdown__item-icon,
.nav-dropdown__item:focus-visible .nav-dropdown__item-icon,
.nav-dropdown__item.is-active .nav-dropdown__item-icon {
  background: rgba(47, 122, 130, 0.18);
}

/* ─── ITEM TEXT ─────────────────────────────────── */
.nav-dropdown__item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-dropdown__item-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: inherit;
}

.nav-dropdown__item-desc {
  font-size: 0.75rem;
  font-weight: 400;
  /* Muted del sitio */
  color: var(--muted, #61707d);
  line-height: 1.3;
}

.nav-dropdown__item:hover .nav-dropdown__item-desc,
.nav-dropdown__item.is-active .nav-dropdown__item-desc {
  color: rgba(47, 122, 130, 0.72);
}

/* ─── DIVIDER ───────────────────────────────────── */
.nav-dropdown__divider {
  height: 1px;
  background: var(--line-soft, rgba(23, 33, 43, 0.07));
  margin: 4px 6px;
}

/* ─── LOCK — guest mode ─────────────────────────── */

/* Trigger "Conecta": mismo patrón que .nav-link.is-locked en hero-editorial.css */
body.guest-mode #nav-conecta-btn {
  opacity: 0.82;
}
body.guest-mode #nav-conecta-btn::after {
  content: " \1F512";
  font-size: 0.78em;
}

/* Items del dropdown Conecta: lock alineado a la derecha */
body.guest-mode #conecta-dropdown-menu .nav-dropdown__item::after {
  content: "\1F512";
  font-size: 0.72em;
  margin-left: auto;
  padding-left: 6px;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ─── ACTIVE TRIGGER (when visas view is shown) ──── */
.nav-dropdown__trigger.active {
  color: var(--accent, #2f7a82);
  background: rgba(47, 122, 130, 0.10);
}

/* ─── MOBILE ─────────────────────────────────────── */
@media (max-width: 767px) {
  .nav-dropdown {
    width: 100%;
  }

  /* Mobile nav panel is a vertical column — expand inline */
  .nav-dropdown__menu {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: none;
    box-shadow: none;
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.22s ease !important;
  }

  /* En mobile no necesitamos el pseudo-elemento puente */
  .nav-dropdown__menu::before {
    display: none;
  }

  .nav-dropdown.is-open .nav-dropdown__menu {
    pointer-events: auto;
    max-height: 260px;
  }

  .nav-dropdown__item {
    padding: 8px 14px 8px 20px;
    font-size: 0.86rem;
    border-radius: 8px;
  }

  .nav-dropdown__divider {
    display: none;
  }
}
