/* ============================================================
   Mining Profitability Calculator — Shared Design System
   miningprofitabilitycalculator.com
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Barlow:wght@300;400;600;700&family=Barlow+Condensed:wght@600;700&display=swap');

/* ── Variables ── */
:root {
  --bg:        #050a0e;
  --bg2:       #091420;
  --bg3:       #0d1e2e;
  --bg4:       #112236;
  --border:    #1a3a5c;
  --border2:   #254d78;
  --accent:    #00d4ff;
  --accent2:   #f7931a;
  --accent3:   #00ff88;
  --red:       #ff4455;
  --text:      #c8e0f0;
  --muted:     #4a7a9b;
  --faint:     #1e3a52;
  --mono:      'Share Tech Mono', monospace;
  --sans:      'Barlow', sans-serif;
  --cond:      'Barlow Condensed', sans-serif;
  --radius:    8px;
  --radius-lg: 12px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}

/* ── Typography ── */
h1, h2, h3, h4 { font-family: var(--cond); letter-spacing: 0.04em; color: #fff; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p  { line-height: 1.7; color: var(--text); }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.accent2 { color: var(--accent2); }
.green { color: var(--accent3); }
.red { color: var(--red); }

/* ── Layout ── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ── Header / Nav ── */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5,10,14,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1.5rem;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-text .l1 {
  font-family: var(--cond);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.logo-text .l2 {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Nav links */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
  background: rgba(0,212,255,0.08);
  text-decoration: none;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0; right: 0;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem;
    gap: 0.25rem;
  }
  .site-nav.open { display: flex; }
  .site-nav a { font-size: 0.8rem; padding: 8px 0; }
}

/* ── Page Hero ── */
.page-hero {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--faint);
  margin-bottom: 2.5rem;
}

.page-hero .eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-hero .eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.page-hero h1 { margin-bottom: 0.75rem; }

.page-hero .subtitle {
  font-size: 1rem;
  color: var(--muted);
  max-width: 680px;
  line-height: 1.6;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,255,136,0.08);
  border: 1px solid rgba(0,255,136,0.25);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent3);
  margin-top: 1rem;
}

.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent3);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:0.3; transform:scale(0.7); }
}

/* ── Panels / Cards ── */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.panel-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title::before {
  content: '';
  display: inline-block;
  width: 3px; height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

.metric-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: center;
}

.metric-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.metric-value {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
  line-height: 1;
}

.metric-value.pos { color: var(--accent3); }
.metric-value.neg { color: var(--red); }
.metric-value.btc { color: var(--accent2); }

.metric-sub {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Top accent bar on cards */
.metric-card.profit  { border-top: 2px solid var(--accent3); }
.metric-card.loss    { border-top: 2px solid var(--red); }
.metric-card.revenue { border-top: 2px solid var(--accent); }
.metric-card.cost    { border-top: 2px solid var(--muted); }

/* ── Form Controls ── */
.field { margin-bottom: 1.1rem; }

.field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.field label .hint {
  font-size: 0.65rem;
  color: var(--faint);
  letter-spacing: 0;
}

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,212,255,0.1); }

.input-wrap input,
.input-wrap select {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 10px 14px;
  min-width: 0;
}

.input-wrap select option { background: var(--bg3); color: #fff; }

.input-unit {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0 12px;
  background: rgba(0,212,255,0.04);
  border-left: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Presets */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 1rem;
}

.preset-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.preset-btn:hover, .preset-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,212,255,0.07);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  outline: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.btn-primary:hover { background: #33deff; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text);
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 6px 14px; font-size: 0.72rem; }

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.data-table th {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover { color: var(--accent); }
.data-table th.sorted { color: var(--accent); }
.data-table th.sorted::after { content: ' ↓'; }
.data-table th.sorted.asc::after { content: ' ↑'; }

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(26,58,92,0.4);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: rgba(0,212,255,0.03); }

/* ── Progress / Bar ── */
.bar-wrap { margin: 1rem 0; }

.bar-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 5px;
}

.bar-track {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.4s ease;
}

.bar-fill.green { background: var(--accent3); }
.bar-fill.red   { background: var(--red); }
.bar-fill.orange{ background: var(--accent2); }

/* ── Breakdown list ── */
.breakdown {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(26,58,92,0.4);
  font-size: 0.82rem;
}

.breakdown-row:last-child { border-bottom: none; }
.breakdown-row .key { font-family: var(--mono); color: var(--muted); font-size: 0.75rem; }
.breakdown-row .val { font-family: var(--mono); color: var(--text); font-weight: 600; }
.breakdown-row .val.pos { color: var(--accent3); }
.breakdown-row .val.neg { color: var(--red); }

/* ── Loading / Spinner ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Comparison columns ── */
.compare-cols {
  display: grid;
  gap: 1rem;
}

.compare-col {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.compare-col-header {
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compare-col-header.mining  { background: rgba(0,212,255,0.08); color: var(--accent); border-bottom: 1px solid var(--border); }
.compare-col-header.nicehash{ background: rgba(247,147,26,0.08); color: var(--accent2); border-bottom: 1px solid var(--border); }
.compare-col-header.mrr     { background: rgba(0,255,136,0.08); color: var(--accent3); border-bottom: 1px solid var(--border); }

/* ── Footer ── */
#site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

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

.footer-brand .tagline {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.75rem;
  line-height: 1.6;
  max-width: 280px;
}

.footer-col h4 {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.4rem; }
.footer-col a { font-size: 0.83rem; color: var(--muted); }
.footer-col a:hover { color: var(--accent); text-decoration: none; }

.footer-bottom {
  border-top: 1px solid var(--faint);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-bottom .copy {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.disclaimer {
  font-size: 0.72rem;
  color: rgba(74,122,155,0.6);
  line-height: 1.6;
}

/* ── Filters row ── */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.filter-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 7px 12px;
  outline: none;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--accent); }
.filter-select option { background: var(--bg3); }

.search-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 7px 12px;
  outline: none;
  flex: 1;
  min-width: 180px;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--muted); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tooltips ── */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
}
[data-tip]:hover::after { opacity: 1; }

/* ── PDF Report ── */
.report-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

/* ── Alert / Notice ── */
.notice {
  background: rgba(0,212,255,0.06);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.notice.warn {
  background: rgba(247,147,26,0.06);
  border-color: rgba(247,147,26,0.2);
  color: var(--accent2);
}

.notice.error {
  background: rgba(255,68,85,0.06);
  border-color: rgba(255,68,85,0.2);
  color: var(--red);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ══════════════════════════════════════════════
   MOBILE RESPONSIVE IMPROVEMENTS
   ══════════════════════════════════════════════ */

/* ── Core layout ── */
@media (max-width: 768px) {
  .wrap { padding: 0 1rem 3rem; }
  .page-hero { padding: 1.5rem 0 1.25rem; }
  .page-hero h1 { font-size: clamp(1.4rem, 6vw, 2rem); }
  .page-hero .subtitle { font-size: 0.88rem; }

  /* Header */
  #site-header { padding: 0 1rem; }
  .header-inner { height: 52px; }
  .logo-text .l1 { font-size: 0.85rem; }
  .logo-text .l2 { font-size: 0.55rem; }
  .logo-icon { width: 30px; height: 30px; }

  /* Panels */
  .panel { padding: 1rem; }

  /* Metric cards - 2 col on mobile */
  #metrics-grid,
  .metrics-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }

  /* Override 3-col grids */
  div[style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }

  /* Pool comparison columns */
  #compare-cols,
  #compare-grid {
    grid-template-columns: 1fr !important;
  }

  /* 2-col grids become 1-col */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
  }

  /* Input fields */
  .input-wrap input,
  .input-wrap select {
    font-size: 0.88rem;
    padding: 9px 10px;
  }
  .input-unit { padding: 0 8px; font-size: 0.65rem; }
  .field label { font-size: 0.68rem; }

  /* Algo pills */
  #algo-pills, .preset-row { gap: 6px; }
  .algo-pill { font-size: 0.68rem; padding: 5px 10px; }

  /* Tables - make scrollable */
  .data-table { font-size: 0.72rem; }
  .data-table th,
  .data-table td { padding: 7px 8px; }

  /* Buttons */
  .btn { font-size: 0.72rem; padding: 9px 14px; }

  /* Footer grid */
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 1rem; }
}

@media (max-width: 480px) {
  .wrap { padding: 0 0.75rem 2.5rem; }

  /* Single column everything */
  .footer-grid { grid-template-columns: 1fr !important; }

  /* Metric cards - 1 col on very small */
  #metrics-grid,
  .metrics-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .metric-value { font-size: 1.1rem; }

  /* Context bar */
  div[style*="grid-template-columns:repeat(auto-fit,minmax(130px"] {
    grid-template-columns: 1fr 1fr !important;
  }
  div[style*="grid-template-columns:repeat(auto-fit,minmax(140px"] {
    grid-template-columns: 1fr 1fr !important;
  }
  div[style*="grid-template-columns:repeat(auto-fit,minmax(160px"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Algo pills wrap nicely */
  .algo-pill { padding: 4px 8px; font-size: 0.65rem; }

  /* Nav */
  .logo-text .l1 { font-size: 0.8rem; }

  /* Breakdown rows */
  .breakdown-row { font-size: 0.78rem; }

  /* Ranker table horizontal scroll */
  #ranker-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Improved touch targets ── */
@media (max-width: 768px) {
  button, .btn, .preset-btn, .algo-pill, .tab-btn {
    min-height: 36px;
  }
  select, input[type="number"], input[type="text"] {
    min-height: 40px;
  }
  details summary { padding: 0.5rem 0; }
}

/* ── Index page main grid ── */
@media (max-width: 900px) {
  div[style*="grid-template-columns:380px 1fr"] {
    grid-template-columns: 1fr !important;
  }
}
