/* ============================================================
   Uranium Tracker — Dark Financial Dashboard Theme
   ============================================================ */

:root {
  --bg-primary: #0f1117;
  --bg-card: #1a1d27;
  --bg-card-hover: #1e2132;
  --bg-header: #111420;
  --accent-green: #00c853;
  --accent-green-dim: #00973d;
  --accent-red: #f44336;
  --accent-red-dim: #b71c1c;
  --accent-yellow: #ffc107;
  --accent-blue: #2979ff;
  --text-primary: #e8eaf6;
  --text-secondary: #9e9eb5;
  --text-muted: #5c5f78;
  --border: #252840;
  --border-bright: #353860;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ============================================================
   Layout
   ============================================================ */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.site-title span {
  color: var(--accent-green);
}

.header-spot {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spot-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.spot-price {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.spot-price.loading {
  background: var(--border);
  border-radius: 4px;
  color: transparent;
  min-width: 100px;
  animation: pulse 1.5s ease-in-out infinite;
}

.change-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.change-badge.up {
  background: rgba(0, 200, 83, 0.15);
  color: var(--accent-green);
}

.change-badge.down {
  background: rgba(244, 67, 54, 0.15);
  color: var(--accent-red);
}

.change-badge.flat {
  background: rgba(158, 158, 181, 0.15);
  color: var(--text-secondary);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.refresh-countdown {
  display: flex;
  align-items: center;
  gap: 5px;
}

.countdown-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ============================================================
   Main content
   ============================================================ */

.main-content {
  padding: 24px 0;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Two-column layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-bottom: 24px;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-title .icon {
  font-size: 1rem;
}

/* ============================================================
   Chart
   ============================================================ */

.chart-container {
  position: relative;
  height: 260px;
}

.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 260px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* ============================================================
   News feed
   ============================================================ */

.news-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.news-feed::-webkit-scrollbar {
  width: 4px;
}

.news-feed::-webkit-scrollbar-track {
  background: transparent;
}

.news-feed::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.news-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.news-item:last-child {
  border-bottom: none;
}

.news-item:hover {
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  padding-left: 6px;
  padding-right: 6px;
  margin: 0 -6px;
}

.sentiment-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.sentiment-dot.bullish { background: var(--accent-green); }
.sentiment-dot.somewhat-bullish { background: #69f0ae; }
.sentiment-dot.bearish { background: var(--accent-red); }
.sentiment-dot.somewhat-bearish { background: #ff7043; }
.sentiment-dot.neutral, .sentiment-dot.unknown { background: var(--text-muted); }

.news-content {
  flex: 1;
  min-width: 0;
}

.news-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-title a {
  color: inherit;
  text-decoration: none;
}

.news-title a:hover {
  color: var(--accent-green);
  text-decoration: underline;
}

.news-meta {
  display: flex;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.news-source {
  font-weight: 500;
}

.news-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 20px 0;
  text-align: center;
}

/* ============================================================
   Stock grid
   ============================================================ */

.stocks-section {
  margin-top: 4px;
}

.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.stock-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: default;
}

.stock-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.stock-card.positive {
  border-left: 3px solid var(--accent-green-dim);
}

.stock-card.negative {
  border-left: 3px solid var(--accent-red-dim);
}

.stock-card.flat {
  border-left: 3px solid var(--text-muted);
}

.stock-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.stock-ticker {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.stock-change {
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.stock-change.positive { color: var(--accent-green); }
.stock-change.negative { color: var(--accent-red); }
.stock-change.flat { color: var(--text-muted); }

.stock-price {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-bottom: 10px;
}

.stock-prev-close {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.sparkline-container {
  height: 42px;
}

/* ============================================================
   Loading states
   ============================================================ */

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.skeleton {
  background: var(--border);
  border-radius: 4px;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.loading-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  height: 140px;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================================
   Error state
   ============================================================ */

.error-message {
  color: var(--accent-red);
  font-size: 0.83rem;
  padding: 12px;
  background: rgba(244, 67, 54, 0.08);
  border: 1px solid rgba(244, 67, 54, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   Status bar (bottom of header)
   ============================================================ */

.status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
}

.status-indicator.error {
  background: var(--accent-red);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .news-feed {
    max-height: 260px;
  }
}

@media (max-width: 600px) {
  .site-title {
    font-size: 1.15rem;
  }

  .spot-price {
    font-size: 1.4rem;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-meta {
    width: 100%;
    justify-content: space-between;
  }

  .stock-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .container {
    padding: 0 12px;
  }
}

@media (max-width: 400px) {
  .stock-grid {
    grid-template-columns: 1fr 1fr;
  }
}
