/* ============================================================
   OKBEA — DYNAMIC DASHBOARD CSS
   Stream switcher modal · sidebar · widget cards · animations
============================================================ */

/* ── STREAM SWITCHER MODAL ────────────────────────────────── */
#stream-switcher-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 500;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#stream-switcher-modal.show {
  display: flex;
  animation: fadeIn .2s ease;
}

.ssm-panel {
  background: var(--dash-bg);
  border: 1px solid var(--dash-border);
  border-radius: 20px;
  width: 680px;
  max-width: 95vw;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}

.ssm-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--dash-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ssm-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dash-text);
}

.ssm-close {
  background: none;
  border: none;
  color: var(--dash-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 6px;
  line-height: 1;
  transition: color .15s, background .15s;
}
.ssm-close:hover {
  color: var(--dash-text);
  background: rgba(255,255,255,.06);
}

.ssm-meta {
  padding: .75rem 1.5rem .25rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
  font-size: .78rem;
  color: var(--dash-muted);
}

.ssm-slot-pill {
  background: rgba(99,102,241,.12);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,.22);
  border-radius: 20px;
  padding: .2rem .75rem;
  font-size: .7rem;
  font-weight: 600;
}

.ssm-body {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 1.5rem 1.5rem;
}

#switcher-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
@media (max-width: 540px) {
  #switcher-grid { grid-template-columns: 1fr; }
}

/* Stream card inside switcher */
.ssm-stream-card {
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: var(--r2);
  padding: 1rem;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  user-select: none;
}
.ssm-stream-card:hover {
  border-color: rgba(255,255,255,.14);
  transform: translateY(-1px);
}
.ssm-stream-card:active {
  transform: translateY(0);
}

/* Status badges */
.ssm-badge {
  border-radius: 4px;
  padding: .18rem .5rem;
  font-size: .64rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.ssm-active  { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.ssm-locked  { background: rgba(100,116,139,.12); color: var(--dash-muted); }
.ssm-swap    { background: rgba(245,158,11,.12);  color: #f59e0b; }
.ssm-add     { background: rgba(99,102,241,.1);   color: #818cf8; }

/* ── WIDGET CARDS (used by stream widgets() output) ────────── */
.wcard {
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: var(--r3);
  padding: 1.1rem 1.15rem;
}
.wc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .85rem;
}
.wc-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--dash-text);
}

/* Transaction list */
.tx-list   { display: flex; flex-direction: column; gap: .4rem; }
.tx-item   { display: flex; align-items: center; gap: .65rem; padding: .35rem 0; border-bottom: 1px solid var(--dash-border); }
.tx-item:last-child { border-bottom: none; }
.tx-icon   { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .88rem; flex-shrink: 0; }
.tx-info   { flex: 1; min-width: 0; }
.tx-name   { font-size: .77rem; font-weight: 600; color: var(--dash-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-card   { font-size: .68rem; color: var(--dash-muted); }
.tx-date   { font-size: .68rem; color: var(--dash-muted); text-align: right; white-space: nowrap; }
.tx-amount { font-size: .78rem; font-weight: 700; text-align: right; white-space: nowrap; }
.tx-amount.pos { color: var(--dash-green, #4ade80); }
.tx-amount.neg { color: #f87171; }

/* ── STREAM STATS ROW ─────────────────────────────────────── */
#stream-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .85rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 900px) {
  #stream-stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  #stream-stats-row { grid-template-columns: 1fr; }
}

/* ── STREAM WIDGETS CONTAINER ─────────────────────────────── */
#stream-widgets-container {
  margin-bottom: .25rem;
}

/* ── FADE ANIMATION ───────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Light-mode overrides */
[data-theme="light"] .ssm-panel {
  box-shadow: 0 24px 80px rgba(0,0,0,.2);
}
[data-theme="light"] .ssm-stream-card:hover {
  border-color: rgba(0,0,0,.12);
}
