/* ================================================================
   StockPulse — Indian Stock Market Dashboard
   Premium dark trading terminal — No TradingView dependency
   Charts: Lightweight Charts | Data: Yahoo Finance
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(24, 34, 56, 0.8);
  --bg-glass: rgba(17, 24, 39, 0.5);
  --border-subtle: rgba(55, 65, 81, 0.5);
  --border-glow-green: rgba(0, 230, 118, 0.3);
  --border-glow-red: rgba(239, 83, 80, 0.3);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --green: #00e676;
  --green-dim: rgba(0, 230, 118, 0.15);
  --red: #ef5350;
  --red-dim: rgba(239, 83, 80, 0.15);
  --yellow: #ffd54f;
  --yellow-dim: rgba(255, 213, 79, 0.15);
  --blue: #42a5f5;
  --blue-dim: rgba(66, 165, 245, 0.15);
  --purple: #ab47bc;
  --orange: #ff9800;
  --orange-dim: rgba(255, 152, 0, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow-green: 0 0 30px rgba(0, 230, 118, 0.15);
  --shadow-glow-red: 0 0 30px rgba(239, 83, 80, 0.15);
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 230, 118, 0.04), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(66, 165, 245, 0.03), transparent);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

/* ---- Custom Ticker Tape ---- */
.ticker-tape-wrapper {
  width: 100%;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(10px);
  overflow: hidden;
  height: 42px;
}

.ticker-tape {
  display: flex;
  align-items: center;
  height: 100%;
  position: relative;
}

.ticker-track {
  display: flex;
  gap: 32px;
  animation: tickerScroll 60s linear infinite;
  white-space: nowrap;
  padding: 0 16px;
}

@keyframes tickerScroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.ticker-symbol {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.ticker-price {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-secondary);
}

.ticker-change {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.78rem;
}

.ticker-change.up {
  color: var(--green);
}

.ticker-change.down {
  color: var(--red);
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.logo span {
  background: linear-gradient(135deg, var(--green), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-wrapper {
  position: relative;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.search-bar:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 15px rgba(66, 165, 245, 0.15);
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  width: 260px;
  font-weight: 500;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar button,
.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.search-bar button:hover,
.icon-btn:hover {
  background: var(--blue-dim);
  color: var(--blue);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.market-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.open {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.closed {
  background: var(--red);
}

.status-sep {
  color: var(--border-subtle);
  margin: 0 4px;
}

.current-time {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ---- Autocomplete ---- */
.autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 200;
  max-height: 360px;
  overflow-y: auto;
  min-width: 400px;
}

.autocomplete-dropdown.show {
  display: block;
  animation: acSlide 0.2s ease;
}

@keyframes acSlide {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.autocomplete-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(55, 65, 81, 0.2);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: var(--bg-card-hover);
}

.autocomplete-item.no-result {
  color: var(--text-muted);
  cursor: default;
  justify-content: center;
  font-size: 0.85rem;
}

.ac-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ac-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.ac-exchange {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--orange-dim);
  color: var(--orange);
}

.ac-right {
  text-align: right;
}

.ac-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
}

.ac-sector {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---- Main Layout ---- */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  grid-template-rows: auto auto auto auto;
  gap: 16px;
  padding: 16px 24px;
  max-width: 1920px;
  margin: 0 auto;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.3s;
}

.card:hover {
  border-color: rgba(66, 165, 245, 0.2);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 1.1rem;
}

.card-body {
  padding: 16px 18px;
}

.data-source-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--green-dim);
  color: var(--green);
  letter-spacing: 0.3px;
}

/* ---- Chart Section ---- */
.chart-section {
  grid-column: 1;
  grid-row: 1 / 3;
  min-height: 560px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.chart-symbol {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-company-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 4px;
}

.toolbar-spacer {
  flex: 1;
}

.exchange-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.exchange-badge.nse {
  background: var(--orange-dim);
  color: var(--orange);
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.exchange-badge.us {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(66, 165, 245, 0.3);
}

.tf-btn {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.2s;
}

.tf-btn:hover {
  background: var(--blue-dim);
  color: var(--blue);
  border-color: var(--blue);
}

.tf-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.chart-container {
  height: 400px;
  width: 100%;
}

.volume-container {
  height: 80px;
  width: 100%;
  border-top: 1px solid var(--border-subtle);
}

/* ---- Signal Panel ---- */
.signal-section {
  grid-column: 2;
  grid-row: 1;
}

.signal-main {
  text-align: center;
  padding: 20px 18px;
}

.signal-badge {
  display: inline-block;
  padding: 8px 24px;
  border-radius: 100px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
  animation: signalPulse 3s ease-in-out infinite;
}

.signal-badge.strong-buy {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--border-glow-green);
  box-shadow: var(--shadow-glow-green);
}

.signal-badge.buy {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(102, 187, 106, 0.3);
}

.signal-badge.neutral {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid rgba(255, 213, 79, 0.3);
}

.signal-badge.sell {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239, 83, 80, 0.3);
}

.signal-badge.strong-sell {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--border-glow-red);
  box-shadow: var(--shadow-glow-red);
}

@keyframes signalPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.03);
  }
}

.signal-price-block {
  margin-bottom: 16px;
}

#signal-price {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.price-change {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 4px;
  display: block;
}

.price-change.up {
  color: var(--green);
}

.price-change.down {
  color: var(--red);
}

.confidence-section {
  margin: 16px 0;
}

.confidence-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.confidence-label {
  color: var(--text-secondary);
}

#confidence-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.confidence-track {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

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

.confidence-fill.strong-buy,
.confidence-fill.buy {
  background: linear-gradient(90deg, #00e676, #66bb6a);
}

.confidence-fill.neutral {
  background: linear-gradient(90deg, #ffd54f, #ffb300);
}

.confidence-fill.sell,
.confidence-fill.strong-sell {
  background: linear-gradient(90deg, #ef5350, #d50000);
}

.score-gauge-container {
  display: flex;
  justify-content: center;
  margin: 20px 0 10px;
}

.score-gauge {
  width: 140px;
  height: 70px;
  position: relative;
  overflow: hidden;
}

.score-gauge::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 140px;
  height: 70px;
  border-radius: 70px 70px 0 0;
  background: conic-gradient(from 180deg, var(--red) 0deg, var(--yellow) 90deg, var(--green) 180deg);
  opacity: 0.3;
}

.score-gauge::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 4px;
  height: 50px;
  background: var(--text-primary);
  border-radius: 2px;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(calc(var(--rotation, 90deg) - 90deg));
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-mono);
}

.action-text {
  font-size: 0.9rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: 12px;
  line-height: 1.5;
}

.action-text.strong-buy,
.action-text.buy {
  background: var(--green-dim);
  border: 1px solid rgba(0, 230, 118, 0.15);
}

.action-text.neutral {
  background: var(--yellow-dim);
  border: 1px solid rgba(255, 213, 79, 0.15);
}

.action-text.sell,
.action-text.strong-sell {
  background: var(--red-dim);
  border: 1px solid rgba(239, 83, 80, 0.15);
}

.action-icon {
  font-size: 1.1rem;
}

/* ---- Watchlist ---- */
.watchlist-section {
  grid-column: 2;
  grid-row: 2;
  max-height: 400px;
}

.watchlist-items {
  max-height: 340px;
  overflow-y: auto;
}

.watchlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid rgba(55, 65, 81, 0.3);
}

.watchlist-item:hover {
  background: var(--bg-card-hover);
}

.watchlist-item.active {
  background: var(--blue-dim);
  border-left: 3px solid var(--blue);
}

.watchlist-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.watchlist-symbol {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.watchlist-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watchlist-signal {
  font-size: 0.8rem;
}

.watchlist-data {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.watchlist-price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
}

.watchlist-change {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
}

.watchlist-change.up {
  color: var(--green);
}

.watchlist-change.down {
  color: var(--red);
}

.watchlist-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.2s;
}

.watchlist-item:hover .watchlist-remove {
  opacity: 1;
}

.watchlist-remove:hover {
  color: var(--red);
  background: var(--red-dim);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--blue);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ---- Signal Details ---- */
.signal-detail-card {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 10px;
  transition: all 0.3s;
}

.signal-detail-card:hover {
  transform: translateY(-1px);
}

.signal-detail-card.strong-buy,
.signal-detail-card.buy {
  border-left: 3px solid var(--green);
}

.signal-detail-card.neutral {
  border-left: 3px solid var(--yellow);
}

.signal-detail-card.sell,
.signal-detail-card.strong-sell {
  border-left: 3px solid var(--red);
}

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

.detail-indicator {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.detail-badge {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 100px;
  font-weight: 600;
}

.detail-badge.strong-buy,
.detail-badge.buy {
  background: var(--green-dim);
  color: var(--green);
}

.detail-badge.neutral {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.detail-badge.sell,
.detail-badge.strong-sell {
  background: var(--red-dim);
  color: var(--red);
}

.detail-reason {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.detail-strength {
  display: flex;
  align-items: center;
  gap: 8px;
}

.strength-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.strength-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 30px;
  text-align: right;
}

/* ---- Sector Filter ---- */
.sector-section {
  grid-column: 2;
  grid-row: 3;
}

.sector-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.sector-btn {
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.sector-btn:hover {
  background: var(--blue-dim);
  color: var(--blue);
  border-color: var(--blue);
}

.sector-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.sector-stocks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.sector-stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.sector-stock-item:hover {
  background: var(--bg-card-hover);
}

.sector-stock-symbol {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.sector-stock-name {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---- Indicators ---- */
.indicators-section {
  grid-column: 1;
  grid-row: 3;
}

.indicators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.indicator-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  transition: all 0.3s;
}

.indicator-card:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
}

.indicator-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.indicator-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ema-grid,
.bb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ema-item,
.bb-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.ema-label,
.bb-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ema-val,
.bb-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ---- Bottom Row ---- */
.bottom-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---- Index / Mover Cards ---- */
.index-item,
.mover-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(55, 65, 81, 0.3);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: var(--radius-sm);
  padding-left: 8px;
  padding-right: 8px;
}

.index-item:hover,
.mover-item:hover {
  background: var(--bg-card-hover);
}

.index-item:last-child,
.mover-item:last-child {
  border-bottom: none;
}

.index-name,
.mover-symbol {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
}

.mover-name {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.index-price,
.mover-price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: right;
}

.index-change,
.mover-change {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}

.index-change.up,
.mover-change.up {
  color: var(--green);
}

.index-change.down,
.mover-change.down {
  color: var(--red);
}

.index-mini-chart {
  width: 60px;
  height: 30px;
}

/* ---- Loading ---- */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 23, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(4px);
}

.loading-overlay.active {
  display: flex;
}

.loader {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

.error-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239, 83, 80, 0.3);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2000;
  max-width: 400px;
}

.error-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ---- Gamma Blast Radar ---- */
.gamma-blast-section {
  grid-column: 1;
  grid-row: 3;
  border: 1px solid rgba(255, 152, 0, 0.2);
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.7), rgba(30, 20, 10, 0.4));
}

.gamma-scan-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--orange);
}

.gamma-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  animation: gammaPulse 4s ease-in-out infinite;
  box-shadow: 0 0 8px var(--orange);
}

@keyframes gammaPulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.3;
    transform: scale(0.7);
  }
}

.gamma-scan-label {
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

.gamma-blast-body {
  padding: 20px 18px;
}

.gamma-current {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
}

/* SVG Score Ring */
.gamma-score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.gamma-score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gamma-ring-bg {
  fill: none;
  stroke: rgba(55, 65, 81, 0.5);
  stroke-width: 8;
}

.gamma-ring-fill {
  fill: none;
  stroke: var(--orange);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.gamma-ring-fill.mild {
  stroke: var(--blue);
}

.gamma-ring-fill.elevated {
  stroke: var(--yellow);
}

.gamma-ring-fill.blast {
  stroke: var(--orange);
}

.gamma-ring-fill.extreme {
  stroke: var(--red);
  box-shadow: 0 0 20px var(--red);
}

.gamma-score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.gamma-score-num {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.gamma-score-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

.gamma-status-info {
  flex: 1;
}

.gamma-level {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.gamma-level.mild {
  color: var(--blue);
}

.gamma-level.elevated {
  color: var(--yellow);
}

.gamma-level.blast {
  color: var(--orange);
}

.gamma-level.extreme {
  color: var(--red);
  animation: blastFlash 0.5s ease-in-out infinite alternate;
}

.gamma-level.none {
  color: var(--text-muted);
}

@keyframes blastFlash {
  from {
    opacity: 1;
  }

  to {
    opacity: 0.6;
  }
}

.gamma-direction {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.gamma-last-scan {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.gamma-signals-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 0 18px;
}

.gamma-signals-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 0 18px 12px;
}

.gamma-signal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border-subtle);
  background: var(--bg-secondary);
  transition: all 0.2s;
}

.gamma-signal-item:hover {
  transform: translateX(2px);
}

.gamma-signal-item.high {
  border-left-color: var(--red);
  background: rgba(239, 83, 80, 0.06);
}

.gamma-signal-item.medium {
  border-left-color: var(--orange);
  background: rgba(255, 152, 0, 0.06);
}

.gamma-signal-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.gamma-signal-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 4px;
}

.gamma-signal-value.high {
  background: var(--red-dim);
  color: var(--red);
}

.gamma-signal-value.medium {
  background: var(--orange-dim);
  color: var(--orange);
}

.gamma-signal-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.gamma-no-signals {
  color: var(--text-muted);
  text-align: center;
  padding: 16px;
  font-size: 0.85rem;
}

/* ---- Gamma Blast History ---- */
.gamma-history-section {
  grid-column: 1 / -1;
}

.gamma-history-count {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--orange);
  padding: 2px 8px;
  background: var(--orange-dim);
  border-radius: 100px;
}

.gamma-history-list {
  max-height: 300px;
  overflow-y: auto;
}

.gamma-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(55, 65, 81, 0.3);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: var(--radius-sm);
}

.gamma-history-item:hover {
  background: var(--bg-card-hover);
}

.gamma-history-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  min-width: 90px;
}

.gamma-history-level {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.gamma-history-level.blast {
  background: var(--orange-dim);
  color: var(--orange);
}

.gamma-history-level.extreme {
  background: var(--red-dim);
  color: var(--red);
}

.gamma-history-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
}

.gamma-history-dir {
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.gamma-history-change {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.82rem;
}

.gamma-history-change.up {
  color: var(--green);
}

.gamma-history-change.down {
  color: var(--red);
}

/* Responsive adjustments for gamma */
@media (max-width: 1200px) {
  .gamma-blast-section {
    grid-column: 1;
  }

  .gamma-history-section {
    grid-column: 1;
  }
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .chart-section {
    grid-column: 1;
    grid-row: auto;
    min-height: 450px;
  }

  .signal-section {
    grid-column: 1;
    grid-row: auto;
  }

  .watchlist-section {
    grid-column: 1;
    grid-row: auto;
  }

  .sector-section {
    grid-column: 1;
  }

  .indicators-section {
    grid-column: 1;
  }

  .bottom-row {
    grid-column: 1;
    grid-template-columns: 1fr;
  }

  .header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }

  .search-bar input {
    width: 160px;
  }
}

@media (max-width: 600px) {
  .header-left {
    flex-wrap: wrap;
    width: 100%;
  }

  .search-bar {
    flex: 1;
  }

  .search-bar input {
    width: 100%;
  }

  .indicators-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-container {
    height: 300px;
  }
}