/* ============================================================
   NEPSE Pulse — Dashboard Styles
   Dark theme, clean, mobile-friendly
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f172a;
  --surface:  #1e293b;
  --surface2: #263044;
  --border:   #334155;
  --text:     #f1f5f9;
  --muted:    #94a3b8;
  --green:    #22c55e;
  --blue:     #3b82f6;
  --yellow:   #f59e0b;
  --red:      #ef4444;
  --crimson:  #dc2626;
  --purple:   #a855f7;
  --orange:   #f97316;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Header ---- */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.logo { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-open   { background: rgba(34,197,94,0.15);  color: var(--green);  border: 1px solid rgba(34,197,94,0.3);  }
.badge-closed { background: rgba(148,163,184,0.1); color: var(--muted);  border: 1px solid var(--border); }

/* ---- Buttons ---- */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--blue); }
.btn-ghost.enabled { color: var(--green); border-color: var(--green); }

/* ---- Main layout ---- */
main { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }
footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ---- Sections ---- */
.section { margin-bottom: 36px; }
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 14px;
}
.muted { color: var(--muted); font-size: 14px; }

/* ---- Portfolio cards ---- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  transition: border-color 0.2s;
}
.card:hover { border-color: #475569; }
.card-symbol {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 2px;
}
.card-name   { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.card-price  { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.card-pnl    { font-size: 14px; font-weight: 600; }
.card-meta   { margin-top: 10px; font-size: 12px; color: var(--muted); }
.card-status {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

/* Skeleton loader */
.skeleton {
  height: 140px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border: 1px solid var(--border);
  border-radius: 14px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ---- Watchlist table ---- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  font-size: 14px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.sym { font-weight: 700; font-size: 15px; }
.sector-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  background: rgba(148,163,184,0.1);
  color: var(--muted);
}
.price-cell { font-weight: 700; font-size: 16px; }
.status-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(148,163,184,0.1);
}

/* ---- Alert feed ---- */
#alert-feed { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  background: var(--surface);
  border-radius: 10px;
  padding: 14px 16px;
  border-left: 4px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:none} }
.alert-icon  { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.alert-body  { flex: 1; }
.alert-title { font-weight: 700; font-size: 15px; }
.alert-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }
.alert-action{ font-size: 13px; color: #fbbf24; margin-top: 4px; font-weight: 500; }
.alert-time  { font-size: 11px; color: var(--muted); flex-shrink: 0; text-align: right; min-width: 60px; }

/* ---- Toast notification popup ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease;
  font-size: 14px;
}
@keyframes slideIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:none} }
.toast-title { font-weight: 700; margin-bottom: 4px; }
.toast-body  { color: var(--muted); font-size: 13px; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .header-inner { padding: 12px 16px; }
  main { padding: 20px 14px; }
  th, td { padding: 10px 10px; }
  .hide-mobile { display: none; }
}
