/* ============================================================
   Ticker Vote Widget — Karma Fas 14
   CSS variables: --card-bg, --border-color, --text-primary,
                  --text-secondary, --primary-color
   ============================================================ */

/* ─── Panel ─────────────────────────────────────────────────── */
.market-predictions-panel {
  background: var(--surface-color, var(--card-bg, #1a1a2e));
  border: 1px solid var(--border-color, #2a2a4a);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.market-predictions-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.market-predictions-panel .panel-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-primary, #e2e8f0);
}

/* ─── Cast Vote Form ─────────────────────────────────────────── */
.cast-vote-form {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color, #2a2a4a);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.vote-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.vote-form-row:last-child { margin-bottom: 0; }

.cast-vote-form input[type="text"] {
  flex: 1;
  min-width: 120px;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #2a2a4a);
  background: var(--surface-color, #1a1a2e);
  color: var(--text-primary, #e2e8f0);
  font-size: 0.9rem;
  outline: none;
}

.cast-vote-form input[type="text"]:focus {
  border-color: var(--primary-color, #6366f1);
}

.cast-vote-form select {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #2a2a4a);
  background: var(--surface-color, #1a1a2e);
  color: var(--text-primary, #e2e8f0);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}

/* ─── Bull/Bear Buttons ──────────────────────────────────────── */
.vote-dir-btn {
  padding: 7px 16px;
  border-radius: 6px;
  border: 2px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
}

.vote-dir-btn.bull {
  border-color: #10b981;
  color: #10b981;
}

.vote-dir-btn.bull:hover,
.vote-dir-btn.bull.active {
  background: #10b981;
  color: #fff;
}

.vote-dir-btn.bear {
  border-color: #ef4444;
  color: #ef4444;
}

.vote-dir-btn.bear:hover,
.vote-dir-btn.bear.active {
  background: #ef4444;
  color: #fff;
}

/* ─── Cast Vote Submit ───────────────────────────────────────── */
.cast-vote-submit-btn {
  padding: 7px 20px;
  border-radius: 6px;
  border: none;
  background: var(--primary-color, #6366f1);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  margin-left: auto;
}

.cast-vote-submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cast-vote-submit-btn:not(:disabled):hover {
  background: #4f46e5;
}

/* ─── Prediction Tabs ────────────────────────────────────────── */
.prediction-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color, #2a2a4a);
  padding-bottom: 10px;
}

.pred-tab {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.pred-tab:hover {
  border-color: var(--border-color, #2a2a4a);
  color: var(--text-primary, #e2e8f0);
}

.pred-tab.active {
  border-color: var(--primary-color, #6366f1);
  color: var(--primary-color, #6366f1);
  background: rgba(99,102,241,0.1);
}

/* ─── Prediction Feed ────────────────────────────────────────── */
.prediction-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
}

.pred-row {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color, #2a2a4a);
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
}

.pred-row.bull { border-left-color: #10b981; }
.pred-row.bear { border-left-color: #ef4444; }

.pred-row-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.pred-row-bottom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.83rem;
}

.pred-dir {
  font-weight: 700;
  font-size: 0.85rem;
}
.pred-dir.bull { color: #10b981; }
.pred-dir.bear { color: #ef4444; }

.pred-ticker {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary, #e2e8f0);
}

.pred-user {
  font-size: 0.82rem;
  color: var(--text-secondary, #94a3b8);
}

.wilson-badge {
  font-size: 0.78rem;
  color: var(--primary-color, #6366f1);
  background: rgba(99,102,241,0.12);
  border-radius: 4px;
  padding: 2px 6px;
}

.pred-price { color: var(--text-secondary, #94a3b8); }

.vote-pl {
  font-weight: 600;
  font-size: 0.85rem;
}
.vote-pl.positive { color: #10b981; }
.vote-pl.negative { color: #ef4444; }

.vote-status {
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 7px;
}
.vote-status.pending { color: #f59e0b; background: rgba(245,158,11,0.1); }
.vote-status.win { color: #10b981; background: rgba(16,185,129,0.1); }
.vote-status.loss { color: #ef4444; background: rgba(239,68,68,0.1); }
.vote-status.draw { color: var(--text-secondary, #94a3b8); background: rgba(148,163,184,0.1); }

/* ─── Leaderboard ────────────────────────────────────────────── */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color, #2a2a4a);
  border-radius: 8px;
}

.lb-rank {
  font-size: 1.1rem;
  min-width: 28px;
  text-align: center;
}

.lb-user {
  font-weight: 600;
  min-width: 110px;
  color: var(--text-primary, #e2e8f0);
}

.lb-stats {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lb-wilson-bar-wrap {
  flex: 1;
  min-width: 60px;
  max-width: 160px;
  height: 6px;
  background: var(--border-color, #2a2a4a);
  border-radius: 3px;
  overflow: hidden;
}

.lb-wilson-bar {
  height: 100%;
  background: var(--primary-color, #6366f1);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.lb-wilson-score {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--primary-color, #6366f1);
}

.lb-raw {
  font-size: 0.82rem;
  color: var(--text-secondary, #94a3b8);
}

/* ─── States ─────────────────────────────────────────────────── */
.pred-loading, .pred-empty, .pred-error {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.9rem;
}

.pred-error { color: #ef4444; }

/* ─── Light Theme Overrides ──────────────────────────────────── */
body.theme-light .market-predictions-panel,
body.light-theme .market-predictions-panel {
  background: #ffffff;
  border-color: #e2e8f0;
}

body.theme-light .cast-vote-form,
body.light-theme .cast-vote-form {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.theme-light .cast-vote-form input[type="text"],
body.theme-light .cast-vote-form select,
body.light-theme .cast-vote-form input[type="text"],
body.light-theme .cast-vote-form select {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
}

body.theme-light .pred-row,
body.light-theme .pred-row {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.theme-light .leaderboard-row,
body.light-theme .leaderboard-row {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.theme-light .lb-wilson-bar-wrap,
body.light-theme .lb-wilson-bar-wrap {
  background: #e2e8f0;
}

body.theme-light .pred-tab,
body.light-theme .pred-tab {
  color: #64748b;
}

body.theme-light .pred-tab.active,
body.light-theme .pred-tab.active {
  color: var(--primary-color, #6366f1);
}

/* Blue Theme Overrides */
body.theme-blue .cast-vote-form input[type="text"],
body.theme-blue .cast-vote-form select {
  background: #ffffff;
  border-color: #90caf9;
  color: #0d47a1;
}

body.theme-blue .cast-vote-form input[type="text"]:focus {
  border-color: #1976d2;
}

body.theme-blue .cast-vote-form {
  background: rgba(13,71,161,0.05);
  border-color: #90caf9;
}
