/* ── Sidebar Gradient Animation ── */
:root {
  --sg1: 59, 130, 246;
  --sg2: 96, 165, 250;
  --sg3: 37, 99, 235;
  --sg4: 99, 102, 241;
  --sg5: 29, 78, 216;
  --sg-blend: screen;
  --sg-size: 160%;
}

@keyframes sgMoveVertical {
  0%   { transform: translateY(-40%); }
  50%  { transform: translateY(40%); }
  100% { transform: translateY(-40%); }
}
@keyframes sgMoveCircle {
  0%   { transform: rotate(0deg); }
  50%  { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}
@keyframes sgMoveHorizontal {
  0%   { transform: translateX(-40%) translateY(-10%); }
  50%  { transform: translateX(40%) translateY(10%); }
  100% { transform: translateX(-40%) translateY(-10%); }
}

.sidebar-gradient-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #010205, #020508);
}

.sidebar-gradients {
  filter: url(#sidebar-goo) blur(70px);
  width: 100%;
  height: 100%;
  position: relative;
  opacity: 0.4;
}

.sg1 {
  position: absolute;
  background: radial-gradient(circle at center, rgba(var(--sg1), 0.3) 0, rgba(var(--sg1), 0) 50%) no-repeat;
  mix-blend-mode: var(--sg-blend);
  width: var(--sg-size); height: var(--sg-size);
  top: calc(50% - var(--sg-size) / 2);
  left: calc(50% - var(--sg-size) / 2);
  transform-origin: center center;
  animation: sgMoveVertical 30s ease infinite;
}
.sg2 {
  position: absolute;
  background: radial-gradient(circle at center, rgba(var(--sg2), 0.3) 0, rgba(var(--sg2), 0) 50%) no-repeat;
  mix-blend-mode: var(--sg-blend);
  width: var(--sg-size); height: var(--sg-size);
  top: calc(50% - var(--sg-size) / 2);
  left: calc(50% - var(--sg-size) / 2);
  transform-origin: calc(50% - 120px);
  animation: sgMoveCircle 20s reverse infinite;
}
.sg3 {
  position: absolute;
  background: radial-gradient(circle at center, rgba(var(--sg3), 0.25) 0, rgba(var(--sg3), 0) 50%) no-repeat;
  mix-blend-mode: var(--sg-blend);
  width: var(--sg-size); height: var(--sg-size);
  top: calc(50% - var(--sg-size) / 2 + 100px);
  left: calc(50% - var(--sg-size) / 2 - 80px);
  transform-origin: calc(50% + 120px);
  animation: sgMoveCircle 40s linear infinite;
}
.sg4 {
  position: absolute;
  background: radial-gradient(circle at center, rgba(var(--sg4), 0.25) 0, rgba(var(--sg4), 0) 50%) no-repeat;
  mix-blend-mode: var(--sg-blend);
  width: var(--sg-size); height: var(--sg-size);
  top: calc(50% - var(--sg-size) / 2);
  left: calc(50% - var(--sg-size) / 2);
  transform-origin: calc(50% - 80px);
  animation: sgMoveHorizontal 40s ease infinite;
}
.sg5 {
  position: absolute;
  background: radial-gradient(circle at center, rgba(var(--sg5), 0.2) 0, rgba(var(--sg5), 0) 50%) no-repeat;
  mix-blend-mode: var(--sg-blend);
  width: calc(var(--sg-size) * 1.5); height: calc(var(--sg-size) * 1.5);
  top: calc(50% - var(--sg-size) * 0.75);
  left: calc(50% - var(--sg-size) * 0.75);
  transform-origin: calc(50% - 200px) calc(50% + 80px);
  animation: sgMoveCircle 20s ease infinite;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: transparent;
  border-right: 1px solid rgba(59, 130, 246, 0.15);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar.collapsed {
  width: var(--sidebar-w-sm);
  min-width: var(--sidebar-w-sm);
}

/* ── Sidebar Logo ── */
.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 12px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 20px;
  transition: width var(--transition), height var(--transition), border-radius var(--transition);
}

.sidebar-logo-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition), max-height var(--transition);
}

.sidebar.collapsed .sidebar-logo {
  padding: 4px 8px 12px;
}

.sidebar.collapsed .sidebar-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.sidebar.collapsed .sidebar-logo-name {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
}

/* ── Sidebar Header ── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 12px;
  flex-shrink: 0;
  min-height: 56px;
  position: relative;
  z-index: 1;
}

.sidebar-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition), width var(--transition), flex var(--transition);
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-name {
  opacity: 0;
  pointer-events: none;
  width: 0;
  flex: 0;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 16px 8px;
  gap: 0;
}

.sidebar-toggle {
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: rgba(37, 99, 235, 0.5);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition);
}

.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  padding: 8px 8px 8px calc(var(--sidebar-w) / 8);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding-bottom: 60px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed .sidebar-nav {
  padding: 8px 4px;
  align-items: center;
}

.sidebar.collapsed .nav-item {
  padding: 8px;
  gap: 0;
  justify-content: center;
}

/* ── Nav Item — Sora style ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 20px;
  color: rgba(59, 130, 246, 0.75);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item:hover {
  background: rgba(37, 99, 235, 0.06);
  color: var(--accent);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-label {
  font-size: 16px;
  font-weight: 500;
  font-family: 'AppFont', sans-serif;
  opacity: 1;
  max-width: 200px;
  transition: opacity var(--transition), max-width var(--transition);
  overflow: hidden;
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}

/* ── Tooltip for collapsed nav items ── */
.sidebar.collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
  z-index: 200;
}
.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
}

/* ── Wallet ── */
.sidebar-wallet {
  position: relative;
  padding: 0 10px 10px;
  flex-shrink: 0;
  z-index: 10;
}

.wallet-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 20px;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.wallet-btn:hover {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.55);
}

.wallet-btn.connected {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.2);
  color: rgba(147, 197, 253, 0.8);
}

.wallet-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar.collapsed .wallet-btn {
  padding: 9px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  margin: 0 auto;
}

.sidebar.collapsed .wallet-btn-label {
  display: none;
}

.wallet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 200ms ease;
}

.wallet-overlay.open {
  display: flex;
  opacity: 0;
  animation: walletFadeIn 200ms ease forwards;
}

@keyframes walletFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.wallet-modal {
  background: var(--bg-card);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 20px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 260px;
  position: relative;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  transform: translateY(0);
  animation: walletSlideIn 200ms ease forwards;
}

@keyframes walletSlideIn {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.wallet-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: rgba(59, 130, 246, 0.4);
  cursor: pointer;
  transition: all var(--transition);
}

.wallet-modal-close:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
}

.wallet-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: transparent;
  border: 1px solid rgba(37, 99, 235, 0.12);
  color: rgba(147, 197, 253, 0.85);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.wallet-option:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.3);
}

.wallet-option img {
  border-radius: 10px;
}

/* ── Social Links (bottom) ── */
.sidebar-socials {
  display: flex;
  position: relative;
  z-index: 1;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 8px;
  flex-shrink: 0;
  transition: flex-direction var(--transition);
}

.sidebar.collapsed .sidebar-socials {
  flex-direction: column;
  padding: 10px 4px;
  gap: 2px;
}

.social-link {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(37, 99, 235, 0.5);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
  flex-shrink: 0;
}

.social-link:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
}

.social-link.active {
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
}
