/* =========================================================
   GLOBALMARKETPULSE — TERMINAL CSS
   Bloomberg-style trader terminal
   ========================================================= */

/* ── Layout ─────────────────────────────────────────────── */
.terminal-wrap {
  background: var(--bg-primary);
  min-height: calc(100vh - 70px);
  display: flex;
  flex-direction: column;
  font-family: 'Inter', monospace, sans-serif;
}

/* ── Top Status Bar ─────────────────────────────────────── */
.term-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.term-clock {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-family: 'Outfit', monospace;
  white-space: nowrap;
}
.term-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.22rem 0.65rem;
  border-radius: 3px;
  white-space: nowrap;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.term-badge.open  { background: rgba(16,185,129,.12); color: #10b981; border-color: rgba(16,185,129,.25); }
.term-badge.closed{ background: rgba(239,68,68,.10);  color: #ef4444; border-color: rgba(239,68,68,.2); }

/* ── Ticker Search ──────────────────────────────────────── */
.term-search {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
}
.term-search input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 4px 0 0 4px;
  color: var(--text-primary);
  font-family: 'Outfit', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.38rem 0.75rem;
  width: 160px;
  text-transform: uppercase;
  outline: none;
  transition: border-color .2s;
}
.term-search input:focus { border-color: var(--accent); }
.term-search input::placeholder { color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.term-search button {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 0 4px 4px 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.38rem 0.8rem;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.term-search button:hover { background: var(--accent-hover); }

/* ── Tab Bar ────────────────────────────────────────────── */
.term-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border);
  padding: 0 0.75rem;
  gap: 0;
}
.term-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.term-tab:hover { color: var(--text-primary); }
.term-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Breadcrumb ─────────────────────────────────────────── */
.term-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.term-back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.term-back-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.term-breadcrumb-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Outfit', monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Main content ───────────────────────────────────────── */
#termContent {
  flex: 1;
  padding: 1rem 1.25rem 2rem;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

/* ── Loading / Error ────────────────────────────────────── */
.term-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.term-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.term-error {
  padding: 2rem;
  color: var(--error);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 4px;
  background: rgba(239,68,68,.05);
  margin-top: 1rem;
}

/* ── Section Title ──────────────────────────────────────── */
.term-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.9rem 0 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

/* ── Card ───────────────────────────────────────────────── */
.term-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}

/* ── Pill Buttons ───────────────────────────────────────── */
.term-panel-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.75rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
.term-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: all .15s;
}
.term-pill:hover { color: var(--text-primary); border-color: var(--text-muted); }
.term-pill.active { background: var(--accent); color: var(--bg-primary); border-color: var(--accent); }

/* ── Stat Cards Grid ────────────────────────────────────── */
.term-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.term-stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.term-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.term-stat-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.term-stat-val {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Outfit', monospace;
  color: var(--text-primary);
  line-height: 1.2;
}

/* ── KV Row ─────────────────────────────────────────────── */
.term-kv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.38rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 0.8rem;
}
.term-kv:last-child { border-bottom: none; }
.term-kv-k {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.term-kv-v {
  color: var(--text-primary);
  font-weight: 600;
  font-family: 'Outfit', monospace;
}

/* ── Color Helpers ──────────────────────────────────────── */
.term-pos { color: #10b981; }
.term-neg { color: #ef4444; }
.term-dim { color: var(--text-muted); }
.fw      { font-weight: 700; }

/* ── MARKETS TABLE ──────────────────────────────────────── */
.term-table-outer { overflow-x: auto; }
.term-table-wrap  { min-width: 700px; }
.term-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.term-table thead tr {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.term-table th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}
.term-table th:first-child,
.term-table td:first-child { width: 32px; padding-left: 0.5rem; }
.term-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
  white-space: nowrap;
}
.term-table tbody tr:last-child td { border-bottom: none; }
.term-table tbody tr:hover td { background: var(--bg-card-hover); }
.term-ticker {
  font-family: 'Outfit', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.term-co {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}
.term-row-click { cursor: pointer; }

/* ── Price badge helpers ────────────────────────────────── */
.term-badge-primary {
  background: rgba(0,242,255,.1);
  color: var(--accent);
  border: 1px solid rgba(0,242,255,.2);
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  letter-spacing: 0.06em;
}

/* ── NEWS FEED ──────────────────────────────────────────── */
.term-newsfeed {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.term-news-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  transition: background .15s;
}
.term-news-item:last-child { border-bottom: none; }
.term-news-item.term-row-click:hover { background: rgba(255,255,255,.025); padding-left: 0.5rem; }
.term-news-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.term-src-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(0,242,255,.08);
  border: 1px solid rgba(0,242,255,.15);
  border-radius: 3px;
  padding: 0.1rem 0.45rem;
  text-transform: uppercase;
}
.term-ticker-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
  font-family: 'Outfit', monospace;
  transition: color .15s, border-color .15s;
}
.term-ticker-tag:hover { color: var(--accent); border-color: var(--accent); }
.term-news-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 0.2rem;
}
.term-news-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Article Detail ─────────────────────────────────────── */
.term-article {
  max-width: 760px;
  padding: 0.5rem 0 2rem;
}
.term-article-img {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 1rem;
}
.term-article-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.term-article-h {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
}
.term-article-body {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
}
.term-article-body p { margin-bottom: 1rem; }
.term-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.term-read-more:hover { color: var(--accent-hover); }

/* ── SENTIMENT ──────────────────────────────────────────── */
.term-gauge-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  margin-bottom: 0.75rem;
}
.term-gauge-wrap {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}
.term-gauge-svg { display: block; }
.term-gauge-info { text-align: center; }
.term-gauge-score {
  font-family: 'Outfit', monospace;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.term-gauge-label {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.term-zone-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 1rem;
  justify-content: center;
}
.term-zone-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  background: rgba(255,255,255,.03);
}
.term-zone-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Progress Bars ──────────────────────────────────────── */
.term-bars-card {
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.term-bar {
  position: relative;
  height: 32px;
  display: flex;
  align-items: center;
  margin-bottom: 0.4rem;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255,255,255,.03);
}
.term-bar:last-child { margin-bottom: 0; }
.term-bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 3px;
  transition: width .5s ease;
}
.term-bar-txt {
  position: relative;
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 1;
}

/* ── EXPERTS ────────────────────────────────────────────── */
.term-expert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  transition: border-color .15s, background .15s;
}
.term-expert-card.term-row-click:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  cursor: pointer;
}
.term-expert-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.term-expert-avatar {
  width: 40px;
  min-width: 40px;
  height: 40px;
  border-radius: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.03em;
  text-align: center;
  flex-shrink: 0;
}
.term-expert-avatar.large {
  width: 52px;
  min-width: 52px;
  height: 52px;
  font-size: 1rem;
}
.term-expert-avatar.sm {
  width: 32px;
  min-width: 32px;
  height: 32px;
  font-size: 0.6rem;
  border-radius: 3px;
}
.term-expert-info { flex: 1; min-width: 0; }
.term-expert-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-expert-detail-header { margin-bottom: 0.75rem; }

/* ── Stock row (inside expert card) ──────────────────────── */
.term-stock-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .15s;
}
.term-stock-row:last-child { border-bottom: none; }
.term-stock-row.term-row-click:hover { background: rgba(255,255,255,.025); padding-left: 0.35rem; cursor: pointer; }

/* ── STOCK DETAIL ───────────────────────────────────────── */
.term-stock-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.term-stock-ticker {
  font-family: 'Outfit', monospace;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
  line-height: 1;
}
.term-stock-price-wrap { text-align: right; }
.term-stock-price {
  font-family: 'Outfit', monospace;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.term-stock-subgrid {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}
.term-stock-subgrid span { font-size: 0.78rem; }
.term-stock-subgrid strong { color: var(--text-primary); }

/* ── Key Points ─────────────────────────────────────────── */
.term-keypoints {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.term-kp {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 0.82rem;
  line-height: 1.5;
}
.term-kp:last-child { border-bottom: none; }
.term-kp-icon {
  width: 18px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  margin-top: 0.1rem;
  flex-shrink: 0;
}
.kp-bull { background: rgba(16,185,129,.2);  color: #10b981; }
.kp-bear { background: rgba(239,68,68,.2);   color: #ef4444; }
.kp-neu  { background: rgba(156,163,175,.15); color: #9ca3af; }

/* ── News mini list inside stock detail ─────────────────── */
.term-news-mini {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.term-news-mini-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  cursor: pointer;
}
.term-news-mini-item:last-child { border-bottom: none; }
.term-news-mini-item:hover .term-news-title { color: var(--accent); }
.term-news-mini-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}

/* ── Deep Dive two-column ───────────────────────────────── */
.term-deepdive-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 700px) {
  .term-deepdive-grid { grid-template-columns: 1fr; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  #termContent { padding: 0.75rem 0.75rem 2rem; }
  .term-topbar  { padding: 0.5rem 0.75rem; gap: 0.5rem; }
  .term-search  { margin-left: 0; width: 100%; }
  .term-search input { flex: 1; width: auto; }
  .term-tab { padding: 0.55rem 0.7rem; font-size: 0.65rem; }
  .term-stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .term-stock-ticker { font-size: 1.25rem; }
  .term-stock-price  { font-size: 1.2rem; }
}
@media (max-width: 480px) {
  .term-stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .term-gauge-wrap  { gap: 1rem; }
  .term-gauge-score { font-size: 2.5rem; }
}
