/**
 * Binance-Style Heatmap Geometry
 * Pixel-perfect UI matching Binance design
 * Data remains independent from Binance (TradeButtons Engine sourced)
 */

/* Tile Spacing & Geometry */
.tb-heatmap-binance {
  --tile-gap: 2px;
  --tile-padding: 8px;
  --tile-radius: 6px;
  --tile-stroke-width: 1px;
  
  /* Typography */
  --symbol-font-size: 14px;
  --symbol-font-weight: 700;
  --symbol-line-height: 1.2;
  
  --change-font-size: 11px;
  --change-font-weight: 500;
  --change-line-height: 1;
  
  --price-font-size: 10px;
  --price-font-weight: 400;
  --price-line-height: 1;
  
  /* Spacing */
  --symbol-change-gap: 3px;
  
  /* Logo */
  --logo-size: 20px;
  --logo-opacity: 0.8;
  
  /* Hover/Interaction */
  --tile-hover-scale: 1.02;
  --tile-hover-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Container */
.tb-heatmap-binance .akctsp-hm-wrap {
  background-color: #f5f5f5;
  border-radius: 8px;
  padding: 12px;
}

/* SVG Container */
.tb-heatmap-binance svg {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* Node/Tile Group */
.tb-heatmap-binance g.node {
  outline: none;
  transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tb-heatmap-binance g.node:hover {
  filter: brightness(1.05);
  transform: scale(var(--tile-hover-scale)) !important;
  box-shadow: var(--tile-hover-shadow);
  z-index: 100;
}

/* Tile Rectangle */
.tb-heatmap-binance rect[fill] {
  rx: var(--tile-radius) !important;
  ry: var(--tile-radius) !important;
  stroke-width: var(--tile-stroke-width);
  stroke: rgba(0,0,0,0.08);
  /* Subtle inner shadow effect via filter */
  filter: drop-shadow(inset 0 1px 2px rgba(255,255,255,0.3));
}

/* Symbol Text */
.tb-heatmap-binance text.sym {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--symbol-font-size);
  font-weight: var(--symbol-font-weight);
  line-height: var(--symbol-line-height);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  dominant-baseline: middle;
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}

/* Meta Text (Change % or Price) */
.tb-heatmap-binance text.meta {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--change-font-size);
  font-weight: var(--change-font-weight);
  line-height: var(--change-line-height);
  letter-spacing: 0.01em;
  dominant-baseline: middle;
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
  opacity: 0.95;
}

/* Logo Image */
.tb-heatmap-binance image.logo {
  opacity: var(--logo-opacity);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

/* Debug Overlay (development mode) */
.tb-heatmap-binance g.debug-overlay rect {
  stroke: #ffff00 !important;
  stroke-width: 1px;
  fill: none;
  opacity: 0.5;
  pointer-events: none;
}

.tb-heatmap-binance g.debug-overlay text {
  font-family: monospace;
  font-size: 8px;
  fill: #ffff00;
  pointer-events: none;
  opacity: 0.6;
}

/* Defs/Filters */
.tb-heatmap-binance defs {
  display: none; /* Keep SVG clean */
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .tb-heatmap-binance .akctsp-hm-wrap {
    background-color: #1a1a1a;
  }
  
  .tb-heatmap-binance text.sym,
  .tb-heatmap-binance text.meta {
    fill: #ffffff;
  }
  
  .tb-heatmap-binance rect[fill] {
    stroke: rgba(255,255,255,0.1);
    filter: drop-shadow(inset 0 1px 2px rgba(0,0,0,0.2));
  }
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .tb-heatmap-binance {
    --symbol-font-size: 12px;
    --change-font-size: 9px;
    --price-font-size: 8px;
  }
}

@media (max-width: 768px) {
  .tb-heatmap-binance {
    --symbol-font-size: 11px;
    --change-font-size: 8px;
    --price-font-size: 7px;
    --tile-padding: 6px;
  }
}

@media (max-width: 480px) {
  .tb-heatmap-binance {
    --symbol-font-size: 10px;
    --change-font-size: 7px;
    --price-font-size: 6px;
    --tile-padding: 4px;
    --tile-radius: 3px;
  }
}
