/* ── StockGPT Sidebar Layout ───────────────────────────────────── */

/* Reset body for sidebar layout */
body.has-sidebar {
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  background-color: #f0f2f5;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sgpt-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: #0f1523;
  border-right: 1px solid #1e2d4a;
  display: flex;
  flex-direction: column;
  z-index: 9000;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #1e2d4a transparent;
  flex-shrink: 0;
}

.sgpt-sidebar::-webkit-scrollbar { width: 4px; }
.sgpt-sidebar::-webkit-scrollbar-track { background: transparent; }
.sgpt-sidebar::-webkit-scrollbar-thumb { background: #1e2d4a; border-radius: 2px; }

/* ── Logo ─────────────────────────────────────────────────────── */
.sgpt-sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid #1e2d4a;
  flex-shrink: 0;
}

.sgpt-sidebar-logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.sgpt-sidebar-logo .logo-icon {
  font-size: 24px;
  line-height: 1;
}

.sgpt-sidebar-logo .logo-text {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #22d3ee, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

/* ── Nav Groups ───────────────────────────────────────────────── */
.sgpt-sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

.sgpt-nav-group {
  margin-bottom: 4px;
}

.sgpt-nav-group-label {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #4a5568;
  padding: 14px 20px 6px;
  user-select: none;
}

.sgpt-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  margin: 1px 8px;
  border-radius: 8px;
  color: #8899aa;
  text-decoration: none;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.sgpt-nav-item:hover {
  background: rgba(34, 211, 238, 0.06);
  color: #c0cfe0;
}

.sgpt-nav-item.active {
  background: rgba(34, 211, 238, 0.10);
  color: #22d3ee;
  font-weight: 600;
  border-left-color: #22d3ee;
}

.sgpt-nav-item .nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.sgpt-nav-item .nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sidebar Footer ──────────────────────────────────────────── */
.sgpt-sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid #1e2d4a;
  flex-shrink: 0;
}

.sgpt-sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.sgpt-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  animation: sgpt-pulse 2s ease-in-out infinite;
}

@keyframes sgpt-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 12px rgba(16, 185, 129, 0.8); }
}

.sgpt-sidebar-version {
  font-size: 10px;
  color: #374151;
  margin-top: 6px;
  letter-spacing: 0.3px;
}

/* ── Content Area ─────────────────────────────────────────────── */
.sgpt-content-area {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
  width: calc(100% - 220px);
  overflow-x: auto;
}

/* ── Hide old tab navigation ─────────────────────────────────── */
body.has-sidebar #tabs {
  display: none !important;
}

/* ── Mobile Toggle (hidden on desktop) ───────────────────────── */
.sgpt-sidebar-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 9100;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #0f1523;
  border: 1px solid #1e2d4a;
  color: #22d3ee;
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sgpt-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sgpt-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sgpt-content-area {
    margin-left: 0;
    width: 100%;
  }
  .sgpt-sidebar-toggle {
    display: flex;
  }
  .sgpt-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 8999;
  }
  .sgpt-sidebar-overlay.open {
    display: block;
  }
}
