/* ==========================================================================
   HiveMine Dashboard — Hive Civilization aesthetic
   ========================================================================== */

:root {
  /* Palette */
  --bg: #0a0a0f;
  --bg-elev: #12121a;
  --bg-elev-2: #17172340;
  --panel: #111119;
  --panel-border: #23233340;
  --panel-border-strong: #2a2a3d;

  --text: #e9e9f2;
  --text-dim: #a0a0b4;
  --text-faint: #6b6b82;

  --violet: #7c3aed;
  --violet-bright: #a855f7;
  --blue: #3b82f6;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;

  --maxw: 1280px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--panel-border);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

.mono {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

a { color: var(--violet-bright); text-decoration: none; }
a:hover { color: var(--violet); }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Background — hex grid + subtle violet glow
   ========================================================================== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(124, 58, 237, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(59, 130, 246, 0.06), transparent 60%),
    var(--bg);
}

.bg-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Hex pattern via SVG */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='56' height='64' viewBox='0 0 56 64'><g fill='none' stroke='%237c3aed' stroke-opacity='0.07' stroke-width='1'><path d='M28 1 L55 16 L55 48 L28 63 L1 48 L1 16 Z'/></g></svg>");
  background-size: 56px 64px;
  opacity: 0.7;
  mask-image: linear-gradient(to bottom, black, black 40%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, black, black 40%, transparent);
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(10, 10, 15, 0.72);
  border-bottom: 1px solid var(--panel-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--violet-bright);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: 24px;
  height: 24px;
  color: var(--violet-bright);
  flex: none;
}

.brand-name {
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0.02em;
}

.header-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* Live pulse dot */
.status-dot,
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
  display: inline-block;
  flex: none;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   Main layout
   ========================================================================== */
.main {
  padding: 32px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.page-head {
  margin-top: 8px;
  margin-bottom: 4px;
}

.page-title {
  font-size: clamp(28px, 3.2vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  background: linear-gradient(180deg, #ffffff 0%, #c4b5fd 140%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-sub {
  margin: 0;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Stat cards
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.06), rgba(17, 17, 25, 0.6));
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: border-color 160ms ease, transform 160ms ease;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.5), transparent);
  opacity: 0.6;
}

.stat-card:hover {
  border-color: rgba(124, 58, 237, 0.45);
}

.stat-label {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 10px;
  font-size: clamp(24px, 2.6vw, 30px);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.1;
}

.stat-unit {
  color: var(--text-faint);
  font-size: 0.58em;
  font-weight: 500;
  margin-left: 4px;
  letter-spacing: 0.04em;
}

.stat-sub {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
}

.stat-meta {
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border-strong);
  color: var(--text-dim);
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

.chip-violet {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.4);
  color: #c4b5fd;
}

.chip-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

/* ==========================================================================
   Panel (generic section container)
   ========================================================================== */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius);
  padding: 22px 24px;
  position: relative;
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.legend-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* ==========================================================================
   Chart
   ========================================================================== */
.chart-wrap {
  position: relative;
  height: 340px;
  width: 100%;
}

/* ==========================================================================
   Calculator
   ========================================================================== */

/* Breakeven banner */
.breakeven {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.10), rgba(245, 158, 11, 0.03) 60%, transparent);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left-width: 3px;
  border-radius: var(--radius);
}

.be-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  flex: none;
}

.be-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.be-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
  font-weight: 600;
}

.be-text {
  color: var(--text);
  font-size: 13.5px;
}

.be-strong { color: #fcd34d; font-weight: 600; }

.be-sep { color: var(--text-faint); margin: 0 6px; }

.be-delta {
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

.calc-note {
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

.calc-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 2fr;
  gap: 24px;
  align-items: stretch;
}

.calc-control {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.calc-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.calc-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 500;
}

.calc-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  transition: border-color 160ms ease;
}

.calc-input-wrap:focus-within {
  border-color: var(--violet);
}

.calc-input-prefix,
.calc-input-suffix {
  color: var(--text-faint);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
}

.calc-input {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 15px;
  width: 72px;
  outline: none;
  padding: 2px 0;
  text-align: right;
}

.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Slider */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--violet) 0%, var(--violet) var(--slider-fill, 26%), rgba(255,255,255,0.08) var(--slider-fill, 26%), rgba(255,255,255,0.08) 100%);
  outline: none;
  margin: 4px 0 10px;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--violet-bright);
  border: 3px solid #0a0a0f;
  cursor: grab;
  box-shadow: 0 0 0 1px var(--violet), 0 0 12px rgba(168, 85, 247, 0.5);
  transition: transform 120ms ease;
}
.slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.08); }

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--violet-bright);
  border: 3px solid #0a0a0f;
  cursor: grab;
  box-shadow: 0 0 0 1px var(--violet), 0 0 12px rgba(168, 85, 247, 0.5);
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

/* Outputs */
.calc-outputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.calc-out {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 180ms ease, background 180ms ease;
}

.calc-out-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 500;
}

.calc-out-value {
  margin-top: 10px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.1;
}

.calc-out-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-faint);
}

/* Profit color states */
.state-good .calc-out-value { color: var(--green); }
.state-good { border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.06); }

.state-warn .calc-out-value { color: var(--amber); }
.state-warn { border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.06); }

.state-bad .calc-out-value { color: var(--red); }
.state-bad { border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.06); }

/* ==========================================================================
   Pool grid
   ========================================================================== */
.pool-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--panel-border-strong);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.pool-cell {
  background: var(--panel);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 92px;
}

.pool-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 500;
}

.pool-value {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.pool-value.accent { color: var(--violet-bright); }

.pool-unit {
  color: var(--text-faint);
  font-size: 0.55em;
  font-weight: 500;
  margin-left: 3px;
  letter-spacing: 0.04em;
}

.pool-foot {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ==========================================================================
   Table
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
}

.payout-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 560px;
}

.payout-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--panel-border-strong);
  background: rgba(255,255,255,0.02);
}

.payout-table th.num,
.payout-table td.num { text-align: right; }

.payout-table tbody tr {
  transition: background 120ms ease;
}

.payout-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.payout-table tbody tr:hover {
  background: rgba(124, 58, 237, 0.08);
}

.payout-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(35, 35, 51, 0.5);
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}

.payout-table td.date {
  color: var(--text-dim);
}

.payout-table td.aleo {
  font-weight: 600;
  color: #c4b5fd;
}

.payout-table td.usd {
  color: var(--text-dim);
}

.tx-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--violet-bright);
  font-size: 12.5px;
  transition: color 120ms ease;
}

.tx-link:hover { color: #e9d5ff; }

.tx-link svg {
  opacity: 0.6;
  transition: opacity 120ms ease, transform 120ms ease;
}
.tx-link:hover svg { opacity: 1; transform: translate(1px, -1px); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--panel-border);
  margin-top: 40px;
  background: rgba(10, 10, 15, 0.6);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 13px;
}

.footer-brand .brand-mark {
  width: 20px;
  height: 20px;
  color: var(--violet-bright);
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--panel-border-strong);
  border-radius: 999px;
  color: var(--violet-bright);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.footer-link:hover {
  border-color: var(--violet);
  background: rgba(124, 58, 237, 0.12);
  color: #e9d5ff;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
  .pool-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1100px) {
  .calc-grid { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .pool-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 680px) {
  .container { padding: 0 16px; }
  .main { padding: 20px 16px 60px; gap: 20px; }
  .panel { padding: 18px; }
  .pool-grid { grid-template-columns: repeat(2, 1fr); }
  .pool-cell:last-child { grid-column: 1 / -1; }
  .calc-outputs { grid-template-columns: 1fr; }
  .stat-value { font-size: 22px; }
  .chart-wrap { height: 280px; }
  .page-title { font-size: 26px; }
}

@media (max-width: 440px) {
  .stats-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .status-dot, .pulse-dot { animation: none; }
  * { transition: none !important; }
}
