/* --- Design Tokens --- */
:root {
  --radius: 10px;
  --space-sm: 6px;
  --space-md: 12px;
  --space-lg: 20px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.1);

  --bg-card: #ffffff;
  --bg-surface: #fafafa;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
}

/* Dark theme */
[data-theme="dark"] {
  --bg-card: #1f2937;
  --bg-surface: #111827;
  --border: #374151;
  --text: #f9fafb;
  --text-muted: #9ca3af;
}

/* --- Global Styles --- */
body {
  font-family: sans-serif;
  color: var(--text);
  background: var(--bg-surface);
  margin: 0;
  padding: var(--space-lg);
  transition: background 0.2s, color 0.2s;
}
h1, h2 { margin-bottom: var(--space-md); }
.large-text { font-size: 28px; font-weight: 600; transition: color 0.2s; }

/* --- Header Navigation --- */
.header-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.header-nav {
  display: flex;
  gap: var(--space-md);
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-card);
}

.nav-link.active {
  color: var(--text);
  background: var(--bg-card);
  font-weight: 600;
}

/* --- Buttons --- */
.btn {
  padding: 6px 12px;
  border: 0;
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { opacity: 0.85; }
.btn.primary { background: #111827; color: #fff; }
[data-theme="dark"] .btn.primary { background: #f9fafb; color: #111827; }
.btn.dark { background: #374151; color: #fff; }
.btn.light { background: var(--border); color: var(--text); }

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: background 0.2s, box-shadow 0.2s, border 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }

/* --- Grid --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
}

/* --- Forms --- */
form input[type="text"] {
  flex: 1 1 260px;
  min-width: 200px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text);
  transition: background 0.2s, color 0.2s, border 0.2s;
}
form input[type="text"]::placeholder { color: var(--text-muted); }
form .flex { display: flex; gap: var(--space-md); flex-wrap: wrap; }

/* --- Analysis Section --- */
.analysis-section { margin-bottom: var(--space-lg); }
.analysis-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-sm);
  padding: 0;
  margin: 0;
  list-style: none;
}
.analysis-item {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s, border 0.2s, color 0.2s;
  cursor: default;
}
.analysis-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.analysis-item.bullish { border-color: #16a34a; color: #16a34a; font-weight: 600; }
.analysis-item.bearish { border-color: #dc2626; color: #dc2626; font-weight: 600; }

/* --- Weekly Digest --- */
.digest-card {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: background 0.2s, box-shadow 0.2s, border 0.2s;
}
.digest-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-sm);
}
.digest-title {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1rem;
  gap: 6px;
}
.digest-date { color: var(--text-muted); font-size: 0.85rem; transition: color 0.2s; }
.digest-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.digest-actions .btn {
  padding: 6px 8px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.digest-content {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: var(--space-md);
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
#wd-md { position: absolute; left: -9999px; top: -9999px; }

/* --- TradingView Mini Charts --- */
#tv-timeframe-5, #tv-timeframe-60, #tv-timeframe-1D,
[id^="tv-sym-"] { width: 100%; height: 360px; border: 1px solid var(--border); border-radius: var(--radius); transition: border 0.2s; }

/* --- Lucide Icons --- */
svg.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  stroke: currentColor;
  vertical-align: middle;
  transition: stroke 0.2s, color 0.2s;
}

/* --- Responsive Adjustments --- */
@media (max-width: 1024px) {
  body { padding: var(--space-md); }
  .grid { gap: var(--space-sm); }
  .analysis-item { padding: 8px 10px; font-size: 0.85rem; }
}
@media (max-width: 768px) {
  .dashboard-header { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
  form .flex { flex-direction: column; }
  .digest-header { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
}
@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  .large-text { font-size: 22px; }
}
/* --- Fear & Greed Bar --- */
.fg-bar-container {
    width: 100%;
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    /* full gradient background from red → yellow → green */
    background: linear-gradient(to right, #dc2626 0%, #fbbf24 50%, #16a34a 100%);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.fg-bar {
    height: 100%;
    width: 0%;              /* starts empty */
    border-radius: 8px;
    transition: width 0.8s ease, background 0.5s ease;
    background-color: transparent; /* fill will be set dynamically by JS */
}


/* Colors based on classification */
.fg-bar.fear { background-color: #dc2626; }
.fg-bar.greed { background-color: #16a34a; }
.fg-bar.neutral { background-color: #fbbf24; }

.fg-class.fear { background-color: #dc2626; }
.fg-class.greed { background-color: #16a34a; }
.fg-class.neutral { background-color: #fbbf24; }

/* --- Footer Styles --- */
.dashboard-footer {
  margin-top: var(--space-lg);
  padding: var(--space-lg) 0 0;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  transition: background 0.2s, border 0.2s;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  padding: 0 0 var(--space-lg);
}

.footer-section h4 {
  margin: 0 0 var(--space-sm);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s;
}

.footer-section p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  transition: color 0.2s;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--text);
}

.disclaimer {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
  font-style: italic;
}

.footer-bottom {
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border);
  text-align: center;
  transition: border 0.2s;
}

.footer-bottom p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

/* Footer responsive adjustments */
@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .footer-section {
    text-align: center;
  }
}
.delta-row { margin-top: 6px; }
.badge {
  display:inline-block;
  padding:4px 8px;
  border-radius:9999px;
  font-weight:600;
  font-size:12px;
  line-height:1;
  background:#e5e7eb; /* fallback gray */
  color:#374151;
  border:1px solid #e5e7eb;
  cursor:default;
}

