/* ========== DROPDOWNS ========== */

.dropdown-menu {
  overflow: hidden;
  padding: 0;
}

.dropdown-item {
  padding: 0.8rem 1.2rem;
  transition: all 0.25s ease;
}

.dropdown-item:hover, .dropdown-item:active {
  background: var(--bs-primary);
  color: #fff;
}

/* ========== FLECHA: chevrons arriba/abajo ========== */

.dropdown-toggle::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: .35em;
  vertical-align: -0.15em;
  border: 0;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .7;
  transition: opacity .25s ease;
}

/* Este ícono es simétrico: girarlo no se notaría, así que al abrir
   solo se resalta */

.dropdown-toggle[aria-expanded="true"]::after, .dropdown-toggle.show::after {
  opacity: 1;
}

.dropdown-item {
  padding: .8rem 1rem;
  transition: background .2s ease, color .2s ease;
  font-weight: 500;
}

.dropdown-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.dropdown-item:active {
  background: rgba(89,200,255,.15);
  color: #fff;
}

/* ========== DROPDOWNS: ALINEACIÓN Y ANIMACIÓN ========== */

@media (min-width: 992px) {
  .navbar .dropdown-menu.menu-start, .navbar .dropdown-menu.menu-default, .navbar .dropdown-menu.menu-center, .navbar .dropdown-menu.menu-end {
    position: absolute !important;
    top: calc(100% + 0.25rem) !important;
    bottom: auto !important;
    display: block;
    width: max-content;
    margin: 0 !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    translate: 0 -8px;
    scale: 0.96;
    transition: opacity 0.22s ease, translate 0.22s ease, scale 0.22s ease, visibility 0s linear 0.22s;
  }
}

/* START */

@media (min-width: 992px) {
  .navbar .dropdown-menu.menu-start {
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    transform-origin: top left;
  }
}

/* DEFAULT */

@media (min-width: 992px) {
  .navbar .dropdown-menu.menu-default {
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    transform-origin: top left;
  }
}

/* CENTER */

@media (min-width: 992px) {
  .navbar .dropdown-menu.menu-center {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    transform-origin: top center;
  }
}

/* END */

@media (min-width: 992px) {
  .navbar .dropdown-menu.menu-end {
    left: auto !important;
    right: 0 !important;
    transform: none !important;
    transform-origin: top right;
  }
}

/* ========== ESTADO ABIERTO ========== */

@media (min-width: 992px) {
  .navbar .dropdown-menu.menu-start.show, .navbar .dropdown-menu.menu-default.show, .navbar .dropdown-menu.menu-center.show, .navbar .dropdown-menu.menu-end.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    translate: 0 0;
    scale: 1;
    transition-delay: 0s;
  }
}

/* ========== ELEMENTOS DEL DROPDOWN ========== */

.navbar .dropdown-menu .dropdown-item {
  transition: background 0.2s ease, color 0.2s ease;
}

.navbar .dropdown-menu .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.navbar .dropdown-menu .dropdown-item:active {
  background: rgba(89, 200, 255, 0.15);
  color: #fff;
}

.navbar .container, .navbar .navbar-brand, .navbar .nav-link, .navbar .navbar-toggler, .offcanvas {
  z-index: 1051;
}

.navbar .nav-link {
  padding: 0.6rem 1.4rem;
  border-radius: 16px;
  border: 1px solid transparent;
  min-width: 100px;
  text-align: center;
  background: transparent;
  transition: all 0.3s ease;
}

.navbar .nav-link:hover, .navbar .nav-link.show {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ========== DROPDOWN con animación de abrir y cerrar ========== */

.dropdown-menu {
  /* Colores de los estados: hover, focus, active y .active.
     Así ya no se ve el fondo claro de Bootstrap en ninguno. */
  --bs-dropdown-link-color: #fff;
  --bs-dropdown-link-hover-color: #fff;
  --bs-dropdown-link-hover-bg: rgba(255, 255, 255, .08);
  --bs-dropdown-link-active-color: #fff;
  --bs-dropdown-link-active-bg: rgba(255, 255, 255, .12);

  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 18px;
  overflow: hidden;
  padding: .5rem;
  margin-top: 10px;
  top: 100%;
  left: 0;
  right: auto;
  display: block;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(-30px 100% 100% -30px round 48px);
  transition: opacity .25s ease, clip-path .25s ease, visibility 0s linear .25s;
}

/* End: alineado a la derecha incluso mientras cierra */

.dropdown-menu-end {
  left: auto;
  right: 0;
  clip-path: inset(-30px -30px 100% 100% round 48px);
}

/* Abierto: la zona visible es más grande que el menú, no toca el borde */

.dropdown-menu.show {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  clip-path: inset(-30px -30px -30px -30px round 48px);
  transition: opacity .25s ease, clip-path .25s ease, visibility 0s;
}

.dropdown-item {
  color: #fff;
  border-radius: 12px;
  padding: .8rem 1rem;
  transition: background .2s ease, color .2s ease;
  font-weight: 500;
}

.dropdown-item:hover {
  background: rgba(255,255,255,.08);
  color: #59C8FF;
}

.dropdown-item:active {
  background: rgba(89,200,255,.15);
  color: #59C8FF;
}

/* Elemento marcado como .active y elemento con foco (tras hacer clic) */

.dropdown-item.active,
.dropdown-item:focus,
.dropdown-item:focus-visible {
  background: rgba(255,255,255,.12);
  color: #fff;
  outline: none;
}

/* En móvil el menú va dentro del offcanvas, en el flujo normal:
   cerrado no debe ocupar espacio */

@media (max-width: 991.98px) {
  .navbar-nav .dropdown-menu:not(.show) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dropdown-menu, .dropdown-menu.show {
    transition: none;
  }
}