/* ===== NAVBAR BASE ===== */

.custom-navbar {

  /* Sin position, el z-index se ignoraba por completo. */
  position: sticky;
  top: 0;

  z-index: 1030;

  background-color: #ffffff;

  border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* ===== BRAND + LINKS ===== */

.custom-navbar .navbar-brand,
.custom-navbar .nav-link {

  color: #000;

  font-weight: 500;

  position: relative;

  padding: 8px 12px;

  font-size: 0.95rem;

  transition:
    color 0.2s ease,
    opacity 0.2s ease;
}

.custom-navbar .navbar-brand {

  font-size: 1.15rem;

  font-weight: 700;

  letter-spacing: -0.02em;
}

/* ===== REMOVE BOOTSTRAP EFFECTS ===== */

.custom-navbar .nav-link:focus,
.custom-navbar .navbar-toggler:focus {

  box-shadow: none;
}

/* ===== HOVER ===== */

.custom-navbar .nav-link:hover,
.custom-navbar .navbar-brand:hover {

  color: #000;

  opacity: 0.75;
}

/* ===== ACTIVE ===== */

.custom-navbar .nav-link:focus,
.custom-navbar .nav-link:active,
.custom-navbar .nav-item.dropdown.show > .nav-link {

  color: #000 !important;
}

/* ===== DESKTOP UNDERLINES ===== */

/* 768px = breakpoint de navbar-expand-md. Antes estaba en 992px y dejaba
   una franja de 768-991px sin subrayados ni estilos móviles. */
@media (min-width: 768px) {

  .custom-navbar .nav-link:not(.dropdown-toggle)::after {

    content: "";

    position: absolute;

    left: 0;
    bottom: 0;

    width: 0;

    height: 2px;

    background-color: #b8963e;

    transition: width 0.3s ease;
  }

  .custom-navbar .nav-link:not(.dropdown-toggle):hover::after {

    width: 100%;
  }

  /* dropdown underline */

  .custom-navbar .nav-link.dropdown-toggle::before {

    content: "";

    position: absolute;

    left: 0;
    bottom: 0;

    width: 0;

    height: 2px;

    background-color: #b8963e;

    transition: width 0.3s ease;
  }

  .custom-navbar .nav-item.dropdown:hover .dropdown-toggle::before,
  .custom-navbar .nav-item.dropdown.show .dropdown-toggle::before {

    width: 100%;
  }
}

/* ===== DROPDOWN ===== */

.custom-navbar .dropdown-menu {

  background-color: rgba(255,255,255,0.96);

  border: 1px solid rgba(0,0,0,0.06);

  border-radius: 14px;

  padding: 0.6rem;

  box-shadow:
    0 10px 30px rgba(0,0,0,0.08);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.custom-navbar .dropdown-item {

  color: #000;

  border-radius: 10px;

  padding: 0.7rem 1rem;

  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.custom-navbar .dropdown-item:hover {

  background-color: rgba(184,150,62,0.10);

  color: #000;

  transform: translateX(2px);
}

/* ===== HAMBURGER ===== */

.custom-navbar .navbar-toggler {

  border: none;

  padding: 0.4rem;

  transition: transform 0.2s ease;
}

.custom-navbar .navbar-toggler:hover {

  transform: scale(1.05);
}

.custom-navbar .navbar-toggler-icon {

  width: 1.7rem;
  height: 1.7rem;

  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(184,150,62,1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.6' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ===== MOBILE NAVBAR ===== */

@media (max-width: 767px) {

  .custom-navbar .navbar-collapse {

    margin-top: 1rem;

    padding: 1rem;

    border-radius: 16px;

    background: rgba(255,255,255,0.96);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border: 1px solid rgba(0,0,0,0.06);

    box-shadow:
      0 10px 30px rgba(0,0,0,0.08);
  }

  .custom-navbar .navbar-nav {

    gap: 0.25rem;
  }

  .custom-navbar .nav-link {

    padding: 0.9rem 1rem;

    border-radius: 10px;
  }

  .custom-navbar .nav-link:hover {

    background-color: rgba(184,150,62,0.08);
  }

  .custom-navbar .dropdown-menu {

    margin-top: 0.5rem;

    border: none;

    background: rgba(245,245,245,0.75);

    box-shadow: none;
  }

  .custom-navbar .d-flex {

    margin-top: 1rem;

    padding-top: 1rem;

    border-top: 1px solid rgba(0,0,0,0.06);

    flex-direction: column;

    gap: 0.3rem !important;
  }
}
/* ===== ENLACE ACTIVO ===== */

.custom-navbar .nav-link.activo {

  color: #000;

  font-weight: 700;
}

@media (min-width: 768px) {

  .custom-navbar .nav-link.activo:not(.dropdown-toggle)::after,
  .custom-navbar .nav-link.activo.dropdown-toggle::before {

    width: 100%;
  }
}

/* ===== SESIÓN INICIADA ===== */

.navbar-usuario {

  display: flex;

  align-items: center;

  gap: 0.6rem;

  font-size: 0.9rem;

  color: #000;
}

.navbar-usuario-nombre {

  font-weight: 700;
}

.navbar-usuario-rol {

  padding: 0.15rem 0.5rem;

  border-radius: 999px;

  background: rgba(184,150,62,0.15);

  color: #7a5f1f;

  font-size: 0.7rem;

  font-weight: 700;

  letter-spacing: 0.06em;

  text-transform: uppercase;
}

.btn-salir {

  border: 1px solid rgba(0,0,0,0.15);

  border-radius: 8px;

  padding: 0.35rem 0.85rem;

  background: transparent;

  font-size: 0.85rem;

  font-weight: 600;

  color: #000;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.btn-salir:hover {

  background-color: rgba(184,150,62,0.10);

  border-color: rgba(184,150,62,0.5);
}

/* Evita el salto de layout mientras la navbar se carga por fetch. */
#navbar:empty {

  min-height: 62px;

  border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* Contador de solicitudes en espera, junto a "Aprobaciones". */
.badge-pendientes {
  display: inline-block;
  min-width: 1.35em;
  margin-left: 0.35rem;
  padding: 0.1em 0.45em;
  border-radius: 999px;
  background: var(--dorado);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  vertical-align: middle;
}
