/* ==============================
   CoinWarz Static Clone - main.css
   Dark industrial mining aesthetic
   ============================== */

/* ----- CSS Variables ----- */
:root {
  --bg-primary: #0a0c10;
  --bg-card: #14181f;
  --bg-card-hover: #1c2128;
  --bg-elevated: #191d24;
  --border-subtle: #2a3038;
  --border-hover: #3a4048;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;
  --text-muted: #6b7280;
  --accent-orange: #f7931a;
  --accent-orange-hover: #ffa733;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-yellow: #f4b728;
  --shadow-card: 0 4px 12px rgba(0,0,0,0.4);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Helvetica Neue', 'Arial', 'Noto Sans SC', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, Consolas, monospace;
  --header-h: 64px;
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
button {
  font-family: inherit; cursor: pointer; background: none; border: none;
  color: inherit; padding: 0;
}
img { max-width: 100%; display: block; }
h1,h2,h3,h4,h5,h6 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* ----- Utility ----- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 768px) {
  .container { padding: 0 24px; }
}
.mono { font-family: var(--font-mono); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }
.text-blue { color: var(--accent-blue); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(247,147,26,0.12);
  color: var(--accent-orange);
  border-radius: 999px;
  border: 1px solid rgba(247,147,26,0.25);
}
.badge.badge-blue { background: rgba(59,130,246,0.14); color: var(--accent-blue); border-color: rgba(59,130,246,0.28); }
.badge.badge-green { background: rgba(34,197,94,0.14); color: var(--accent-green); border-color: rgba(34,197,94,0.28); }
.badge.badge-gray { background: rgba(154,160,166,0.12); color: var(--text-secondary); border-color: rgba(154,160,166,0.22); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s, border 0.2s, color 0.2s;
  min-height: 44px;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent-orange); color: #0a0c10; }
.btn-primary:hover { background: var(--accent-orange-hover); }
.btn-ghost { color: var(--text-primary); border: 1px solid var(--border-subtle); }
.btn-ghost:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 32px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-hover); }

/* ----- Boot loading ----- */
.boot-loading {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-secondary);
}
.boot-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-orange);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Header ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10,12,16,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding-top: env(safe-area-inset-top);
}
.site-header .inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
}
.brand {
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-orange) 0%, #ffb347 100%);
  display: flex; align-items: center; justify-content: center;
  color: #0a0c10; font-weight: 800; font-size: 16px;
}
.nav {
  display: none;
  align-items: center;
  gap: 4px;
  flex: 1;
}
@media (min-width: 900px) { .nav { display: flex; } }
.nav a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color .18s, background .18s;
}
.nav a:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.nav a.active { color: var(--accent-orange); background: rgba(247,147,26,0.09); }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.lang-switcher {
  position: relative;
}
.lang-switcher .lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-card);
  min-height: 40px;
}
.lang-switcher .lang-btn:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.lang-switcher .lang-menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 6px;
  min-width: 160px;
  box-shadow: var(--shadow-card);
  display: none;
  z-index: 60;
}
.lang-switcher.open .lang-menu { display: block; }
.lang-switcher .lang-menu button {
  display: flex; width: 100%; text-align: left; padding: 8px 12px;
  border-radius: 6px; font-size: 14px; color: var(--text-primary);
  align-items: center; gap: 8px;
}
.lang-switcher .lang-menu button:hover { background: var(--bg-card-hover); }
.lang-switcher .lang-menu button.active { color: var(--accent-orange); }

.menu-toggle {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
@media (min-width: 900px) { .menu-toggle { display: none; } }

.mobile-nav {
  display: none;
  border-top: 1px solid var(--border-subtle);
  padding: 12px 16px 16px;
  gap: 4px;
  flex-direction: column;
  background: rgba(10,12,16,0.98);
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  min-height: 44px;
  display: flex; align-items: center;
}
.mobile-nav a.active { color: var(--accent-orange); background: rgba(247,147,26,0.09); }
.mobile-nav a:hover { color: var(--text-primary); background: var(--bg-card-hover); }

/* ----- Footer ----- */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 48px 0 32px;
  margin-top: 80px;
  background: #0b0e13;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 32px;
}
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
@media (max-width: 500px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-col h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-secondary); margin-bottom: 12px; font-weight: 700;
}
.footer-col ul { display: flex; flex-direction: column; gap: 6px; }
.footer-col a {
  color: var(--text-primary);
  font-size: 14px;
  padding: 4px 0;
  min-height: 32px;
  display: inline-flex; align-items: center;
}
.footer-col a:hover { color: var(--accent-orange); }
.footer-bottom {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  color: var(--text-muted); font-size: 13px;
}

/* ----- Hero ----- */
.hero {
  padding: 56px 0 40px;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-orange); font-size: 12px;
  font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  font-weight: 700;
}
.hero h1 .accent { color: var(--accent-orange); }
.hero .lead {
  color: var(--text-secondary);
  font-size: 17px;
  max-width: 640px;
  margin-bottom: 24px;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 40px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}
.stat-card .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary); font-weight: 600;
}
.stat-card .value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text-primary);
}
.stat-card .change { font-size: 12px; margin-top: 4px; font-family: var(--font-mono); }

/* ----- Section ----- */
.section { padding: 56px 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: end;
  margin-bottom: 24px; gap: 12px; flex-wrap: wrap;
}
.section-head h2 {
  font-size: clamp(22px, 3.5vw, 30px);
  letter-spacing: -0.02em;
}
.section-head .sub { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.section-head a.more {
  color: var(--accent-orange); font-size: 14px; font-weight: 600;
}
.section-head a.more:hover { color: var(--accent-orange-hover); }

/* ----- Table ----- */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.data {
  width: 100%; min-width: 720px; border-collapse: collapse;
}
table.data th, table.data td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
  white-space: nowrap;
}
table.data th {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.02);
  position: sticky; top: 0;
}
table.data tbody tr { transition: background 0.15s; cursor: pointer; }
table.data tbody tr:hover { background: var(--bg-card-hover); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-family: var(--font-mono); }
.coin-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.coin-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  color: #0a0c10;
  flex-shrink: 0;
}
.coin-cell .coin-name { font-weight: 600; }
.coin-cell .coin-ticker { color: var(--text-secondary); font-size: 12px; }

/* ----- Cards Grid ----- */
.cards-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color .2s, transform .2s;
}
.tool-card:hover { border-color: var(--accent-orange); transform: translateY(-2px); }
.tool-card .icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: rgba(247,147,26,0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-orange); font-size: 20px;
}
.tool-card h3 { font-size: 18px; }
.tool-card p { color: var(--text-secondary); font-size: 14px; }
.tool-card .arrow { margin-top: auto; color: var(--accent-orange); font-weight: 600; font-size: 14px; }

/* News */
.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-item {
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color .2s;
  cursor: pointer;
}
.news-item:hover { border-color: var(--border-hover); }
.news-item .meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-secondary); margin-bottom: 8px;
  flex-wrap: wrap;
}
.news-item h3 { font-size: 17px; line-height: 1.35; margin-bottom: 8px; }
.news-item .summary { color: var(--text-secondary); font-size: 14px; }
.news-item .tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--text-muted); padding: 2px 8px; border-radius: 4px; background: rgba(255,255,255,0.04); }

/* Page header for sub pages */
.page-header {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 32px;
}
.page-header h1 {
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.page-header p { color: var(--text-secondary); max-width: 720px; }
.breadcrumb {
  display: flex; gap: 6px; align-items: center;
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 16px;
}
.breadcrumb a:hover { color: var(--accent-orange); }

/* Filter row */
.filter-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  min-height: 36px;
  transition: all .15s;
}
.filter-btn:hover { color: var(--text-primary); border-color: var(--border-hover); }
.filter-btn.active { background: var(--accent-orange); color: #0a0c10; border-color: var(--accent-orange); font-weight: 600; }
.search-input {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  min-width: 240px;
  min-height: 40px;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--accent-orange); }

/* Detail layouts */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }
.spec-table {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.spec-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
}
.spec-row:last-child { border-bottom: none; }
.spec-row .k { color: var(--text-secondary); }
.spec-row .v { font-family: var(--font-mono); font-weight: 600; text-align: right; }

/* Chart placeholder */
.chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  height: 320px;
  position: relative;
}
.chart-box svg { width: 100%; height: 100%; display: block; }

/* Calculator form */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
@media (max-width: 800px) { .calc-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.form-group .hint { font-size: 12px; color: var(--text-muted); }
.form-group input, .form-group select {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font: inherit; font-size: 15px;
  font-family: var(--font-mono);
  min-height: 44px;
  outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent-orange); }
.result-panel {
  background: linear-gradient(180deg, rgba(247,147,26,0.06) 0%, transparent 100%);
  border: 1px solid rgba(247,147,26,0.28);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.result-panel h3 { color: var(--accent-orange); margin-bottom: 20px; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; }
.result-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border-subtle); font-size: 14px; }
.result-row:last-child { border-bottom: none; }
.result-row .k { color: var(--text-secondary); }
.result-row .v { font-family: var(--font-mono); font-weight: 700; font-size: 16px; }
.result-row.big .v { font-size: 20px; color: var(--accent-orange); }

/* Article */
.article-hero { padding: 40px 0; border-bottom: 1px solid var(--border-subtle); margin-bottom: 32px; }
.article-hero h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.2; margin-bottom: 16px; letter-spacing: -0.02em; }
.article-hero .meta {
  display: flex; gap: 16px; color: var(--text-secondary); font-size: 13px;
  flex-wrap: wrap;
}
.article-body {
  max-width: 720px;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
}
.article-body p { margin-bottom: 18px; color: var(--text-secondary); }
.article-body h2 { font-size: 22px; margin: 32px 0 14px; color: var(--text-primary); }
.article-body h3 { font-size: 18px; margin: 24px 0 10px; color: var(--text-primary); }
.article-body ul { margin: 12px 0 18px 20px; }
.article-body li { list-style: disc; margin-bottom: 8px; color: var(--text-secondary); }

/* Live indicator */
.live-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  margin-right: 6px;
  vertical-align: middle;
}
.live-indicator {
  display: inline-flex; align-items: center;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-secondary); font-weight: 600;
}

/* Empty */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .icon { font-size: 32px; margin-bottom: 12px; opacity: .5; }

/* Sparkline */
.sparkline { height: 32px; width: 90px; }

/* Utility spacing */
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.grid { display: grid; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* No hover on touch */
@media (hover: none) {
  .tool-card:hover { transform: none; }
}
