/* ============================================================
   AssamPolls — dashboard.css
   Homepage dashboard — panels, charts, heatmap, ticker
   Extends style.css (must be loaded after it)
   ============================================================ */

/* ============================================================
   TICKER
   ============================================================ */
.ap-ticker {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 9px 0;
  overflow: hidden;
  position: relative;
}
.ap-ticker::before,
.ap-ticker::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 48px;
  z-index: 2;
  pointer-events: none;
}
.ap-ticker::before { left: 0;  background: linear-gradient(to right,  var(--bg2), transparent); }
.ap-ticker::after  { right: 0; background: linear-gradient(to left,   var(--bg2), transparent); }

.ticker-inner {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
}
.ticker-label {
  flex-shrink: 0;
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 12px;
  border-radius: 3px;
  margin-right: 16px;
  margin-left: 16px;
}
.ticker-track { flex: 1; overflow: hidden; }
#ticker-items {
  display: flex;
  gap: 40px;
  white-space: nowrap;
  animation: ticker-scroll 28s linear infinite;
}
.ticker-item     { font-size: 13px; color: var(--text2); }
.ticker-item strong { color: var(--text); }
.tick-up { color: var(--green); font-weight: 600; }
.tick-dn { color: var(--red);   font-weight: 600; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============================================================
   HERO
   ============================================================ */
.dash-hero {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 36px 0 28px;
  position: relative;
  overflow: hidden;
}
.dash-hero::after {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(255,98,0,0.09) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.hero-headline {
  font-family: var(--font-head);
  font-size: clamp(26px, 4.5vw, 40px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 8px;
}
.hero-headline .accent { color: var(--orange); }
.hero-sub {
  font-size: 15px;
  color: var(--text2);
  margin-bottom: 24px;
}
.hero-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.hero-chip {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text2);
}
.hero-chip strong { color: var(--text); }

/* Countdown */
.countdown-wrap { margin-bottom: 24px; }
.countdown      { display: flex; gap: 10px; flex-wrap: wrap; }
.countdown-unit { text-align: center; min-width: 60px; }
.countdown-num  {
  font-family: var(--font-head);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  color: var(--orange);
  display: block;
  line-height: 1;
}
.countdown-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-top: 4px;
}
.election-day-msg {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--orange);
}

/* Hero CTA row */
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Total votes hero display */
.total-hero {
  text-align: right;
}
.total-hero .total-num {
  font-family: var(--font-head);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -2px;
  line-height: 1;
}
.total-hero .total-label {
  font-size: 12px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.total-hero .total-today {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
  margin-top: 4px;
}

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dash-body { padding: 32px 0 60px; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
.dash-main  { min-width: 0; }
.dash-aside { min-width: 0; }

/* Section headings */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
}
.section-meta {
  font-size: 11px;
  color: var(--text3);
}

/* Refresh indicator */
.refresh-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--text3);
}
.refresh-dot {
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.3s;
}
#refresh-indicator { display: flex; align-items: center; gap: 6px; }

/* ============================================================
   PARTY STAT CARDS
   ============================================================ */
#party-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.party-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
}
.party-stat-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}
.psc-accent {
  height: 3px;
  width: 100%;
}
.psc-body { padding: 14px 16px; }
.psc-name  { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.psc-pct   { font-family: var(--font-head); font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.psc-count { font-size: 11px; color: var(--text3); margin-top: 3px; }
.psc-trend { font-size: 12px; font-weight: 600; margin-top: 8px; }
.trend-up   { color: var(--green); }
.trend-dn   { color: var(--red);   }
.trend-flat { color: var(--text3); }
.psc-bar-wrap { height: 3px; background: var(--bg3); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.psc-bar-fill { height: 100%; border-radius: 2px; transition: width 0.8s ease; }

/* ============================================================
   CHARTS ROW
   ============================================================ */
.charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.chart-panel-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 14px;
}

/* ============================================================
   HEATMAP
   ============================================================ */
.heatmap-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.zone-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 16px;
}
.zone-tab {
  flex: 1;
  text-align: center;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: transparent;
}
.zone-tab:hover  { color: var(--text2); }
.zone-tab.active { background: var(--surface2); color: var(--text); }

#heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 4px;
  margin-bottom: 14px;
}
.heat-cell {
  aspect-ratio: 1.4;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, filter 0.15s;
}
.heat-cell:hover {
  transform: scale(1.08);
  z-index: 5;
  filter: brightness(1.2);
}
.heat-label {
  font-size: 8px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  text-align: center;
  line-height: 1.2;
  padding: 0 3px;
}
.heat-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px 12px;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text);
  z-index: 100;
  line-height: 1.6;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.heat-cell:hover .heat-tooltip { display: block; }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text3);
}
.legend-bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right, #1B6FDE, #888888, #FF6200);
}

/* ============================================================
   ISSUES
   ============================================================ */
.issues-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.issue-row { margin-bottom: 12px; }
.issue-row:last-child { margin-bottom: 0; }
.issue-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.issue-row-icon { font-size: 14px; flex-shrink: 0; }
.issue-row-name { flex: 1; font-size: 13px; color: var(--text2); }
.issue-row-pct  { font-size: 13px; font-weight: 600; color: var(--text); min-width: 40px; text-align: right; }
.issue-bar-bg   { height: 3px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.issue-bar-fg   { height: 100%; background: var(--orange); border-radius: 2px; transition: width 0.7s ease; }

/* ============================================================
   PREDICTION
   ============================================================ */
.prediction-panel {
  background: linear-gradient(135deg, var(--surface), var(--bg3));
  border: 1px solid var(--orange-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.pred-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.pred-row:last-of-type { margin-bottom: 14px; }
.pred-party    { font-size: 13px; font-weight: 600; min-width: 80px; }
.pred-bar-wrap { flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.pred-bar-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }
.pred-seats    { font-family: var(--font-head); font-size: 14px; font-weight: 700; min-width: 50px; text-align: right; }
#pred-confidence {
  font-size: 11px;
  color: var(--text3);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ============================================================
   ASIDE — LEADERS, MOMENTUM
   ============================================================ */
.aside-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  margin-bottom: 16px;
}

/* Leaders */
.leader-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.leader-row:last-child { border-bottom: none; }
.leader-rank   { font-family: var(--font-head); font-size: 14px; font-weight: 700; color: var(--text3); width: 22px; flex-shrink: 0; }
.leader-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.leader-info   { flex: 1; min-width: 0; }
.leader-name   { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-role   { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-mini-bar { height: 2px; background: var(--bg3); border-radius: 1px; margin-top: 4px; overflow: hidden; }
.leader-mini-fill { height: 100%; border-radius: 1px; }
.leader-score  { font-family: var(--font-head); font-size: 15px; font-weight: 700; flex-shrink: 0; }

/* Momentum */
.momentum-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.momentum-row:last-child { border-bottom: none; }
.mom-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mom-info { flex: 1; }
.mom-name { font-size: 13px; font-weight: 500; color: var(--text); }
.mom-note { font-size: 11px; color: var(--text3); }
.mom-val  { font-family: var(--font-head); font-size: 14px; font-weight: 700; }
.mom-up   { color: var(--green); }
.mom-dn   { color: var(--red);   }
.mom-flat { color: var(--text3); }

/* Majority indicator */
.majority-indicator {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text2);
  text-align: center;
  margin-bottom: 16px;
}
.majority-num {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 800;
  color: var(--orange);
  display: block;
}

/* Cast vote CTA aside */
.vote-cta-aside {
  background: linear-gradient(135deg, rgba(255,98,0,0.12), rgba(255,98,0,0.05));
  border: 1px solid var(--orange-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}
.vote-cta-aside h4 {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.vote-cta-aside p {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ============================================================
   CONSTITUENCY MODAL
   ============================================================ */
#const-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 360px;
  position: relative;
}
.modal-close-btn {
  position: absolute;
  top: 16px; right: 16px;
  width: 28px; height: 28px;
  background: var(--surface2);
  border: none;
  border-radius: 50%;
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal-close-btn:hover { background: var(--surface3); color: var(--text); }
.modal-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.modal-stat-row:last-child { border-bottom: none; }
.modal-stat-label { color: var(--text3); }
.modal-stat-value { color: var(--text); font-weight: 600; }

/* ============================================================
   DISCLAIMER BAR
   ============================================================ */
.disclaimer-bar {
  background: rgba(245,158,11,0.07);
  border-top: 1px solid rgba(245,158,11,0.15);
  padding: 10px 0;
  font-size: 11px;
  color: #ca8a04;
  text-align: center;
  line-height: 1.5;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .dash-grid    { grid-template-columns: 1fr; }
  .dash-aside   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .aside-panel  { margin-bottom: 0; }
}
@media (max-width: 768px) {
  .charts-row   { grid-template-columns: 1fr; }
  .dash-aside   { grid-template-columns: 1fr; }
  .dash-hero    { padding: 24px 0 20px; }
  #party-cards  { grid-template-columns: repeat(2, 1fr); }
  .total-hero   { text-align: left; margin-top: 16px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
}
@media (max-width: 480px) {
  #heatmap-grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
  .heat-cell    { aspect-ratio: 1; }
  .heat-label   { font-size: 7px; }
}
