/* Global Color and Theme System */
:root {
  --bg-surface: #1e222d;
  --bg-card: #2a2e39;
  --text-main: #f2f3f5;
  --text-muted: #848e9c;
  --color-positive: #26a69a;
  --color-negative: #ef5350;
  --border-color: #363c4e;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Page Setup */
body {
  background-color: #131722;
  font-family: var(--font-family);
  padding: 40px 20px;
  display: flex;
  flex-direction: column; /* Stacks everything cleanly downwards */
  align-items: center;
  gap: 24px;              /* Ensures perfect matching distance between sections */
  margin: 0;
  min-height: 100vh;
}

/* ==========================================
   1. TOP MARKET INDICES SECTION 
   ========================================== */
.indices-container {
  display: flex;
  justify-content: space-between;
  width: 360px;
  box-sizing: border-box;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.index-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.index-name {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.index-price {
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
}

.index-change {
  font-size: 11px;
  font-weight: 500;
}


/* ==========================================
   2. CONTAINERS (MAG 7 & CRYPTO BOXES)
   ========================================== */
/* This shared class ensures both watchlists look identical */
.mag7-container, 
.crypto-container {
  width: 360px;
  box-sizing: border-box;
  background-color: var(--bg-surface);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* Header structural alignment for both blocks */
.mag7-header,
.crypto-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.header-title h3 {
  color: var(--text-main);
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  display: inline-block;
}

/* Badge Variations */
.badge {
  background-color: rgba(38, 166, 154, 0.1);
  color: var(--color-positive);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.crypto-badge {
  background-color: rgba(41, 182, 246, 0.1);
  color: #29b6f6;
}

.view-all-btn {
  background: none;
  border: none;
  color: #29b6f6;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: color 0.2s ease;
}

.view-all-btn:hover {
  text-decoration: underline;
  color: #4fc3f7;
}


/* ==========================================
   3. TICKER ROW LIST & CARDS
   ========================================== */
.ticker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ticker-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background-color: transparent;
  border-radius: 8px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.ticker-card:hover {
  background-color: var(--bg-card);
}

.ticker-info {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 35%;
}

.logo-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.symbol {
  display: block;
  color: var(--text-main);
  font-weight: 600;
  font-size: 14px;
}

.company-name {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 85px;
}


/* ==========================================
   4. SPARKLINE MINI-CHARTS
   ========================================== */
.mini-chart {
  width: 30%;
  height: 30px;
}

.sparkline {
  width: 100%;
  height: 100%;
}

.sparkline.positive path {
  stroke: var(--color-positive);
}

.sparkline.negative path {
  stroke: var(--color-negative);
}


/* ==========================================
   5. PRICE METRICS & UTILITIES
   ========================================== */
.ticker-metrics {
  text-align: right;
  width: 35%;
}

.price {
  display: block;
  color: var(--text-main);
  font-weight: 600;
  font-size: 14px;
}

.change {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}

/* Performance Color Utility */
.positive, .index-change.positive {
  color: var(--color-positive);
}

.negative, .index-change.negative {
  color: var(--color-negative);
}