/* ─────────────────────────────────────────────────────
   TOP NAV (Xylo Horizons)
   ───────────────────────────────────────────────────── */

:root{
  --nav-h: 64px;
  --nav-pad: 14px;

  --nav-bg: rgba(10, 12, 16, 0.72);
  --nav-br: rgba(255,255,255,0.10);
  --nav-tx: rgba(255,255,255,0.86);
  --nav-mu: rgba(255,255,255,0.60);

  --nav-ac: rgba(120, 190, 255, 0.95);
  --nav-ac2: rgba(170, 120, 255, 0.85);

  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

*{ box-sizing: border-box; }

.nav-container{
  position: sticky;
  top: 0;
  z-index: 999;
  height: var(--nav-h);
  padding: 0 var(--nav-pad);
  /* Use grid so the center links stay perfectly centered
     even when the right side (Login/Profile) changes width */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 14px;

  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-br);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Slightly stronger nav when the page is scrolled */
.nav-container.is-scrolled{
  background: rgba(10, 12, 16, 0.86);
  box-shadow: 0 12px 30px rgba(0,0,0,.30);
}

.nav-left, .nav-right{
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-left{ justify-self: start; }
.nav-list{ justify-self: center; }
.nav-right{ justify-self: end; justify-content: flex-end; }

/* Prevent page scroll when the mobile menu is open */
body.nav-locked{ overflow: hidden; }

/* Brand */
.nav-brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--nav-tx);
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
  user-select: none;
}

.brand-dot{
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, var(--nav-ac), var(--nav-ac2));
  box-shadow: 0 0 18px rgba(120,190,255,.35);
}

.brand-text{
  opacity: .92;
}

/* Center list */
.nav-list{
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.nav-item{
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--nav-mu);
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .6px;
  text-transform: uppercase;
  position: relative;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.nav-item:hover{
  color: var(--nav-tx);
  background: rgba(255,255,255,0.06);
}

.nav-item.is-active,
.nav-item.active{
  color: var(--nav-tx);
  background:
    linear-gradient(90deg, rgba(120,190,255,.18), rgba(170,120,255,.14));
  border: 1px solid rgba(255,255,255,0.10);
}

/* Active underline for a bit more polish */
.nav-item::after{
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(120,190,255,.95), rgba(170,120,255,.85));
  opacity: 0;
  transform: scaleX(.65);
  transform-origin: center;
  transition: opacity .14s ease, transform .14s ease;
}

.nav-item.is-active::after,
.nav-item.active::after{
  opacity: .9;
  transform: scaleX(1);
}

/* Buttons right */
.nav-btn{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--nav-tx);
  cursor: pointer;
  text-decoration: none;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.nav-btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
}

.nav-btn:active{
  transform: translateY(0px);
}

.nav-btn-primary{
  background: linear-gradient(90deg, rgba(120,190,255,.18), rgba(170,120,255,.14));
  border-color: rgba(255,255,255,0.18);
}

.nav-btn-ico{
  opacity: .92;
}
.nav-btn-txt{
  opacity: .92;
}

/* Profile */
.nav-profile{
  position: relative;
}

.nav-profile-btn{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--nav-tx);
  cursor: pointer;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.nav-profile-btn:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-1px);
}

.nav-avatar{
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  object-fit: cover;
}

.nav-usertext{
  display: grid;
  line-height: 1.05;
  text-align: left;
  margin-right: 2px;
}

.nav-username{
  font-size: 12px;
  font-weight: 700;
  opacity: .95;
}

.nav-role{
  font-size: 11px;
  opacity: .65;
}

.chev{
  opacity: .70;
  font-size: 12px;
  margin-left: 2px;
}

/* Dropdown */
.profile-dropdown{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  padding: 8px;
  margin: 0;
  list-style: none;

  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(10, 12, 16, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  transform-origin: top right;
  transform: scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}

.profile-dropdown.is-open{
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Backwards-compat: script.js toggles .active on #nav-profile */
.nav-profile.active .profile-dropdown{
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.profile-dropdown a,
.profile-dropdown button{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  color: rgba(255,255,255,0.86);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 600;
  font-size: 13px;
  text-align: left;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover{
  background: rgba(255,255,255,0.08);
}

.menu-sep{
  height: 1px;
  margin: 6px 6px;
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
}

.menu-danger{
  color: rgba(255,160,160,0.95);
}

/* Burger (mobile) */
.nav-burger{
  display: none;
  width: 42px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  padding: 10px 11px;
}

.nav-burger span{
  display: block;
  height: 2px;
  background: rgba(255,255,255,0.82);
  border-radius: 999px;
  margin: 4px 0;
  transition: transform .18s ease, opacity .18s ease;
}

.nav-dim{
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}

/* Responsive */
@media (max-width: 920px){
  .nav-burger{ display: inline-block; }

  .nav-list{
    position: fixed;
    top: var(--nav-h);
    left: 12px;
    right: 12px;
    z-index: 999;

    flex-direction: column;
    align-items: stretch;
    gap: 6px;

    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(10, 12, 16, 0.92);
    box-shadow: var(--shadow);

    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s ease, transform .14s ease;
  }

  .nav-list.is-open{
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-item{
    justify-content: center;
    height: 44px;
    border-radius: 14px;
  }

  .nav-btn-txt{
    display: none;
  }
}

@media (prefers-reduced-motion: reduce){
  .nav-item,
  .nav-btn,
  .nav-profile-btn,
  .profile-dropdown,
  .nav-list,
  .nav-burger span{
    transition: none !important;
  }
}

/* Utility: hide things until JS decides */
.user-only, .admin-only{
  display: none;
}
