/* Market ticker bar - Bloomberg-style horizontal scroll */
/* Shared look for both tabbed and freeform */

/* Row placed below weather/header in both tabbed and freeform */
.ticker-bar-row {
  width: 100%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--theme-widget-header-bg, rgba(10, 12, 22, 0.98));
  border-bottom: 1px solid var(--theme-border);
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 4px;
}

.ticker-bar-row:empty {
  min-height: 0;
}

/* Prevent flex layout from squishing the ticker (tabbed and freeform) */
#tickerBarRow.ticker-bar-row,
#tickerBarRowFreeform.ticker-bar-row {
  flex: 0 0 44px !important;
  min-height: 44px !important;
  height: 44px !important;
  max-height: 44px !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
}

/* When nothing is configured, hide the bar completely (overrides rules above) */
#tickerBarRow.ticker-bar-row.ticker-bar-hidden,
#tickerBarRowFreeform.ticker-bar-row.ticker-bar-hidden {
  display: none !important;
  min-height: 0 !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  flex: 0 0 0 !important;
  padding: 0 !important;
  border: none !important;
  margin: 0 !important;
  visibility: hidden !important;
}
#tickerBarRow .ticker-bar-wrap,
#tickerBarRow .ticker-container {
  min-height: 44px !important;
  align-items: center !important;
}

/* Freeform: ticker bar fixed directly below weather bar */
.ticker-bar-row-freeform {
  position: fixed;
  top: var(--dashboard-weather-bar-height, 60px);
  left: 0;
  right: 0;
  height: 44px;
  min-height: 44px;
  z-index: 998;
}

/* When freeform ticker is visible, push dashboard content below weather + ticker */
body.ticker-visible .dashboard.layout-freeform {
  padding-top: calc(var(--dashboard-weather-bar-height, 60px) + var(--dashboard-ticker-bar-height, 44px)) !important;
  min-height: calc(100vh - var(--dashboard-weather-bar-height, 60px) - var(--dashboard-ticker-bar-height, 44px)) !important;
}

.ticker-bar-wrap {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  overflow: hidden;
  display: flex;
  align-items: center;
  flex: 1;
}

.ticker-bar-wrap.ticker-empty {
  align-items: center;
  justify-content: center;
}

.ticker-bar-wrap.ticker-empty .ticker-empty-msg {
  font-size: clamp(0.7rem, 1.1vw, 0.85rem);
  color: var(--theme-text-muted);
  white-space: nowrap;
  padding: 0 12px;
}

.ticker-container {
  width: 100%;
  overflow: hidden;
  position: relative;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  padding-right: 100%;
  line-height: 1.35;
}

/* Short content: one copy, centered — avoids seeing the same symbols twice side-by-side */
.ticker-track.ticker-track--static {
  animation: none;
  padding-right: 0;
}

/* will-change only when animating - avoids layer bloat when paused */
.ticker-track.ticker-animate {
  animation: ticker-scroll 60s linear infinite;
}

/* PERFORMANCE: Pause ticker during widget drag/resize to eliminate jitter */
body.widget-interacting .ticker-track.ticker-animate {
  animation-play-state: paused;
}

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

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  font-size: 0.9rem;
  color: var(--theme-text);
  flex-shrink: 0;
}

.ticker-item-sep {
  color: var(--theme-text-muted);
  opacity: 0.5;
  font-weight: 800;
  user-select: none;
  padding: 0 4px;
}

/* Stocks block: visually distinct from news */
.ticker-stocks-sep {
  color: var(--theme-text-muted);
  opacity: 0.7;
  font-weight: 800;
  user-select: none;
  padding: 0 10px;
  font-size: 1rem;
}

.ticker-stocks-block {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 4px 12px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.ticker-stock-item .ticker-symbol {
  font-weight: 800;
  color: var(--theme-accent, #5EEAD4);
  letter-spacing: 0.05em;
  font-size: 0.95rem;
}

.ticker-stock-item .ticker-price {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--theme-text);
  font-size: 0.92rem;
}

.ticker-symbol {
  font-weight: 800;
  color: var(--theme-text);
}

.ticker-price {
  font-variant-numeric: tabular-nums;
}

.ticker-change-up {
  color: #22c55e;
  font-weight: 800;
}

.ticker-change-down {
  color: #ef4444;
  font-weight: 800;
}

.ticker-arrow-up::before {
  content: '\25B2';
  font-size: 0.6em;
  margin-right: 2px;
}

.ticker-arrow-down::before {
  content: '\25BC';
  font-size: 0.6em;
  margin-right: 2px;
}

/* Full headlines – no truncation; they scroll with the ticker */
.ticker-news {
  color: var(--theme-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.ticker-news a {
  color: var(--theme-text);
  text-decoration: none;
  white-space: nowrap;
}

.ticker-news a:hover {
  text-decoration: underline;
  color: var(--theme-accent, #5EEAD4);
}

/* Settings widget: tracked stocks list */
.tracked-stocks-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tracked-stocks-list .tracked-stock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  margin: 4px 0;
  background: var(--theme-input-bg, rgba(0, 0, 0, 0.2));
  border-radius: 8px;
}

.tracked-stocks-list .ticker-remove-btn {
  padding: 4px 10px;
  font-size: 0.85rem;
}
