/* ==========================================================================
   ADVANCED OLED DARK TELEMETRY DASHBOARD STYLESHEET
   ========================================================================== */

:root {
  --bg-color: #060810;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(20, 30, 55, 0.85);
  --bg-subcard: rgba(0, 0, 0, 0.3);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(255, 255, 255, 0.16);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Brand Accents */
  --btc-amber: #f59e0b;
  --btc-amber-bright: #fbbf24;
  --btc-glow: rgba(245, 158, 11, 0.15);

  --xmr-orange: #ff6600;
  --xmr-orange-bright: #ff8533;
  --xmr-glow: rgba(255, 102, 0, 0.15);

  --cyan-accent: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.15);

  --status-online: #10b981;
  --status-online-glow: rgba(16, 185, 129, 0.25);
  --status-offline: #f43f5e;
  --status-offline-glow: rgba(244, 63, 94, 0.25);

  --temp-cool: #10b981;
  --temp-warn: #f59e0b;
  --temp-hot: #f43f5e;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(245, 158, 11, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(255, 102, 0, 0.03) 0%, transparent 40%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  flex: 1;
}

/* Header Section */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--btc-amber), var(--xmr-orange));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
}

.brand-icon svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

.header-title h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-title p {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Header Actions Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.system-status-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--status-online);
  background: rgba(16, 185, 129, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.pulse-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-online);
  box-shadow: 0 0 8px var(--status-online);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.timer-badge {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  color: var(--cyan-accent);
  font-weight: 600;
}

.btn-refresh {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-refresh:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-accent);
}

.btn-refresh svg {
  width: 15px;
  height: 15px;
  transition: transform 0.3s ease;
}

.btn-refresh.spinning svg {
  animation: spin 1s linear infinite;
}

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

/* Executive Summary Banner (4 KPI Grid) */
.summary-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  border-radius: 14px;
}

.summary-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.summary-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin: 0.2rem 0;
}

.summary-sub {
  font-size: 0.75rem;
  font-weight: 600;
}

.text-btc { color: var(--btc-amber); }
.text-xmr { color: var(--xmr-orange); }

/* Dashboard Cards Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.card.bitaxe-card {
  border-top: 3px solid var(--btc-amber);
}

.card.xmrig-card {
  border-top: 3px solid var(--xmr-orange);
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: bold;
}

.bitaxe-card .card-logo {
  background: var(--btc-glow);
  color: var(--btc-amber-bright);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.xmrig-card .card-logo {
  background: var(--xmr-glow);
  color: var(--xmr-orange-bright);
  border: 1px solid rgba(255, 102, 0, 0.3);
}

.card-title h2 {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.card-title h2 span {
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--cyan-accent);
  font-family: var(--font-mono);
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.status-badge.online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-online);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.offline {
  background: rgba(244, 63, 94, 0.15);
  color: var(--status-offline);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-badge.online .dot {
  background-color: var(--status-online);
  box-shadow: 0 0 8px var(--status-online);
}

.status-badge.offline .dot {
  background-color: var(--status-offline);
}

/* Hero Metric Display */
.metrics-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hero-metric {
  background: var(--bg-subcard);
  border: 1px solid var(--border-color);
  padding: 1rem 1.15rem;
  border-radius: 14px;
}

.hero-metric.btc-theme {
  border-left: 3px solid var(--btc-amber);
}

.hero-metric.xmr-theme {
  border-left: 3px solid var(--xmr-orange);
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-tag {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.675rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value-large {
  font-size: 2.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #ffffff;
  margin: 0.2rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.hashrate-windows {
  display: flex;
  gap: 1rem;
  font-size: 0.775rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.25rem;
}

.hashrate-windows strong {
  color: var(--text-primary);
}

.moving-avg-box {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.avg-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--cyan-accent);
}

/* Secondary Stats Subgrid */
.stats-subgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.submetric-card {
  background: var(--bg-subcard);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1rem;
  border-radius: 12px;
}

.submetric-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-top: 0.15rem;
}

.accent-amber { color: var(--btc-amber); }
.accent-orange { color: var(--xmr-orange); }

.submetric-footer {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Pool & Meta Banner */
.meta-banner {
  background: var(--bg-subcard);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 0.675rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.meta-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.font-mono {
  font-family: var(--font-mono);
}

/* Chart Canvas Section */
.chart-container {
  background: var(--bg-subcard);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0.85rem 1rem;
}

.chart-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.btc-dot { background: var(--btc-amber); }
.xmr-dot { background: var(--xmr-orange); }

.chart-wrapper {
  position: relative;
  height: 190px;
  width: 100%;
}

/* Offline Notice Box */
.offline-notice {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #fda4af;
  padding: 0.75rem;
  border-radius: 10px;
  font-size: 0.825rem;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Footer */
.footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .summary-banner {
    grid-template-columns: 1fr;
  }
  .meta-banner {
    grid-template-columns: 1fr 1fr;
  }
}
