/* sentiment.css — Sentiment card + news styles */

/* --- Sentiment Card --- */
.sentiment-card {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  min-height: 380px;
}

/* Spinner overlay for refresh */
.sentiment-spinner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  z-index: 2;
}

.sentiment-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

body.dark .sentiment-spinner-overlay {
  background: rgba(22, 27, 34, 0.7);
}

body.dark .sentiment-spinner {
  border-color: #30363d;
  border-top-color: #58a6ff;
}

.sentiment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sentiment-header .chart-section-title {
  margin: 0;
}

.sentiment-refresh-btn {
  background: none;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 1.1rem;
  cursor: pointer;
  color: #555;
  transition: all 0.2s;
}

.sentiment-refresh-btn:hover {
  background: #f0f0f0;
  color: #111;
}

.sentiment-loading {
  color: #888;
  font-size: 0.9rem;
}

.sentiment-error {
  color: #ef4444;
  font-size: 0.9rem;
}

/* Overall sentiment */
.sentiment-overall {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 12px;
}

.sentiment-icon {
  font-size: 1.8rem;
}

.sentiment-label {
  font-size: 1.4rem;
  font-weight: 700;
}

.sentiment-class {
  font-size: 0.85rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.sentiment-overall.bullish .sentiment-label { color: #16a34a; }
.sentiment-overall.bullish .sentiment-class { background: #dcfce7; color: #16a34a; }
.sentiment-overall.bearish .sentiment-label { color: #dc2626; }
.sentiment-overall.bearish .sentiment-class { background: #fee2e2; color: #dc2626; }
.sentiment-overall.neutral-s .sentiment-label { color: #6b7280; }
.sentiment-overall.neutral-s .sentiment-class { background: #f3f4f6; color: #6b7280; }

/* Score bar */
.sentiment-score-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.score-label {
  font-size: 0.8rem;
  color: #888;
  min-width: 38px;
}

.score-track {
  flex: 1;
  height: 8px;
  background: linear-gradient(to right, #ef4444 0%, #f59e0b 30%, #6b7280 50%, #22c55e 70%, #16a34a 100%);
  border-radius: 4px;
  position: relative;
}

.score-fill {
  display: none;
}

.score-marker {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 16px;
  background: #1a1a2e;
  border-radius: 2px;
  transform: translateX(-50%);
}

.score-value {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 44px;
  text-align: right;
}

/* Breakdown bars */
.sentiment-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breakdown-label {
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 50px;
}

.bullish-text { color: #16a34a; }
.bearish-text { color: #dc2626; }
.neutral-text { color: #6b7280; }

.breakdown-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.breakdown-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.bullish-fill { background: #22c55e; }
.bearish-fill { background: #ef4444; }
.neutral-fill { background: #9ca3af; }

.breakdown-pct {
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 32px;
  text-align: right;
  color: #555;
}

/* Meta */
.sentiment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
  color: #888;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.sentiment-time {
  margin-left: auto;
}

.sentiment-disclaimer {
  font-size: 0.65rem;
  color: #aaa;
  margin: 6px 0 0 0;
  font-style: italic;
  text-align: center;
}

body.dark .sentiment-disclaimer {
  color: #555;
}

/* --- Sentiment News --- */
.sentiment-news {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.sentiment-news-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
}

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

.news-item-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: #1a1a2e;
  text-decoration: none;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-item-title:hover {
  color: #2563eb;
  text-decoration: underline;
}

.news-item-meta {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
  color: #888;
  margin-top: 4px;
}

.news-item-sentiment {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.sentiment-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-bullish { background: #dcfce7; color: #16a34a; }
.badge-bearish { background: #fee2e2; color: #dc2626; }
.badge-neutral { background: #f3f4f6; color: #6b7280; }

.sentiment-score-small {
  font-size: 0.72rem;
  color: #888;
  font-weight: 500;
}

.sentiment-no-news {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
}

/* --- Dark Theme --- */
body.dark .sentiment-card {
  background: #161b22;
  border-color: #30363d;
}

body.dark .sentiment-refresh-btn {
  border-color: #30363d;
  color: #8b949e;
}

body.dark .sentiment-refresh-btn:hover {
  background: #21262d;
  color: #e0e0e0;
}

body.dark .sentiment-overall {
  border-bottom-color: #30363d;
}

body.dark .score-marker {
  background: #e0e0e0;
}

body.dark .score-value {
  color: #e0e0e0;
}

body.dark .breakdown-bar {
  background: #30363d;
}

body.dark .breakdown-pct {
  color: #8b949e;
}

body.dark .sentiment-meta {
  border-top-color: #30363d;
}

body.dark .sentiment-news {
  background: #30363d;
}

body.dark .sentiment-news-item {
  background: #161b22;
}

body.dark .news-item-title {
  color: #e0e0e0;
}

body.dark .news-item-title:hover {
  color: #58a6ff;
}
