/* ============================
   ChainForge — Styles
   Clean dark mode, minimal palette
   ============================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

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

  --accent: #38bdf8;
  --accent-dim: rgba(56, 189, 248, 0.12);
  --accent-glow: rgba(56, 189, 248, 0.08);

  --negative: #f87171;

  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.2);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
}

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

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== HEADER ===== */
header {
  padding: 40px 0 16px;
  text-align: center;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 400;
  margin-top: 4px;
}

/* ===== STATUS BAR ===== */
.status-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0 32px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

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

/* ===== SECTION LAYOUT ===== */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.3s ease;
}

.panel:hover {
  border-color: var(--border-hover);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* ===== FORM ===== */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

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

.btn-primary:hover {
  opacity: 0.9;
}

.btn-mine {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  margin-top: 8px;
}

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

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== MINING PANEL ===== */
.mine-section {
  text-align: center;
}

.pending-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.pending-count strong {
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ===== BLOCKCHAIN DISPLAY ===== */
.chain-section {
  margin-bottom: 32px;
}

.chain-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.block-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: border-color 0.3s ease;
  animation: blockAppear 0.4s ease-out;
}

.block-card:hover {
  border-color: var(--border-hover);
}

@keyframes blockAppear {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.block-index {
  display: flex;
  align-items: center;
  gap: 8px;
}

.block-number {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.block-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

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

.block-hashes {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.hash-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.hash-label {
  color: var(--text-muted);
  min-width: 72px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
}

.hash-value {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-size: 0.7rem;
  word-break: break-all;
}

.nonce-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.block-transactions {
  border-top: 1px solid var(--border-glass);
  padding-top: 12px;
}

.block-transactions-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.tx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 0.82rem;
}

.tx-from,
.tx-to {
  font-weight: 500;
  color: var(--text-secondary);
}

.tx-arrow {
  color: var(--text-muted);
}

.tx-amount {
  margin-left: auto;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.tx-reward .tx-from {
  color: var(--text-muted);
  font-style: italic;
}

/* ===== BALANCES ===== */
.balances-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.balances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.balance-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: border-color 0.3s ease;
}

.balance-card:hover {
  border-color: var(--border-hover);
}

.balance-address {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

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

.balance-value.negative {
  color: var(--negative);
}

/* ===== VALIDATION ===== */
.validation-section {
  margin-bottom: 48px;
}

.validation-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
}

.validation-result.valid {
  background: var(--accent-dim);
  border: 1px solid rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

.validation-result.invalid {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.15);
  color: var(--negative);
}

/* ===== MINING OVERLAY ===== */
.mining-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.mining-overlay.active {
  display: flex;
}

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

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

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

.mining-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ===== TOAST MESSAGES ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  animation: toastIn 0.3s ease-out;
  max-width: 320px;
}

.toast.success {
  background: var(--accent-dim);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--accent);
}

.toast.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--negative);
}

.toast.info {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.82rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ===== EMPTY STATES ===== */
.empty-state {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  h1 {
    font-size: 1.5rem;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .status-bar {
    gap: 8px;
  }
  .status-item {
    font-size: 0.75rem;
    padding: 5px 10px;
  }
  .balances-grid {
    grid-template-columns: 1fr 1fr;
  }
  .container {
    padding: 0 16px;
  }
}

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