/* ==========================================================================
   R-Developers public navbar (Bootstrap 5)
   Single source of truth for the site-wide navbar — loaded from base.html.
   Do NOT re-declare .navbar-custom rules inside page templates.

   Layout contract:
     - The bar is `fixed-top` and must be flush with the viewport edges.
       Never wrap it in margin/padding helpers (m-*, p-*): that shrinks a
       fixed bar and makes long links (e.g. "AI Optimization") wrap.
     - Its height is --rd-nav-h, and body gets exactly that much padding-top
       so page content never slides under the bar.
   ========================================================================== */

:root { --rd-nav-h: 68px; }

.navbar-custom {
  background-color: #000 !important;
  min-height: var(--rd-nav-h);
  padding: 0.5rem 0;
  z-index: 1030;
}

.navbar-custom .container {
  display: flex;
  align-items: center;
  /* Wrap is required: at mobile widths the collapsed menu must drop onto its
     own full-width row instead of squeezing in beside the logo. */
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ---- brand ------------------------------------------------------------- */
.navbar-custom .navbar-brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}
.navbar-custom .navbar-brand img {
  height: 40px;
  width: auto;
  max-width: 210px;
  display: block;
}

/* ---- toggler ----------------------------------------------------------- */
.navbar-custom .navbar-toggler {
  border: 0;
  padding: 0.25rem 0.4rem;
  margin-left: auto;
  box-shadow: none !important;
}
.navbar-custom .navbar-toggler-icon {
  width: 26px;
  height: 26px;
  background-size: 26px 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(255,255,255,1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* ---- links ------------------------------------------------------------- */
.navbar-custom .navbar-nav {
  align-items: center;
  gap: 0.15rem;
}
.navbar-custom .nav-item { white-space: nowrap; }
.navbar-custom .nav-link {
  color: #fff !important;
  font-size: 15px;
  line-height: 1.25;
  padding: 0.5rem 0.7rem !important;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.navbar-custom .nav-link:hover,
.navbar-custom .nav-link:focus,
.navbar-custom .navbar-nav .nav-link.active { color: #93c5fd !important; }

.navbar-custom .dropdown-menu {
  margin-top: 0.45rem;
  min-width: 12rem;
}

/* ---- CTA pills --------------------------------------------------------- */
.navbar-custom .getstarted,
.navbar-custom .logout-btn {
  padding: 8px 20px !important;
  margin-left: 0.6rem;
  border-radius: 50px;
  border: 2px solid #47b2e4;
  background-color: #007bff;
  font-size: 14px;
  font-weight: 600;
  color: #fff !important;
}
.navbar-custom .getstarted:hover { background-color: #0056b3; border-color: #0056b3; }
.navbar-custom .logout-btn { background-color: #e02020; border-color: #e02020; }
.navbar-custom .logout-btn:hover { background-color: #b01818; border-color: #b01818; }

/* ---- content offset for the fixed bar ---------------------------------- */
body { padding-top: var(--rd-nav-h); }

/* ---- tablet / mobile --------------------------------------------------- */
@media (max-width: 991.98px) {
  :root { --rd-nav-h: 60px; }

  .navbar-custom .navbar-brand img { height: 34px; max-width: 55vw; }

  .navbar-custom .navbar-collapse {
    background-color: #000;
    flex-basis: 100%;
    margin-top: 0.5rem;
    padding: 0.35rem 0.75rem 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    max-height: calc(100vh - var(--rd-nav-h));
    overflow-y: auto;
  }
  .navbar-custom .navbar-nav { align-items: stretch; gap: 0; width: 100%; }
  .navbar-custom .nav-link { padding: 0.65rem 0.25rem !important; width: 100%; }
  /* CTA pills hug their label instead of stretching the full row */
  .navbar-custom .getstarted,
  .navbar-custom .logout-btn { width: auto; margin: 0.6rem 0 0; display: inline-block; }
  .navbar-custom .dropdown-menu {
    background: transparent;
    border: 0;
    padding-left: 0.9rem;
    margin-top: 0;
  }
}

@media (max-width: 575.98px) {
  :root { --rd-nav-h: 58px; }
  .navbar-custom .navbar-brand img { height: 30px; max-width: 52vw; }
  .navbar-custom .nav-link { font-size: 14.5px; }
}
