/* ============================================================
   NAV - GENERAL STYLES
   ============================================================ */

/* Profile avatar next to Live tab */
.profile-link {
  display: flex;
  align-items: center;
  margin-right: 10px;
  text-decoration: none;
}

.profile-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  background: #ffffff;
  flex-shrink: 0;
  border: 2px solid #ffffff;   /* default = offline gray */
}

/* OFFLINE = gray border */
.profile-circle.offline { border-color: #ffffff; }

/* ONLINE = your electric blue */
.profile-circle.online { border-color: #04aaff; }

.profile-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Viewer avatar: a bit smaller + blue border */
.viewer-profile {
  width: 32px;
  height: 32px;
  border: 2px solid #ffffff;
}

/* HOME BUTTON: always locked to left */
#mainSiteLink {
  order: -1 !important;
  margin-right: 8px;
  flex-shrink: 0;
}

/* Make the bar a positioning anchor */
.top-bar {
  position: relative;
  z-index: 5000; /* Ensure nav stays on top */
}

.top-bar-inner {
  padding-right: 62px; /* Space for the Desktop Resources Dot */
}

/* The Right Side Container */
.top-right {
  display: flex;
  align-items: center;
}

/* ============================================================
   NAV EXTRAS & HAMBURGER (The New Logic)
   ============================================================ */

/* 1. Mobile Menu Button - Hidden on Desktop */
.mobile-menu-btn {
  display: none; 
}

/* 2. Nav Extras - Default Desktop View (Row) */
.nav-extras {
  display: flex;
  align-items: center;
}

/* 3. Resources Dot - Desktop Position */
.nav-more {
  position: absolute;
  right: 25px; /* Moved left as requested so it's not on the edge */
  top: 50%;
  transform: translateY(-50%);
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
  padding: 3px 4px;
  border-radius: 8px;
  color: #bbb;
  background-color: #1e1e1e;

}

.nav-more-label {
  display: none;
}

/* ============================================================
   LOGIN AREA STYLES
   ============================================================ */
.top-login-area,
.nav-login-area {
  display: flex;
  align-items: center;
  margin-left: 18px;
  margin-right: 17px;

}

/* Logged-out button */
.nav-login-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Logged-in pill */
.nav-login-pill {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  margin-left: 8px;
}

.nav-login-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* Logout Dropdown */
.nav-login-menu {
  position: absolute;
  top: 110%;
  right: 0;
  background: #111;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 0;
  min-width: 140px;
  z-index: 1000;
}

.nav-login-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.nav-login-menu button:hover { background: rgba(255, 255, 255, 0.08); }


/* ============================================================
   NAV DROPDOWNS (Notes / Media / Nostr) - DESKTOP
   ============================================================ */
.nav-dd {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: -10px;
}

.nav-dd-trigger::after {
  content: "▾";
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.nav-dd-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 190px;
  display: none; /* Hidden by default */
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 12px;
  z-index: 9999;
  background: rgba(20,20,20,0.95);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
}

/* Desktop Hover: Show menu */
.nav-dd:hover .nav-dd-menu,
.nav-dd:focus-within .nav-dd-menu,
.nav-dd.open .nav-dd-menu {
  display: flex;
}

.nav-sub {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-sub:hover { background: rgba(255,255,255,0.08); }

/* ✅ Active sub-tab highlight (desktop) */
.nav-sub.active {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
}


/* ============================================================
   MOBILE STYLES (Max Width 720px)
   ============================================================ */
@media screen and (max-width: 720px) {

  /* 1. RESET SCROLLING & PADDING */
  .top-bar-inner {
    padding-right: 10px !important;
    overflow: visible !important; /* Allow popup to overflow if needed */
  }

  /* 2. SHOW HAMBURGER BUTTON */
  .mobile-menu-btn {
    display: block;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 20px;
    border-radius: 4px;
    padding: 2px 10px;
    cursor: pointer;
    margin-left: 10px;
  }

  /* 3. MOBILE POPUP MENU (.nav-extras) */
  .nav-extras {
    display: none; /* Hidden until .active */
    
    position: fixed;
    top: 60px;       /* Below the header */
    right: 10px;
    width: 220px;    /* Width of the menu */
    max-width: calc(100vw - 20px);

    /* The menu, not the page behind it, owns vertical scrolling. */
    max-height: calc(100vh - 70px);   /* Fallback */
    max-height: calc(100dvh - 70px);  /* Mobile browser-safe viewport */
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    
    background: #111;
    border: 1px solid #333;
    padding: 15px 15px calc(28px + env(safe-area-inset-bottom, 0px));
    scroll-padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    border-radius: 10px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.9);
    z-index: 99999;
  }

  /* Show when active */
  .nav-extras.active {
    display: flex;
  }

  /* Freeze the document while the mobile navigation is open.
     The menu itself remains scrollable because it has overflow-y:auto. */
  html:has(.nav-extras.active),
  body:has(.nav-extras.active) {
    overflow: hidden;
  }

/* 4. ITEMS INSIDE MOBILE MENU */
  .nav-extras .top-link {
    width: 100%;
    text-align: left;
    margin: 0;
    display: block;
  }

  /* FIX: Stack the dropdown vertically (Column) so items go UNDER the button */
  .nav-extras .nav-dd {
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column; /* This forces the menu to appear BELOW the button */
    align-items: stretch;   /* This ensures it uses the full width */
    padding-bottom: 0;      /* Remove the hover-bridge padding used on desktop */
  }

  /* Ensure the trigger button inside takes full width */
  .nav-extras .nav-dd .top-link {
    width: 100%;
    box-sizing: border-box;
  }

  /* Fix Login Area inside menu */
  .nav-extras .top-login-area,
  .nav-extras .nav-login-area {
    position: relative;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
  }

  /*
   * On desktop the connect/logout chooser is anchored to the right edge of
   * the tiny round login pill. Inside the narrow mobile panel that makes the
   * chooser grow off the left side and get clipped by the panel's scrolling
   * area. Anchor it to the full login row instead and open it inward.
   */
  .nav-extras .nav-login-pill {
    position: static;
    margin-left: 0;
  }

  .nav-extras .nav-login-menu {
    top: calc(100% + 6px);
    left: 0;
    right: auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    z-index: 100000;
  }

  .nav-extras .nav-login-menu button {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Fix Resources Dot inside menu */
  .nav-more {
    position: static;
    transform: none;
    margin-top: 10px;
    font-size: 14px;
    display: block;
    text-align: left;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 8px;
    color: #fff;
    background: #000;
  }

  .nav-more-dot {
    display: none;
  }

  .nav-more-label {
    display: inline;
  }



  /* 5. MOBILE SUB-MENUS (ALWAYS OPEN) */
  
  /* Hide the little arrow "▾" since it's always open */
  .nav-dd-trigger::after {
    display: none;
  }

  /* Force the menu to be ALWAYS visible (Flex) */
  .nav-dd .nav-dd-menu {
    display: flex !important;
    position: static;       /* Sit naturally under the button */
    width: 100%;
    box-shadow: none;       /* No floating shadow */
    border: none;           /* No border */
    background: transparent;/* Blend into background */
    
    margin-top: 2px;
    padding-left: 20px;     /* Indent sub-items so they look nested */
    padding-bottom: 10px;   /* Space after the group */
  }

  /* Style the sub-links to be smaller/dimmer to look like a list */
  .nav-sub {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    color: #ccc;            /* Slightly dimmer text */
    border-left: 1px solid #444; /* Optional: cool tree line effect */
  }


/* ✅ Active sub-tab highlight (mobile) */
.nav-sub.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left: 1px solid #fff;
}
  
}



.lfl-scrollnav{
  position:fixed;
  right:14px;
  bottom:14px;
  display:none;            /* hidden until scroll */
  z-index:9999;
}
.lfl-scrollbtn{
  width:42px;
  height:42px;
  display:block;
  margin-top:6px;
  border: 1px solid #7c7f82;
  border-radius:8px;
  cursor:pointer;
  font-size:18px;
  line-height:38px;
  text-align:center;
  background: rgba(0,0,0,.65);
  transition: background .2s ease;
  color:#fff;
}
.lfl-scrollbtn:hover{
  background: rgba(255,255,255,.15);
}


/* ============================================================
   MOBILE BOTTOM NAVIGATION
   ============================================================ */

.lfl-mobile-dock {
  display: none;
}

@media screen and (max-width: 720px) {
  /* Keep the final page content above the fixed dock. */
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Let the full hamburger panel appear above the bottom dock. */
  .nav-extras {
    z-index: 100020;
  }

  .lfl-mobile-dock {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 100010;

    width: min(360px, calc(100vw - 16px));
    min-height: 54px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;

    padding: 5px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 16px 16px 0 0;
    background: rgba(12,12,12,.94);
    box-shadow: 0 10px 34px rgba(0,0,0,.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .lfl-dock-group {
    position: static;
    display: flex;
  }

  .lfl-dock-btn {
    position: relative;
    width: 100%;
    min-width: 0;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #fff;
    text-decoration: none;
    font: inherit;
    font-size: 22px;
    line-height: 44px;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .lfl-dock-btn:visited {
    color: #fff;
  }

  .lfl-dock-btn:active,
  .lfl-dock-btn[aria-expanded="true"] {
    background: rgba(255,255,255,.13);
  }

  .lfl-dock-btn.is-active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 18px;
    height: 3px;
    border-radius: 999px;
    transform: translateX(-50%);
    background: #fff;
  }

  .lfl-dock-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    width: min(230px, calc(100vw - 20px));
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 14px;
    background: rgba(17,17,17,.98);
    box-shadow: 0 12px 34px rgba(0,0,0,.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .lfl-dock-panel[hidden] {
    display: none !important;
  }

  .lfl-dock-panel--left {
    left: 46px;
  }

  .lfl-dock-panel--right {
    right: 46px;
  }

  .lfl-dock-panel--center {
    left: 50%;
    transform: translateX(-50%);
  }

  .lfl-dock-panel-title {
    padding: 5px 10px 7px;
    color: #aaa;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .lfl-dock-panel a {
    display: block;
    padding: 10px 12px;
    border-radius: 9px;
    color: #fff;
    font-size: 15px;
    text-decoration: none;
  }

  .lfl-dock-panel a:hover,
  .lfl-dock-panel a:active,
  .lfl-dock-panel a.active {
    background: rgba(255,255,255,.10);
  }

  /* The existing arrows float just above the new dock. */
  .lfl-scrollnav {
    right: 10px;
    bottom: 72px;
    z-index: 100005;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    will-change: transform;
  }

  /* The full menu needs the bottom of the screen for Connect and Resources. */
  body:has(#navExtras.active) .lfl-mobile-dock,
  body:has(#navExtras.active) .lfl-scrollnav {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}
