/* AInvesting Pro — partial CSS do sidebar.
 * Usado pelo /static/_sidebar.html via /static/_sidebar-loader.js.
 * Todas as variaveis tem fallback hardcoded pra funcionar em qualquer
 * pagina, independente do tema atual. */

:root {
  --sb-w: 240px;
  --sb-w-collapsed: 64px;
}

/* Layout pai: paginas com sidebar precisam ser flex-row */
body.has-sidebar { display: flex !important; flex-direction: row; min-height: 100vh; }
body.has-sidebar > .main-area,
body.has-sidebar > main { flex: 1; min-width: 0; overflow-y: auto; }

#sidebar {
  width: var(--sb-w);
  min-width: var(--sb-w);
  background: linear-gradient(180deg, rgba(7, 16, 31, 0.96), rgba(3, 6, 15, 0.98));
  border-right: 1px solid rgba(96, 165, 250, 0.22);
  display: flex; flex-direction: column;
  overflow: hidden; transition: width 0.25s ease;
  flex-shrink: 0; position: relative; z-index: 10;
  font-family: 'Inter', sans-serif;
}
#sidebar.collapsed { width: var(--sb-w-collapsed); min-width: var(--sb-w-collapsed); }
#sidebar.collapsed .sidebar-label,
#sidebar.collapsed .nav-section-label,
#sidebar.collapsed .sidebar-user-info { display: none; }

.sidebar-logo {
  padding: 1rem 0.85rem 1rem 1rem;
  border-bottom: 1px solid rgba(96, 165, 250, 0.22);
  display: flex; align-items: center; gap: 0.5rem;
  flex-shrink: 0; min-height: 72px;
  justify-content: space-between;
}
.sidebar-logo-emblem,
.sidebar-logo-lockup {
  display: flex; align-items: center; gap: 0.55rem;
  text-decoration: none; font-family: 'Plus Jakarta Sans', sans-serif;
  flex: 1; min-width: 0;
}
.sidebar-logo-emblem { display: none; flex: 0 0 auto; }
.sidebar-logo-icon { width: 32px; height: 32px; flex-shrink: 0; }
.sidebar-logo-icon svg { width: 100%; height: 100%; }
.sidebar-logo-icon svg path { stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.sidebar-logo-icon svg .square { stroke: #1d4ed8; }
.sidebar-logo-icon svg .arrow { stroke: #60a5fa; }
.sidebar-logo .brand-text {
  font-size: 1rem; font-weight: 700;
  letter-spacing: -0.02em; color: #f5f7fa;
  white-space: nowrap;
}
.sidebar-logo .brand-text .pro { color: #4895ff; font-weight: 400; margin-left: 0.15rem; }

.sidebar-logo-collapse-btn {
  flex-shrink: 0; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 0;
  color: #5a6678; cursor: pointer; border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-logo-collapse-btn:hover { background: rgba(72, 149, 255, 0.08); color: #c7d2e0; }
.sidebar-logo-collapse-btn svg {
  width: 16px; height: 16px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
#sidebar.collapsed .sidebar-logo { justify-content: center; padding: 0.85rem 0.5rem; }
#sidebar.collapsed .sidebar-logo-lockup,
#sidebar.collapsed .sidebar-logo-collapse-btn { display: none; }
#sidebar.collapsed .sidebar-logo-emblem { display: block; }

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 0.5rem;
  display: flex; flex-direction: column; gap: 1px;
}
.nav-section-label {
  font-family: 'Inter', sans-serif; font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: #5a6678; padding: 0.9rem 0.6rem 0.4rem; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.7rem; border-radius: 8px;
  color: #c7d2e0; text-decoration: none;
  font-size: 0.85rem; font-weight: 500;
  transition: background 0.15s, color 0.15s; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
}
.nav-item:hover { background: rgba(72, 149, 255, 0.08); color: #f5f7fa; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(72, 149, 255, 0.18), rgba(72, 149, 255, 0.04));
  color: #60a5fa; border-color: rgba(96, 165, 250, 0.25);
}
.nav-item .nav-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.sidebar-user {
  border-top: 1px solid rgba(96, 165, 250, 0.22);
  padding: 0.6rem 0.5rem;
  display: flex; flex-direction: column; gap: 2px; flex-shrink: 0;
}
.sidebar-user-card {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.7rem; border-radius: 8px;
  background: rgba(11, 23, 46, 0.5);
  border: 1px solid rgba(96, 165, 250, 0.10);
}
.sidebar-user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700; font-size: 0.8rem; color: white; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-user-name {
  font-size: 0.78rem; font-weight: 600; color: #f5f7fa;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-profile-link {
  font-size: 0.7rem; color: #60a5fa;
  font-family: 'Inter', sans-serif; text-decoration: none;
  font-weight: 500; letter-spacing: 0.01em;
  transition: color 0.15s; display: block; margin-top: 1px;
}
.sidebar-user-profile-link:hover { color: #4895ff; text-decoration: underline; }

@media (max-width: 900px) {
  #sidebar { width: var(--sb-w-collapsed); min-width: var(--sb-w-collapsed); }
  #sidebar .sidebar-label,
  #sidebar .nav-section-label,
  #sidebar .sidebar-user-info { display: none; }
  #sidebar .sidebar-logo { justify-content: center; padding: 0.85rem 0.5rem; }
  #sidebar .sidebar-logo-lockup,
  #sidebar .sidebar-logo-collapse-btn { display: none; }
  #sidebar .sidebar-logo-emblem { display: block; }
}
