/* ===== SAHAM - IDX Trading App Styles ===== */
:root {
  --color-up: #00d26a;
  --color-down: #f23645;
  --color-neutral: #787b86;
  --sidebar-width: 220px;
  --bg-card: #1e222d;
  --bg-surface: #131722;
  --border-color: #2a2e39;
}

body {
  background: var(--bg-surface);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

/* ===== Auth ===== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d1117 0%, #131722 50%, #1a1e2e 100%);
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* ===== Live Ticker Bar ===== */
.live-ticker-bar {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  height: 30px;
  background: #0d1117;
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.ticker-scroll {
  display: flex;
  gap: 24px;
  padding: 0 12px;
  white-space: nowrap;
  overflow-x: auto;
  width: 100%;
  scrollbar-width: none;
}
.ticker-scroll::-webkit-scrollbar { display: none; }
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 0;
  flex-shrink: 0;
}
.ticker-item:hover { opacity: 0.8; }
.ticker-item .t-ticker { font-weight: 700; color: #e5e7eb; }
.ticker-item .t-price { color: #e5e7eb; }
.ticker-item .t-change { font-weight: 600; }
.ticker-item .t-dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}
.ticker-item .t-dot.up { background: var(--color-up); }
.ticker-item .t-dot.down { background: var(--color-down); }
.live-badge {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0,210,106,0.2);
  color: var(--color-up);
  margin-right: 8px;
  flex-shrink: 0;
  animation: pulse-live 2s infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Alert toast for price alerts */
.alert-toast {
  position: fixed;
  top: 90px;
  right: 16px;
  z-index: 9999;
  max-width: 350px;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - 86px);
  position: fixed;
  left: 0;
  top: 86px;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s;
}
.sidebar-nav { padding: 0.5rem; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: #e5e7eb; }
.sidebar-link.active { background: rgba(0,210,106,0.12); color: var(--color-up); font-weight: 600; }
.sidebar-link i { font-size: 1.1rem; width: 20px; text-align: center; }

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 1.25rem;
  width: calc(100% - var(--sidebar-width));
  min-height: calc(100vh - 56px);
}

/* ===== Cards ===== */
.card-dark {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
}
.card-dark .card-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-neutral);
  margin-bottom: 0.5rem;
}
.card-dark .card-value {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ===== Stock Colors ===== */
.text-up { color: var(--color-up) !important; }
.text-down { color: var(--color-down) !important; }
.text-neutral { color: var(--color-neutral) !important; }
.bg-up { background: rgba(0,210,106,0.15); }
.bg-down { background: rgba(242,54,69,0.15); }

.badge-up { background: rgba(0,210,106,0.2); color: var(--color-up); }
.badge-down { background: rgba(242,54,69,0.2); color: var(--color-down); }
.badge-buy { background: rgba(0,210,106,0.2); color: var(--color-up); border: 1px solid rgba(0,210,106,0.3); }
.badge-sell { background: rgba(242,54,69,0.2); color: var(--color-down); border: 1px solid rgba(242,54,69,0.3); }

/* ===== Tables ===== */
.table-dark-custom {
  background: transparent;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
.table-dark-custom thead th {
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border-color);
  color: var(--color-neutral);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  white-space: nowrap;
}
.table-dark-custom tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.88rem;
  vertical-align: middle;
}
.table-dark-custom tbody tr { transition: background 0.1s; }
.table-dark-custom tbody tr:hover { background: rgba(255,255,255,0.04); }
.table-dark-custom tbody tr.clickable { cursor: pointer; }

/* ===== Stat Cards Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

/* ===== Chart Container ===== */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
}
.chart-container .chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

/* ===== Search Dropdown ===== */
#search-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  max-height: 300px;
  overflow-y: auto;
  top: 100%;
}
#search-dropdown .dropdown-item {
  color: #e5e7eb;
  padding: 8px 12px;
  font-size: 0.88rem;
}
#search-dropdown .dropdown-item:hover { background: rgba(255,255,255,0.06); }
#search-dropdown .dropdown-item .ticker { font-weight: 700; color: var(--color-up); margin-right: 8px; }

/* ===== Form Controls Dark ===== */
.form-control, .form-select {
  background: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  color: #e5e7eb !important;
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-up) !important;
  box-shadow: 0 0 0 2px rgba(0,210,106,0.15) !important;
}

/* ===== Signal Strength ===== */
.strength-strong { font-weight: 700; }
.strength-moderate { font-weight: 500; }
.strength-weak { font-weight: 400; opacity: 0.7; }

/* ===== Risk Meter ===== */
.risk-meter {
  height: 8px;
  border-radius: 4px;
  background: var(--border-color);
  overflow: hidden;
}
.risk-meter .fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

/* ===== Loading ===== */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}
.loading-spinner::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--color-up);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Page Header ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.page-header h4 {
  margin: 0;
  font-weight: 700;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3f4b; }

/* ===== Tab Pills Custom ===== */
.nav-pills-custom .nav-link {
  background: transparent;
  color: var(--color-neutral);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.82rem;
  margin-right: 4px;
}
.nav-pills-custom .nav-link.active {
  background: rgba(0,210,106,0.15);
  color: var(--color-up);
  border-color: rgba(0,210,106,0.3);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-neutral);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; display: block; }
