/* ===================================================
   SHARED COMPONENTS CSS
   (used across dashboard, analytics, stocks, etc.)
   =================================================== */

/* ─── App Layout ──────────────────────────────────── */
.app-layout {
  display: block;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: 1.5rem 0;
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px;
  z-index: 100; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}
.sidebar-logo .logo-text { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }

.sidebar-nav { flex: 1; padding: 0.5rem 0.75rem; }
.sidebar-section-label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); padding: 0.75rem 0.75rem 0.25rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.75rem; border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  transition: all var(--transition-fast); margin-bottom: 0.125rem;
  cursor: pointer; text-decoration: none;
}
.sidebar-link:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.sidebar-link.active { background: rgba(15,122,77,0.1); color: var(--accent-cyan); border-right: 2px solid var(--accent-cyan); }
.sidebar-link .link-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link .badge { margin-left: auto; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}
.sidebar-user {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem; border-radius: var(--radius-md);
  background: var(--bg-glass); border: 1px solid var(--border-subtle);
  cursor: pointer; transition: all var(--transition-fast);
}
.sidebar-user:hover { border-color: var(--accent-cyan); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad-primary); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.7rem; color: var(--text-muted); }

.main-content {
  margin-left: 240px;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  width: calc(100vw - 240px);
  max-width: 100%;
  overflow-x: hidden;
}

/* ─── Top Bar ─────────────────────────────────────── */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  position: sticky; top: 0; z-index: 50;
  width: 100%;
}
.top-bar-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.top-bar-actions { display: flex; align-items: center; gap: 1rem; }
.top-bar-btn {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  background: var(--bg-glass); border: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all var(--transition-fast); cursor: pointer;
}
.top-bar-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.notif-dot {
  width: 8px; height: 8px; background: var(--accent-red); border-radius: 50%;
  position: absolute; top: -2px; right: -2px; border: 2px solid var(--bg-primary);
}

/* ─── Page Content ────────────────────────────────── */
.page-content { padding: 2rem; }
.page-header { margin-bottom: 2rem; }
.page-title { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; }
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }

/* ─── Stats Row ───────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 2rem; }
@media (max-width: 1200px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .stats-row { grid-template-columns: 1fr; } }

/* ─── Chart Containers ────────────────────────────── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(20px);
}
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.chart-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; }
.chart-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }
.chart-tabs { display: flex; gap: 0.25rem; }
.chart-tab {
  padding: 0.35rem 0.75rem; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-muted);
  transition: all var(--transition-fast); border: 1px solid transparent;
}
.chart-tab.active { background: rgba(15,122,77,0.12); color: var(--accent-cyan); border-color: rgba(15,122,77,0.25); }
.chart-tab:hover:not(.active) { color: var(--text-primary); }

/* ─── Watchlist ───────────────────────────────────── */
.watchlist-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 0;
  border-bottom: 1px solid rgba(15,122,77,0.05);
  cursor: pointer; transition: background var(--transition-fast);
}
.watchlist-item:last-child { border-bottom: none; }
.watchlist-item:hover { background: var(--bg-glass); margin: 0 -1.5rem; padding: 0.875rem 1.5rem; border-radius: var(--radius-sm); }
.stock-symbol { font-weight: 700; font-size: 0.9rem; }
.stock-name { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.stock-price { font-weight: 600; font-size: 0.9rem; text-align: right; }
.stock-change { font-size: 0.75rem; text-align: right; margin-top: 1px; }

/* ─── Order Form ──────────────────────────────────── */
.order-form { display: flex; flex-direction: column; gap: 1rem; }
.order-type-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.order-type-btn {
  padding: 0.65rem; border-radius: var(--radius-md);
  font-weight: 700; font-size: 0.875rem; cursor: pointer;
  border: 1.5px solid var(--border-subtle);
  background: transparent; color: var(--text-secondary);
  transition: all var(--transition-fast); text-align: center;
}
.order-type-btn.buy.active { border-color: var(--accent-green); background: rgba(0,230,118,0.1); color: var(--accent-green); }
.order-type-btn.sell.active { border-color: var(--accent-red); background: rgba(255,61,90,0.1); color: var(--accent-red); }

/* ─── Toast Notifications ─────────────────────────── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(10,20,40,0.95); border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem; border-left: 3px solid;
  box-shadow: var(--shadow-deep); min-width: 280px; max-width: 360px;
  animation: slideInRight 0.3s ease; backdrop-filter: blur(20px);
}
.toast.success { border-color: var(--accent-green); }
.toast.error   { border-color: var(--accent-red); }
.toast.info    { border-color: var(--accent-cyan); }
.toast.warning { border-color: var(--accent-gold); }
.toast-message { font-size: 0.875rem; color: var(--text-primary); }
.toast-close { margin-left: auto; color: var(--text-muted); cursor: pointer; font-size: 1rem; }

/* ─── Mobile Sidebar Toggle ───────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--transition-base); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-deep); }
  .main-content { margin-left: 0; width: 100vw; }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 99; display: none;
  }
  .sidebar-overlay.show { display: block; }
}

/* ─── Loading Skeleton ────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(15,122,77,0.04) 25%, rgba(15,122,77,0.08) 50%, rgba(15,122,77,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ─── Progress Bar ────────────────────────────────── */
.progress-bar { height: 6px; background: var(--bg-secondary); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); background: var(--grad-primary); transition: width 0.8s ease; }

/* ─── Dropdown ────────────────────────────────────── */
.dropdown-wrapper { position: relative; }
.dropdown {
  position: absolute; top: calc(100% + 0.5rem); right: 0;
  background: rgba(10,20,40,0.98); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 0.5rem;
  min-width: 180px; box-shadow: var(--shadow-deep);
  backdrop-filter: blur(20px); opacity: 0; pointer-events: none;
  transform: translateY(-8px); transition: all var(--transition-fast);
  z-index: 200;
}
.dropdown.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.dropdown-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 0.875rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition-fast);
}
.dropdown-item:hover { background: var(--bg-glass); color: var(--text-primary); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: 0.25rem 0; }
