/* ═══════════════════════════════════════════════════════════════════════════
   nav.css — styles for nav.html
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Header shell ───────────────────────────────────────────────────────── */
.main-header {
  background: #000000;
  border-bottom: 3px solid var(--sand, #7A9BB5);
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
  min-height: 82px;
}

/* ── Logo ───────────────────────────────────────────────────────────────── */
.nav-logo-link {
  display: inline-flex;
  align-items: center;
  padding: 0 10px 0 0;
  border-right: 1px solid rgba(255,255,255,0.1);
  margin-right: 6px;
  margin-left: 32px;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo-link img {
  height: 64px;
  width: auto;
  display: block;
}

/* ── Desktop nav ────────────────────────────────────────────────────────── */
.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;

  /* FIX: allow dropdowns + prevent scroll UI */
  overflow: visible;

  min-width: 0;
}

.nav-link,
.nav-link-locked,
.nav-link-cta,
.nav-more-btn {
  background: none;
  border: none;
  color: var(--sand, #7A9BB5);
  font-family: 'Oxanium', Arial, sans-serif;
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 18px 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: color 0.18s, opacity 0.18s, background 0.18s, border-color 0.18s;
}

.nav-link:hover,
.nav-more-btn:hover {
  color: #ffffff;
}

.nav-link.active {
  color: #ffffff;
  font-weight: 700;
}

.nav-link-cta {
  background: none;
  color: var(--sand, #7A9BB5);
  border-radius: 0;
  margin-left: 0;
  padding: 18px 10px;
  border: none;
  height: auto;
  font-weight: normal;
  box-shadow: none;
}
.nav-link-cta:hover {
  color: #ffffff;
  background: none;
}
.nav-link-cta.active {
  background: linear-gradient(180deg, #f0dd99, #d6b04d);
  color: #08111d;
  border-radius: 15px;
  margin-left: 8px;
  padding: 5px 12px;
  border: 1px solid rgba(214,176,77,0.55);
  height: 30px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(214,176,77,0.25);
}

.nav-link-locked {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}
.nav-link-locked.compare-tease {
  opacity: 0.72;
  border: 1px solid rgba(232,184,75,0.25);
  border-radius: 15px;
  padding: 5px 12px;
  margin-left: 8px;
  height: 30px;
  color: #C8DFF0;
}
.nav-link-locked.compare-tease .lock {
  margin-left: 6px;
  font-size: 0.78rem;
}

/* ── Dropdowns ──────────────────────────────────────────────────────────── */
.nav-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: #1E2F42;
  border: 1px solid rgba(232,184,75,0.3);
  border-top: 4px solid var(--sand, #7A9BB5);
  border-radius: 3px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(212,175,55,0.3);
  padding: 6px 0;
}
.nav-dropdown-menu.open {
  display: block;
}

.nav-dropdown-label {
  padding: 8px 16px 4px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

.nav-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #C8DFF0;
  padding: 9px 16px;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: 'Oxanium', Arial, sans-serif;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.nav-dropdown-item:hover {
  background: rgba(232,184,75,0.15);
  color: var(--gold, #E8B84B);
}
.nav-dropdown-item.locked {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* ── Right side ─────────────────────────────────────────────────────────── */
.nav-right {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  padding-right: 20px;
  gap: 10px;
}

#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 8px 10px;
  color: var(--sand, #7A9BB5);
  transition: color 0.18s, transform 0.2s;
  line-height: 1;
}
#theme-toggle:hover {
  color: var(--gold, #E8B84B);
  transform: scale(1.15);
}

.user-btn {
  background: transparent;
  color: #C8DFF0;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 7px 14px;
  font-size: 0.88rem;
  font-family: 'Oxanium', Arial, sans-serif;
  letter-spacing: 0.04em;
  border-radius: 2px;
  cursor: pointer;
}

.user-nav-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #1E2F42;
  border: 1px solid rgba(232,184,75,0.3);
  border-top: 4px solid var(--sand, #7A9BB5);
  border-radius: 3px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(212,175,55,0.3);
  min-width: 230px;
}
.user-nav-menu.open {
  display: block;
}
.user-menu-divider {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 4px 0;
}
.user-menu-label {
  padding: 8px 16px 4px;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #C8DFF0;
  font-weight: 700;
}
.user-menu-signedin {
  padding: 8px 16px 6px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}
.data-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #C8DFF0;
  padding: 9px 24px;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: 'Oxanium', Arial, sans-serif;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.data-menu-item:hover {
  background: rgba(232,184,75,0.08);
  color: #ffffff;
  font-weight: 700;
}
.user-menu-link {
  display: block;
  padding: 9px 16px;
  font-size: 0.88rem;
  color: #C8DFF0;
  text-decoration: none;
}
.user-menu-link:hover {
  background: rgba(232,184,75,0.08);
}
.user-menu-link.logout {
  color: #E05C5C;
  text-align: right;
}
.user-menu-link.logout:hover {
  background: rgba(224,92,92,0.08);
}

.badge-role {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 2px;
  letter-spacing: 0.08em;
}
.badge-admin { background: rgba(232,184,75,0.2); color: #C8DFF0; }
.badge-mod { background: rgba(130,200,130,0.2); color: #7dcf7d; }
.badge-premium { background: rgba(147,112,219,0.2); color: #b39ddb; }

/* ── Guest buttons ──────────────────────────────────────────────────────── */
.login-link {
  background: transparent;
  color: var(--text-primary, #C8DFF0);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 7px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: 'Oxanium', Arial, sans-serif;
  letter-spacing: 0.08em;
  border-radius: 2px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.login-link:hover {
  color: #ffffff;
  border-color: rgba(255,255,255,0.35);
}

.free-trial-link {
  background: var(--gold, #E8B84B);
  color: #0D1B2A;
  border: none;
  padding: 8px 16px;
  font-size: 0.86rem;
  font-weight: 700;
  font-family: 'Oxanium', Arial, sans-serif;
  letter-spacing: 0.08em;
  border-radius: 2px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.free-trial-link:hover {
  opacity: 0.9;
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
#nav-hamburger {
  display: none;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #C8DFF0;
  font-size: 1.4rem;
  line-height: 1;
  padding: 6px 11px;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
}

#mobile-nav-drawer {
  display: none;
  flex-direction: column;
  background: #131B27;
  border-top: 2px solid rgba(232,184,75,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  width: 100%;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
#mobile-nav-drawer.open {
  display: flex;
}
.mobile-nav-link {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #C8DFF0;
  font-family: 'Oxanium', Arial, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 20px;
  cursor: pointer;
  text-decoration: none;
  display: block;
}
.mobile-nav-link.locked {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}
.mobile-nav-link.cta {
  background: var(--gold, #E8B84B);
  color: #0D1B2A;
  font-weight: 700;
}
.mobile-nav-link:active {
  background: rgba(232,184,75,0.08);
}

@media (max-width: 900px) {
  .nav-logo-link {
    margin-left: 12px;
  }
  .nav-logo-link img {
    height: 50px;
  }
  .main-nav {
    display: none;
  }
  #nav-hamburger {
    display: block;
  }
  .nav-right {
    padding-right: 8px;
    gap: 6px;
  }
  .user-btn {
    font-size: 0.78rem;
    padding: 6px 10px;
  }
  .user-nav-menu {
    min-width: 200px;
  }
}

/* ── Light theme ─────────────────────────────────────────────────────────── */
body[data-theme="light"] .main-header {
  background: #FFFFFF;
  border-bottom-color: #1A3A5C;
  box-shadow: 0 4px 16px rgba(26,58,92,0.12);
}
body[data-theme="light"] .nav-logo-link {
  border-right-color: rgba(13,27,42,0.1);
}
body[data-theme="light"] .nav-link,
body[data-theme="light"] .nav-more-btn {
  color: #3A5570;
}
body[data-theme="light"] .nav-link:hover,
body[data-theme="light"] .nav-more-btn:hover,
body[data-theme="light"] .nav-link.active {
  color: #1A3A5C;
}
body[data-theme="light"] .nav-link-cta {
  color: #3A5570;
  background: none;
}
body[data-theme="light"] .nav-link-cta.active {
  background: linear-gradient(180deg, #f0dd99, #d6b04d);
  color: #08111d;
  border-color: rgba(214,176,77,0.55);
}
body[data-theme="light"] .nav-link-locked.compare-tease {
  color: #1A3A5C;
  border-color: rgba(26,58,92,0.2);
}
body[data-theme="light"] #theme-toggle {
  color: #3A5570;
}
body[data-theme="light"] #theme-toggle:hover {
  color: #1A3A5C;
}
body[data-theme="light"] .login-link {
  color: #0D1B2A;
  border-color: #A8B8C8;
}
body[data-theme="light"] .login-link:hover {
  color: #1A3A5C;
  border-color: #1A3A5C;
}
body[data-theme="light"] .free-trial-link {
  background: #1A3A5C;
  color: #ffffff;
}
body[data-theme="light"] .user-btn {
  color: #0D1B2A;
  border-color: #A8B8C8;
}
body[data-theme="light"] .user-nav-menu,
body[data-theme="light"] .nav-dropdown-menu {
  background: #FFFFFF;
  border-color: rgba(26,58,92,0.2);
  border-top-color: #1A3A5C;
  box-shadow: 0 8px 32px rgba(26,58,92,0.15);
}
body[data-theme="light"] .data-menu-item,
body[data-theme="light"] .nav-dropdown-item,
body[data-theme="light"] .user-menu-link {
  color: #0D1B2A;
}
body[data-theme="light"] .data-menu-item:hover,
body[data-theme="light"] .nav-dropdown-item:hover,
body[data-theme="light"] .user-menu-link:hover {
  background: rgba(26,58,92,0.08);
  color: #1A3A5C;
}
body[data-theme="light"] .user-menu-label {
  color: #1A3A5C;
}
body[data-theme="light"] .user-menu-signedin,
body[data-theme="light"] .nav-dropdown-label {
  color: rgba(13,27,42,0.45);
}
body[data-theme="light"] .user-menu-divider {
  border-top-color: rgba(13,27,42,0.08);
}
body[data-theme="light"] #mobile-nav-drawer {
  background: #FFFFFF;
  border-top-color: rgba(26,58,92,0.25);
  border-bottom-color: rgba(13,27,42,0.08);
}
body[data-theme="light"] .mobile-nav-link {
  color: #0D1B2A;
  border-bottom-color: rgba(13,27,42,0.06);
}
body[data-theme="light"] .mobile-nav-link.cta {
  background: #1A3A5C;
  color: #ffffff;
}


/* ── Mobile header safety patch ───────────────────────────────────────────
   Keeps the phone header inside the screen and moves all extra links into
   the hamburger drawer.
*/
@media (max-width: 900px) {
  html {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    max-width: 100%;
    overflow-x: clip;
  }

  .main-header {
    width: 100%;
    max-width: 100vw;
    min-height: 62px;
    padding: 0 8px 0 0 !important;
    justify-content: space-between;
    overflow: visible;
  }

  .nav-logo-link {
    margin-left: 8px !important;
    margin-right: 4px;
    padding-right: 6px;
  }

  .nav-logo-link img {
    height: 46px !important;
    max-width: 64px;
    object-fit: contain;
  }

  .main-nav {
    display: none !important;
  }

  .nav-right {
    flex: 0 1 auto;
    margin-left: auto;
    padding-right: 0 !important;
    gap: 5px !important;
    min-width: 0;
    max-width: calc(100vw - 88px);
  }

  #nav-hamburger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-width: 38px;
    height: 34px;
    padding: 0 !important;
    font-size: 1.25rem;
  }

  #theme-toggle {
    display: none !important;
  }

  .login-link,
  .free-trial-link {
    display: none !important;
  }


  #user-nav-wrap {
    min-width: 0;
    max-width: calc(100vw - 170px);
  }

  .user-btn {
    max-width: calc(100vw - 170px);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.72rem !important;
    padding: 5px 7px !important;
  }

  .badge-role {
    display: none;
  }

  .user-nav-menu {
    right: 0;
    max-width: calc(100vw - 16px);
  }

  #mobile-nav-drawer {
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    max-height: calc(100vh - 62px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .mobile-nav-link {
    box-sizing: border-box;
    width: 100%;
  }
}

@media (max-width: 380px) {
  .nav-logo-link img {
    height: 42px !important;
    max-width: 56px;
  }

  .nav-right {
    max-width: calc(100vw - 76px);
  }

  #user-nav-wrap,
  .user-btn {
    max-width: calc(100vw - 155px);
  }
}


/* ── Mobile header approved layout: icon | TrackPredict | hamburger | user menu ── */
.mobile-nav-wordmark {
  display: none;
}

@media (max-width: 900px) {
  .main-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    min-height: 62px;
    width: 100%;
    max-width: 100vw;
    overflow: visible;
  }

  .nav-logo-link {
    flex: 0 0 auto;
    margin-left: 8px !important;
    margin-right: 6px;
    padding-right: 6px;
    position: relative;
    z-index: 3;
  }

  .mobile-nav-wordmark {
    display: inline-flex !important;
    position: static !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    align-items: center;
    color: #C8DFF0;
    font-family: 'Oxanium', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 6px;
    z-index: 1;
  }

  .mobile-nav-wordmark span {
    color: var(--gold, #E8B84B);
  }

  .nav-right {
    flex: 0 0 auto !important;
    margin-left: auto !important;
    padding-right: 0 !important;
    max-width: none !important;
    display: inline-flex;
    align-items: center;
    gap: 5px !important;
    position: relative;
    z-index: 3;
  }

  #nav-hamburger {
    order: 1;
    flex: 0 0 38px;
  }

  #user-nav-wrap {
    order: 2;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 148px;
  }

  .user-btn {
    max-width: 148px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 430px) {
  .mobile-nav-wordmark {
    font-size: 0.88rem;
    letter-spacing: 0.01em;
    padding-right: 4px;
  }

  #user-nav-wrap,
  .user-btn {
    max-width: 128px;
  }
}

@media (max-width: 360px) {
  .mobile-nav-wordmark {
    font-size: 0.78rem;
  }

  #user-nav-wrap,
  .user-btn {
    max-width: 112px;
  }
}

body[data-theme="light"] .mobile-nav-wordmark {
  color: #1A3A5C;
}

body[data-theme="light"] .mobile-nav-wordmark span {
  color: #0D1B2A;
}

/* ── Mobile theme button restored: icon | TrackPredict | theme | hamburger | user menu ── */
@media (max-width: 900px) {
  #theme-toggle {
    display: inline-flex !important;
    order: 0;
    flex: 0 0 34px;
    width: 34px;
    min-width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    font-size: 1.05rem;
    line-height: 1;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 3px;
    background: transparent;
  }

  #nav-hamburger {
    order: 1;
  }

  #user-nav-wrap {
    order: 2;
  }
}

@media (max-width: 430px) {
  #theme-toggle {
    flex-basis: 32px;
    width: 32px;
    min-width: 32px;
    height: 32px;
    font-size: 1rem;
  }
}
