/* ==========================================================================
   NeonForge · Layout: navbar, three-column shell, sidebars, mobile nav
   ========================================================================== */

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(7, 9, 16, 0.72);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}

.navbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--cyan-rgb), 0.55), rgba(var(--magenta-rgb), 0.55), transparent);
  opacity: 0.6;
}

.nav-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-right {
  justify-content: flex-end;
}

.nav-drawer-btn {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none !important;
  flex-shrink: 0;
}

.logo-mark {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 10px rgba(var(--cyan-rgb), 0.55));
}

.brand-name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.brand-name span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 340px;
  min-width: 0;
  height: 40px;
  padding: 0 10px 0 12px;
  gap: 8px;
  border-radius: 999px;
  background: rgba(var(--ink-2-rgb), 0.8);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: border-color var(--fast), box-shadow var(--fast);
}

.nav-search:focus-within {
  border-color: rgba(var(--cyan-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--cyan-rgb), 0.14);
  color: var(--cyan);
}

.nav-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 14px;
}

.nav-search input::placeholder {
  color: #5c6380;
}

.nav-search input::-webkit-search-cancel-button {
  filter: invert(0.6);
}

.nav-search:focus-within kbd {
  display: none;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.nav-link {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 48px;
  border-radius: 12px;
  color: var(--muted);
  transition: background var(--fast), color var(--fast);
}

.nav-link .icon {
  width: 24px;
  height: 24px;
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.nav-link.is-active {
  color: var(--cyan);
}

.nav-link.is-active .icon {
  filter: drop-shadow(0 0 8px rgba(var(--cyan-rgb), 0.8));
}

.nav-link-bar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -8px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--gradient);
  box-shadow: 0 0 12px rgba(var(--cyan-rgb), 0.8);
  transform: scaleX(0);
  transition: transform 220ms var(--ease);
}

.nav-link.is-active .nav-link-bar {
  transform: scaleX(1);
}

.live-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(var(--red-rgb), 0.4);
  color: var(--danger-text-soft);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all var(--fast);
}

.live-toggle:hover {
  background: rgba(var(--red-rgb), 0.12);
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.live-toggle.is-live {
  background: var(--role-live);
  border-color: transparent;
  color: var(--role-live-fg);
  box-shadow: var(--btn-depth);
}

.live-toggle.is-live .live-dot {
  opacity: 1;
  background: #fff;
  animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
  }
}

.nav-bell .icon {
  width: 21px;
  height: 21px;
}

.badge-count {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--bg), 0 0 12px rgba(var(--red-rgb), 0.8);
}

.nav-avatar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 3px;
  border-radius: 999px;
  color: var(--muted);
  transition: background var(--fast);
}

.nav-avatar:hover,
.nav-avatar[aria-expanded='true'] {
  background: var(--surface-hover);
}

.nav-avatar .icon {
  width: 15px;
  height: 15px;
}

/* ---------- Shell ---------- */
.layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 312px;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 20px 48px;
  align-items: start;
}

.main-view {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  min-width: 0;
  outline: none;
}

.main-view > div:empty {
  display: none;
}

.main-view.is-entering {
  animation: view-in 280ms var(--ease);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 22px);
  max-height: calc(100vh - var(--nav-h) - 44px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

/* ---------- Left sidebar ---------- */
.side-user {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 16px;
  color: var(--text);
  text-decoration: none !important;
  transition: border-color var(--fast), transform var(--fast);
}

.side-user:hover {
  border-color: rgba(var(--cyan-rgb), 0.4);
}

.side-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.side-user-info strong {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.side-user-info small {
  color: var(--muted);
  margin-bottom: 4px;
}

.side-user-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.side-user-stats span {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.side-user-stats b {
  font-size: 16px;
  color: var(--text);
  letter-spacing: 0;
}

.side-cta {
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.side-cta-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(var(--cyan-rgb), 0.2), rgba(var(--magenta-rgb), 0.2));
  color: var(--cyan);
  box-shadow: var(--glow);
}

.side-cta p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.side-nav {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-weight: 500;
  transition: background var(--fast), color var(--fast);
}

.side-link:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.side-link.is-active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(var(--cyan-rgb), 0.16), transparent);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.side-link.is-active .icon {
  color: var(--cyan);
}

.side-ext {
  margin-left: auto;
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

.side-section {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
  margin: 2px 4px 8px;
}

.side-title .icon {
  width: 15px;
  height: 15px;
  color: var(--cyan);
}

.side-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text-dim);
  font-size: 14px;
  text-align: left;
  transition: background var(--fast), color var(--fast);
}

.side-filter span {
  flex: 1;
}

.side-filter b {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(132, 148, 205, 0.1);
}

.side-filter:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.side-filter.is-active {
  background: rgba(var(--cyan-rgb), 0.12);
  color: var(--text);
}

.side-filter.is-active b {
  background: var(--cyan);
  color: #020617;
}

.side-filter.tag-cyan .icon { color: var(--cyan); }
.side-filter.tag-magenta .icon { color: var(--magenta); }
.side-filter.tag-lime .icon { color: var(--lime); }
.side-filter.tag-amber .icon { color: var(--amber); }
.side-filter.tag-violet .icon { color: var(--violet); }

.side-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--subtle);
}

/* ---------- Right sidebar ---------- */
.live-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
  color: var(--text);
  transition: background var(--fast);
}

.live-item:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

.live-item span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.live-item strong {
  font-size: 14px;
}

.live-item small {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 4px;
}

.hot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hot-list a {
  display: grid;
  grid-template-columns: 26px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  padding: 8px;
  border-radius: 10px;
  color: var(--text);
}

.hot-list a:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

.hot-rank {
  grid-row: 1 / 3;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 18px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hot-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

.hot-list small {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.hot-list small .icon {
  width: 13px;
  height: 13px;
}

.creator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px;
}

.creator-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  min-width: 0;
}

.creator-link:hover {
  text-decoration: none;
}

.creator-link span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.creator-link strong {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creator-link small {
  color: var(--muted);
  font-size: 12px;
}

.pulse-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pulse-grid span {
  display: flex;
  flex-direction: column;
  padding: 10px;
  border-radius: 10px;
  background: rgba(var(--ink-rgb), 0.5);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pulse-grid b {
  font-size: 18px;
  color: var(--text);
  letter-spacing: 0;
  font-family: var(--mono);
}

.pulse-grid b.text-lime {
  color: var(--lime);
}

/* ---------- Mobile ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}

.bottom-nav {
  display: none;
}

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: 252px minmax(0, 1fr);
  }

  .sidebar-right {
    display: none;
  }

  .nav-link {
    width: 72px;
  }
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 14px calc(var(--bottom-h) + 28px);
  }

  .nav-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0 12px;
    gap: 10px;
  }

  .nav-center {
    display: none;
  }

  .nav-drawer-btn {
    display: inline-grid;
  }

  .sidebar-left {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 70;
    width: min(320px, 86vw);
    max-height: none;
    padding: 18px 14px;
    background: var(--bg-2);
    border-right: 1px solid var(--border-strong);
    transform: translateX(-105%);
    transition: transform 260ms var(--ease);
    box-shadow: var(--shadow);
  }

  body.drawer-open .sidebar-left {
    transform: none;
  }

  body.drawer-open .drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(7, 9, 16, 0.9);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-top: 1px solid var(--border);
  }

  .bottom-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--muted);
    padding: 6px 0;
  }

  .bottom-link:hover {
    text-decoration: none;
  }

  .bottom-link.is-active {
    color: var(--cyan);
  }

  .bottom-link .icon {
    width: 22px;
    height: 22px;
  }

  .bottom-create {
    justify-self: center;
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin-top: -22px;
    border-radius: 16px;
    background: var(--gradient);
    color: #020617;
    box-shadow: 0 8px 28px -6px rgba(var(--cyan-rgb), 0.85);
  }

  .bottom-create .icon {
    width: 24px;
    height: 24px;
  }

  .nav-create {
    display: none;
  }
}

@media (max-width: 640px) {
  .brand-name,
  .hide-sm,
  .nav-search kbd {
    display: none;
  }

  .nav-right {
    gap: 4px;
  }

  .live-toggle {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
