/* CoinMarketCap-Style Chart Container */
.tkcmps-chart {
  position: relative;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Price Statistics Section */
.tkcmps-price-stats {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eff2f5;
}

.tkcmps-current-price {
  font-size: 32px;
  font-weight: 700;
  color: #1e2329;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.tkcmps-price-change {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.tkcmps-price-change.positive {
  color: #16c784;
}

.tkcmps-price-change.negative {
  color: #ea3943;
}

.tkcmps-arrow {
  font-size: 12px;
}

.tkcmps-change-value {
  font-weight: 600;
}

.tkcmps-change-percent {
  opacity: 0.85;
}

.tkcmps-no-data {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #707a8a;
  font-size: 14px;
  font-weight: 500;
}

/* Loading Spinner */
.tkcmps-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f4f6;
  border-top-color: #3861fb;
  border-radius: 50%;
  animation: tkcmps-spin 0.6s linear infinite;
}

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

.tkcmps-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 10;
}

.tkcmps-loading .tkcmps-spinner {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* Chart Container */
.tkcmps-chart .tkcmps-chart-box {
  position: relative;
  height: 420px;
  background: #fafbfc;
  border-radius: 8px;
  padding: 12px;
}

.tkcmps-chart canvas.tkcmps-price-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Time Range Buttons */
.tkcmps-range {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tkcmps-range button {
  background: #fff;
  border: 1px solid #e6e9ed;
  color: #5b6673;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.tkcmps-range button:hover {
  background: #f7f8fa;
  border-color: #d0d3d9;
  color: #1e2329;
}

.tkcmps-range button.active {
  background: #3861fb;
  border-color: #3861fb;
  color: #fff;
  box-shadow: 0 2px 8px rgba(56, 97, 251, 0.25);
}

.tkcmps-range button:active {
  transform: translateY(1px);
}

/* Debug Section */
.tkcmps-debug {
  margin-top: 16px;
  padding: 12px;
  background: #f7f8fa;
  border-radius: 8px;
  font-size: 12px;
  color: #707a8a;
  border: 1px solid #e6e9ed;
}

.tkcmps-debug code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Monaco", "Courier New", monospace;
  color: #3861fb;
  border: 1px solid #e6e9ed;
}

.tkcmps-debug-span {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e6e9ed;
}

.tkcmps-debug .tkcmps-debug-log {
  margin-top: 8px;
  padding: 8px;
  background: #fff;
  border-radius: 4px;
  font-family: "Monaco", "Courier New", monospace;
  font-size: 11px;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .tkcmps-chart {
    background: #1a1d26;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  }
  
  .tkcmps-price-stats {
    border-bottom-color: #2b3139;
  }
  
  .tkcmps-current-price {
    color: #f0f0f0;
  }
  
  .tkcmps-chart .tkcmps-chart-box {
    background: #23262f;
  }
  
  .tkcmps-range button {
    background: #23262f;
    border-color: #2b3139;
    color: #b8b8b8;
  }
  
  .tkcmps-range button:hover {
    background: #2b3139;
    border-color: #3a3f4b;
    color: #f0f0f0;
  }
  
  .tkcmps-debug {
    background: #23262f;
    border-color: #2b3139;
    color: #b8b8b8;
  }
  
  .tkcmps-debug code {
    background: #1a1d26;
    border-color: #2b3139;
  }
  
  .tkcmps-debug .tkcmps-debug-log {
    background: #1a1d26;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .tkcmps-chart {
    padding: 16px;
  }
  
  .tkcmps-current-price {
    font-size: 24px;
  }
  
  .tkcmps-chart .tkcmps-chart-box {
    height: 320px;
  }
  
  .tkcmps-range button {
    padding: 6px 12px;
    font-size: 12px;
  }
}