/* Sidebar revamp: authoritative navigation styling */

:root {
  --sidebar-rail-width: 72px;
  --nav-inline-gutter: 10px;
  --nav-section-gap: 10px;
  --nav-section-divider-offset: 10px;
  --nav-row-radius: 12px;
  --nav-row-min-height: 44px;
}

.sidebar-nav > .nav-section {
  padding: 6px 0;
  margin: 0;
  position: relative;
}

.sidebar-nav > .nav-section:first-child {
  padding-top: 0;
}

.sidebar-nav > .nav-section + .nav-section {
  margin-top: var(--nav-section-gap);
  padding-top: var(--nav-section-divider-offset);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-nav .nav-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.34);
  padding: 8px 16px 6px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  line-height: 1.2;
}

.nav-label__spark {
  font-size: 0.68rem;
  animation: navSparkPulse 2.4s ease-in-out infinite;
}

@keyframes navSparkPulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.13);
  }
}

.nav-section--ai {
  background: linear-gradient(
    140deg,
    rgba(168, 85, 247, 0.14) 0%,
    rgba(236, 72, 153, 0.08) 50%,
    rgba(251, 191, 36, 0.07) 100%
  );
  border-radius: 14px;
  margin: 0 var(--nav-inline-gutter) !important;
  padding: 8px 0 10px !important;
  border: 1px solid rgba(168, 85, 247, 0.2);
  box-shadow:
    0 8px 22px rgba(168, 85, 247, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.sidebar-nav > .nav-section.nav-section--ai {
  border-top: none;
  padding-top: 8px !important;
}

.nav-section--ai::before {
  content: '';
  position: absolute;
  top: -60%;
  left: -40%;
  width: 180%;
  height: 220%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(168, 85, 247, 0.06) 24%,
    transparent 50%,
    rgba(251, 191, 36, 0.06) 76%,
    transparent 100%
  );
  animation: aiSectionRotate 16s linear infinite;
  pointer-events: none;
}

@keyframes aiSectionRotate {
  to {
    transform: rotate(360deg);
  }
}

.nav-section--ai .nav-label {
  color: rgba(216, 180, 254, 0.9);
}

.sidebar-nav .nav-item {
  width: calc(100% - var(--nav-inline-gutter) - var(--nav-inline-gutter));
  box-sizing: border-box;
  margin: 2px var(--nav-inline-gutter);
  border-radius: var(--nav-row-radius);
  padding: 0 14px;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  height: var(--nav-row-min-height);
  min-height: var(--nav-row-min-height);
  overflow: visible;
  text-align: left;
}

.sidebar-nav .nav-item .nav-icon {
  width: 19px;
  height: 19px;
  display: block;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.18s ease, color 0.18s ease, filter 0.18s ease;
}

.sidebar-nav .nav-item:hover .nav-icon {
  opacity: 0.95;
}

.sidebar-nav .nav-item.active .nav-icon {
  opacity: 1;
}

.sidebar-nav .nav-item > span:first-of-type {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav .nav-item > .nav-badge,
.sidebar-nav .nav-item > .nav-tier-badge {
  flex: 0 0 auto;
  align-self: center;
}

.nav-item--pro,
.nav-item--premium {
  position: relative;
}

.nav-item--pro::after,
.nav-item--premium::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  transition: border-color 0.24s ease;
  pointer-events: none;
}

.nav-item--pro:hover::after {
  border-color: rgba(251, 191, 36, 0.2);
}

.nav-item--premium:hover::after {
  border-color: rgba(168, 85, 247, 0.24);
}

.nav-item--pro:hover {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.14), rgba(245, 158, 11, 0.06));
}

.nav-item--premium:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(236, 72, 153, 0.08));
}

.nav-item--pro:hover .nav-icon {
  color: #f59e0b;
  filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.24));
}

.nav-item--premium:hover .nav-icon {
  color: #a855f7;
  filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.28));
}

.nav-item--pro.active {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(245, 158, 11, 0.08)) !important;
  box-shadow: inset 3px 0 0 #f59e0b !important;
}

.nav-item--premium.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(236, 72, 153, 0.1)) !important;
  box-shadow: inset 3px 0 0 #a855f7 !important;
}

.nav-item--pro.active::before,
.nav-item--premium.active::before {
  display: none;
}

.nav-item--pro.active .nav-icon {
  color: #f59e0b;
}

.nav-item--premium.active .nav-icon {
  color: #a855f7;
}

.nav-tier-badge {
  font-size: 0.53rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 6px;
  border-radius: 5px;
  line-height: 1.05;
  margin-left: auto;
  flex-shrink: 0;
  text-transform: uppercase;
}

.nav-tier-badge--pro {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.24);
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.2);
}

.nav-tier-badge--premium {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.24);
  text-shadow: 0 0 6px rgba(168, 85, 247, 0.2);
}

/* Keep row geometry stable when badge is hidden for unlocked users */
.sidebar-nav .nav-item.nav-tier-hidden .nav-tier-badge {
  visibility: hidden;
  opacity: 0;
  width: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  margin-left: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-nav .nav-item:hover .nav-tier-badge--pro {
  background: rgba(251, 191, 36, 0.28);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
}

.sidebar-nav .nav-item:hover .nav-tier-badge--premium {
  background: rgba(168, 85, 247, 0.28);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.22);
}

.sidebar-nav .nav-badge {
  margin-left: auto;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  line-height: 1.2;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}

.upgrade-banner {
  margin: 10px var(--nav-inline-gutter);
  border-radius: 12px;
  padding: 13px 14px;
  position: relative;
  overflow: hidden;
}

.upgrade-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.upgrade-banner.free-active::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.03));
}

.upgrade-banner.pro-active::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.10), rgba(34, 197, 94, 0.04));
}

.upgrade-banner.premium-active::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.10), rgba(251, 191, 36, 0.04));
}

.upgrade-banner .upgrade-text,
.upgrade-banner .upgrade-icon {
  position: relative;
  z-index: 1;
}

.sidebar-footer {
  padding: 10px var(--nav-inline-gutter);
}

.sidebar-footer .user-card {
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}

.sidebar-footer .user-plan {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.75);
}

.sidebar-footer .user-plan::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.9;
}

.elite-plan-free .sidebar-footer .user-card,
.sidebar-footer .user-card.plan-free {
  border-color: rgba(251, 191, 36, 0.24);
}

.elite-plan-pro .sidebar-footer .user-card,
.sidebar-footer .user-card.plan-pro {
  border-color: rgba(74, 222, 128, 0.24);
}

.elite-plan-premium .sidebar-footer .user-card,
.sidebar-footer .user-card.plan-premium {
  border-color: rgba(192, 132, 252, 0.26);
}

.elite-plan-free .sidebar-footer .user-plan,
.sidebar-footer .user-card.plan-free .user-plan {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.32);
  background: rgba(251, 191, 36, 0.08);
}

.elite-plan-pro .sidebar-footer .user-plan,
.sidebar-footer .user-card.plan-pro .user-plan {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.34);
  background: rgba(74, 222, 128, 0.09);
}

.elite-plan-premium .sidebar-footer .user-plan,
.sidebar-footer .user-card.plan-premium .user-plan {
  color: #d8b4fe;
  border-color: rgba(192, 132, 252, 0.34);
  background: rgba(192, 132, 252, 0.10);
}

.topbar {
  padding: 0 clamp(18px, 2vw, 28px);
}

.topbar-right {
  gap: 10px;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-tier-badge,
.sidebar.collapsed .nav-label__spark,
.sidebar.collapsed .nav-badge {
  display: none;
}

.sidebar.collapsed .nav-section--ai {
  background: none;
  border: none;
  margin: 0 !important;
  padding: 4px 0 !important;
  box-shadow: none;
}

.sidebar.collapsed .nav-section--ai::before {
  display: none;
}

.sidebar.collapsed .sidebar-nav > .nav-section + .nav-section {
  border-top-color: rgba(255, 255, 255, 0.03);
}

.sidebar.collapsed .nav-item {
  width: 44px;
  height: 44px;
  min-height: 44px;
  justify-content: center;
  padding: 0;
  margin: 2px auto;
}

@media (max-width: 768px) {
  .nav-label,
  .nav-label__spark {
    display: none !important;
  }

  .nav-tier-badge {
    font-size: 0.44rem;
    padding: 2px 4px;
  }

  .nav-section--ai {
    background: none;
    border: none;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none;
  }

  .nav-section--ai::before {
    display: none;
  }

  .sidebar-nav > .nav-section + .nav-section {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
  }
}

.nav-more-toggle,
#navMoreToggle {
  display: none !important;
}

.nav-section-more {
  max-height: none !important;
  opacity: 1 !important;
  overflow: visible !important;
}
