/* ============================================================
   EquityCrew Component System — components.css
   All components use CSS variables from base_layout.html :root
   ============================================================ */

/* ── Section Header Bar ── */
.ec-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -20px -20px 20px -20px;
}
.ec-header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ec-header-section {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ec-header-sep {
  color: var(--border);
  font-size: 14px;
}
.ec-header-page {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.ec-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Buttons ── */
.ec-btn {
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.ec-btn:hover { opacity: 0.85; }
.ec-btn-sm {
  padding: 5px 12px;
  font-size: 11px;
}
.ec-btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}
.ec-btn-secondary {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.ec-btn-tertiary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.ec-btn-danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
}
.ec-btn-ghost {
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
}

/* ── Badges ── */
.ec-badge {
  display: inline-block;
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
}
.ec-badge-active  { background: var(--accent-dim); color: var(--accent); }
.ec-badge-running { background: rgba(245,158,11,0.12); color: var(--amber); }
.ec-badge-idle    { background: rgba(100,116,139,0.15); color: var(--text-muted); font-weight: 400; }
.ec-badge-danger  { background: rgba(239,68,68,0.12); color: var(--danger); }
.ec-badge-tag {
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 500;
}

/* ── Data Table ── */
.ec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
}
.ec-table thead tr {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ec-table th {
  padding: 10px 14px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ec-table th.right { text-align: right; }
.ec-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.ec-table tbody tr:last-child { border-bottom: none; }
.ec-table tbody tr:hover { background: var(--surface2); }
.ec-table td {
  padding: 10px 14px;
  color: var(--text-dim);
}
.ec-table td.right { text-align: right; }
.ec-table td.ticker {
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.ec-table td.score-high {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-align: right;
}
.ec-table td.score-mid {
  color: var(--amber);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-align: right;
}
.ec-table td.score-low {
  color: var(--danger);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-align: right;
}
.ec-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

/* ── Metric Card ── */
.ec-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  min-width: 110px;
}
.ec-card-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-family: 'DM Sans', sans-serif;
}
.ec-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}
.ec-card-value.accent { color: var(--accent); }
.ec-card-trend {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: 'DM Sans', sans-serif;
}
.ec-card-trend.up   { color: var(--accent); }
.ec-card-trend.down { color: var(--danger); }

/* ── Panel Card (surface background) ── */
.ec-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.ec-panel-title {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
  font-family: 'DM Sans', sans-serif;
}

/* ── Form Controls ── */
.ec-input,
.ec-select,
.ec-textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ec-input::placeholder,
.ec-textarea::placeholder { color: var(--text-muted); }
.ec-input:focus,
.ec-select:focus,
.ec-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.ec-select { color: var(--text-dim); cursor: pointer; }
.ec-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
  display: block;
  font-family: 'DM Sans', sans-serif;
}
.ec-field {
  margin-bottom: 14px;
}

/* ── Metric Row (cards in a row) ── */
.ec-metrics {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* ── Split Layout (filter sidebar + main) ── */
.ec-split {
  display: grid;
  gap: 16px;
}
.ec-split-2 { grid-template-columns: 260px 1fr; }
.ec-split-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Editorial text area ── */
.ec-prose {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.75;
  font-family: 'DM Sans', sans-serif;
  max-width: 780px;
}
.ec-prose p { margin: 0 0 12px 0; }

/* ── Empty / Loading state ── */
.ec-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
}

/* ── Divider ── */
.ec-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ── News Card (used in portfolio_news renderNews()) ── */
.ec-news-card {
  border-left: 3px solid var(--accent);
}
.ec-news-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.ec-news-headline {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  font-family: 'DM Sans', sans-serif;
}
.ec-news-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  margin-bottom: 10px;
  color: var(--text-muted);
}
.ec-news-ticker {
  background: var(--accent-dim);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 500;
}
.ec-news-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Toast notification ── */
.ec-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: ec-toast-in 0.2s ease;
}
.ec-toast-success {
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
}
.ec-toast-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
}
@keyframes ec-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ec-toast-warning {
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--amber);
}

/* ── Progress bar color variants ── */
.ec-progress { background: var(--surface2); border-radius: 4px; overflow: hidden; }
.ec-progress-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.4s ease; }
.ec-progress-fill.high   { background: var(--accent); }
.ec-progress-fill.mid    { background: var(--amber); }
.ec-progress-fill.low    { background: var(--danger); }
