/* Heat Map Styles */
.hm-period-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.hm-period-btn {
  padding: 8px 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.hm-period-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.hm-period-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Heat Map Grid */
.hm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  margin-bottom: 32px;
}
.hm-tile {
  position: relative;
  border-radius: 10px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  cursor: default;
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 100px;
  border: 2px solid transparent;
}
.hm-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* Size classes based on market cap rank */
.hm-tile.size-xl { grid-column: span 2; grid-row: span 2; min-height: 220px; }
.hm-tile.size-lg { grid-column: span 2; min-height: 130px; }
.hm-tile.size-md { min-height: 110px; }
.hm-tile.size-sm { min-height: 90px; }

/* Color classes */
.hm-tile.deep-green  { background: rgba(22, 163, 74, 0.35); color: #bbf7d0; }
.hm-tile.light-green { background: rgba(22, 163, 74, 0.18); color: #bbf7d0; }
.hm-tile.neutral     { background: rgba(120, 120, 130, 0.2); color: var(--text-secondary); }
.hm-tile.light-red   { background: rgba(220, 38, 38, 0.18); color: #fecaca; }
.hm-tile.deep-red    { background: rgba(220, 38, 38, 0.35); color: #fecaca; }

[data-theme="light"] .hm-tile.deep-green  { background: rgba(22, 163, 74, 0.22); color: #14532d; }
[data-theme="light"] .hm-tile.light-green { background: rgba(22, 163, 74, 0.10); color: #166534; }
[data-theme="light"] .hm-tile.neutral     { background: rgba(120, 120, 130, 0.12); color: var(--text-secondary); }
[data-theme="light"] .hm-tile.light-red   { background: rgba(220, 38, 38, 0.10); color: #991b1b; }
[data-theme="light"] .hm-tile.deep-red    { background: rgba(220, 38, 38, 0.22); color: #991b1b; }

/* LTC highlight */
.hm-tile.ltc-highlight {
  border: 2px solid var(--accent);
  box-shadow: 0 0 16px rgba(52, 120, 246, 0.3);
}
.hm-tile.ltc-highlight:hover {
  box-shadow: 0 0 24px rgba(52, 120, 246, 0.45);
}

.hm-symbol {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight:600;
  letter-spacing: 0.5px;
}
.hm-tile.size-xl .hm-symbol { font-size: 1.6rem; }
.hm-tile.size-lg .hm-symbol { font-size: 1.3rem; }

.hm-name {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 2px;
}
.hm-tile.size-xl .hm-name { font-size: 0.8rem; }

.hm-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 6px;
}
.hm-tile.size-xl .hm-price { font-size: 1.1rem; }
.hm-tile.size-lg .hm-price { font-size: 0.95rem; }

.hm-change {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 3px;
}
.hm-tile.size-xl .hm-change { font-size: 1rem; }

/* Top Movers */
.hm-movers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}
@media (max-width: 640px) {
  .hm-movers { grid-template-columns: 1fr; }
}
.hm-movers-col h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hm-mover-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.hm-mover-card.gainer {
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.25);
}
.hm-mover-card.loser {
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.25);
}
.hm-mover-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hm-mover-rank {
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.5;
  width: 18px;
}
.hm-mover-symbol {
  font-weight:600;
  font-size: 0.9rem;
}
.hm-mover-price {
  font-size: 0.8rem;
  opacity: 0.7;
}
.hm-mover-change {
  font-weight: 700;
  font-size: 0.9rem;
}
.hm-mover-card.gainer .hm-mover-change { color: #22c55e; }
.hm-mover-card.loser .hm-mover-change { color: #ef4444; }

/* Status bar */
.hm-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.hm-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 6px;
  animation: hm-pulse 2s infinite;
}
@keyframes hm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Loading skeleton */
.hm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-tertiary);
  gap: 12px;
}
.hm-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: hm-spin 0.8s linear infinite;
}
@keyframes hm-spin { to { transform: rotate(360deg); } }

/* Responsive grid adjustments */
@media (max-width: 900px) {
  .hm-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .hm-tile.size-xl { grid-column: span 2; grid-row: span 1; min-height: 130px; }
  .hm-tile.size-lg { grid-column: span 2; min-height: 110px; }
}
@media (max-width: 500px) {
  .hm-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .hm-tile.size-xl, .hm-tile.size-lg { grid-column: span 2; grid-row: span 1; min-height: 100px; }
  .hm-tile { padding: 10px 8px; min-height: 80px; }
  .hm-symbol { font-size: 0.95rem; }
  .hm-price { font-size: 0.72rem; }
  .hm-change { font-size: 0.7rem; }
  .hm-name { display: none; }
}
