/* AI Computing Center - Global Trading Analytics Dashboard */

:root {
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.35);
  --cyan: #06b6d4;
  --panel: rgba(15, 23, 42, 0.65);
  --border: rgba(148, 163, 184, 0.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

body {
  font-family: 'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: radial-gradient(ellipse at top, rgba(30, 58, 138, 0.22), transparent 60%),
              radial-gradient(ellipse at bottom, rgba(6, 182, 212, 0.16), transparent 50%),
              #020617;
}

.font-mono { font-family: 'JetBrains Mono', monospace; }

#bg-particles { opacity: 0.7; }

#loader { transition: opacity 0.6s ease; }

.glass {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.35);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), transparent 40%);
}

.card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.6), transparent);
  opacity: 0.7;
}

.neon-text {
  text-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

.kpi .text-3xl {
  background: linear-gradient(90deg, #fff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.token-balance-text {
  background: linear-gradient(90deg, #fde68a, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.token-balance-text.token-low {
  background: linear-gradient(90deg, #fca5a5, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.token-balance-text.token-locked,
.token-hero-value.token-locked {
  background: none;
  -webkit-text-fill-color: #64748b;
  color: #64748b;
  text-shadow: none;
  letter-spacing: normal;
}

#token-hero {
  border-color: rgba(245, 158, 11, 0.35);
}

.token-hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at left, rgba(245, 158, 11, 0.16), transparent 65%);
}

.token-hero-value {
  background: linear-gradient(90deg, #fef3c7, #fbbf24 45%, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.35);
  letter-spacing: 0.02em;
}

.token-hero-value.token-low {
  background: linear-gradient(90deg, #fecaca, #ef4444 45%, #b91c1c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(239, 68, 68, 0.35);
}

.token-delta-float {
  position: absolute;
  top: 14px;
  right: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 800;
  color: #f87171;
  pointer-events: none;
  animation: tokenFloatUp 1.1s ease-out forwards;
}

@keyframes tokenFloatUp {
  0% { opacity: 0; transform: translateY(4px); }
  15% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-28px); }
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: #94a3b8;
  font-size: 0.85rem;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border-left: 3px solid #3b82f6;
}

.auth-tab-btn {
  padding: 0.35rem 0.9rem;
  font-size: 0.75rem;
  border-radius: 9999px;
  color: #94a3b8;
  transition: all 0.2s;
}

.auth-tab-btn.active {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

.editable {
  outline: none;
  border-radius: 0.5rem;
  transition: 0.2s;
}

.editable:focus {
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
  padding: 0.5rem;
}

.kpi:hover {
  transform: translateY(-2px);
}

#feed-list::-webkit-scrollbar,
#main-scroll::-webkit-scrollbar {
  width: 6px;
}

#feed-list::-webkit-scrollbar-thumb,
#main-scroll::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.35);
  border-radius: 3px;
}

#feed-list::-webkit-scrollbar-track,
#main-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.ticker-track::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0; width: 60px;
  background: linear-gradient(90deg, transparent, rgba(2, 6, 23, 0.9));
  pointer-events: none;
}

.ticker-content {
  animation: ticker 30s linear infinite;
}

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

.ticker-content:hover {
  animation-play-state: paused;
}

.page-section {
  display: none;
  animation: fadeIn 0.4s ease;
}

.page-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.feed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.feed-row:last-child { border-bottom: none; }

.feed-row .action { font-weight: 600; }

.feed-row .action.BUY { color: #34d399; }
.feed-row .action.SELL { color: #f87171; }
.feed-row .action.HEDGE { color: #fbbf24; }
.feed-row .action.ARB { color: #60a5fa; }


@media (max-width: 640px) {
  .card { padding: 1rem; }
  .text-3xl { font-size: 1.5rem; }
  .text-2xl { font-size: 1.25rem; }
  #world-map, #price-chart, #price-chart-page { min-height: 240px; }
  .feed-row { flex-wrap: wrap; gap: 0.25rem; }
  .feed-row > span:first-child { width: 100%; }
  .nav-item { font-size: 0.8rem; padding: 0.6rem 0.75rem; }
}

@media (max-width: 480px) {
  .card { padding: 0.875rem; }
  #ticker { font-size: 0.7rem; }
}

/* Prevent horizontal overflow on mobile */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Timeline mobile optimization */
#ai-plan-advice .text-2xl {
  font-size: 1.5rem;
}

@media (max-width: 640px) {
  #ai-plan-advice .text-2xl {
    font-size: 1.25rem;
  }
  #ai-plan-advice .grid-cols-2 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  #ai-plan-advice .grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Map heights for ECharts */
#world-map { height: 320px; position: relative; }
#map-rank-panel { min-height: 320px; }
#world-map::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.06) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
}
@media (min-width: 640px) {
  #world-map { height: 360px; }
  #map-rank-panel { min-height: 360px; }
}
@media (min-width: 1024px) {
  #world-map { height: 420px; }
  #map-rank-panel { min-height: 420px; }
}

/* GPU dashboard */
.gpu-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 0.75rem;
  padding: 0.75rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.gpu-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}
.gpu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981);
  opacity: 0.8;
}
.gpu-card.temp-warn::before { background: linear-gradient(90deg, #f59e0b, #f97316); }
.gpu-card.temp-hot::before { background: linear-gradient(90deg, #ef4444, #f43f5e); }
.gpu-card.idle { opacity: 0.7; }
.gpu-card.idle::before { opacity: 0.3; }
.gpu-card .gpu-id {
  font-size: 0.65rem;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
}
.gpu-card .gpu-status {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.gpu-metric-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.gpu-metric {
  text-align: center;
  flex: 1;
}
.gpu-metric-value {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.gpu-metric-label {
  font-size: 0.55rem;
  color: #64748b;
}
.gpu-mini-bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.15);
  margin-top: 0.3rem;
  overflow: hidden;
}
.gpu-mini-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.gpu-progress-anim {
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
}

.thread-log {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  line-height: 1.5;
  max-height: 320px;
}
.thread-log::-webkit-scrollbar { width: 4px; }
.thread-log::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, 0.4); border-radius: 4px; }
.thread-row {
  display: flex;
  gap: 0.5rem;
  color: #94a3b8;
  animation: fadeIn 0.3s ease;
}
.thread-time { color: #475569; min-width: 54px; }
.thread-gpu { color: #60a5fa; min-width: 70px; }
.thread-action { color: #e2e8f0; }
.thread-metric { color: #34d399; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 640px) {
  .gpu-card { padding: 0.5rem; }
  .gpu-metric-value { font-size: 0.65rem; }
  .gpu-metric-label { font-size: 0.5rem; }
}
