/* ═══════════════════════════════════════════════════════════════
   toolpad.cc — Shared Design System
   Theme: Dark precision / Terminal elegance
   Fonts: Bebas Neue (display) · DM Mono (body)
   Accent: #ff2200 (red)
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400&display=swap');

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

:root {
  --bg:           #0a0a0a;
  --surface:      #111111;
  --card:         #161616;
  --border:       #1e1e1e;
  --border-2:     #2a2a2a;
  --text:         #e8e0d5;
  --muted:        #555555;
  --muted-2:      #333333;
  --accent:       #ff2200;
  --accent-dim:   rgba(255, 34, 0, 0.07);
  --accent-glow:  rgba(255, 34, 0, 0.18);
  --success:      #00c896;
  --warning:      #f5c518;
  --error:        #ff5555;
  --mono:         'DM Mono', monospace;
  --display:      'Bebas Neue', sans-serif;
  --radius:       2px;
  --max-w:        780px;
  --t:            0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
  opacity: 0.55;
}

/* ── NAVIGATION ───────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.nav-brand {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--text);
  text-decoration: none;
  transition: opacity var(--t);
}
.nav-brand:hover { opacity: 0.8; }
.nav-brand span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}
.nav-links a {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--t);
}
.nav-links a:hover { color: var(--text); }

/* ── MAIN LAYOUT ──────────────────────────────────────────── */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 24px 88px;
}

/* ── TOOL HEADER ──────────────────────────────────────────── */
.tool-header {
  margin-bottom: 52px;
}
.tool-tag {
  font-size: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.tool-header h1 {
  font-family: var(--display);
  font-size: clamp(44px, 9vw, 80px);
  line-height: 0.92;
  letter-spacing: 1px;
  color: var(--text);
  margin-bottom: 18px;
}
.tool-header h1 span { color: var(--accent); }
.tool-desc {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.3px;
  max-width: 500px;
  line-height: 1.7;
}

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
}
.card-sm { padding: 18px; }

/* ── FORM FIELDS ──────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

input, textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 12px 16px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--border-2);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea {
  resize: vertical;
  min-height: 130px;
  line-height: 1.55;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Range */
input[type="range"] {
  padding: 0;
  height: 4px;
  background: var(--border-2);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  accent-color: var(--accent);
  box-shadow: none;
}
input[type="range"]:focus { box-shadow: none; }

/* ── BUTTONS ──────────────────────────────────────────────── */
button, .btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 12px 28px;
  transition: all var(--t);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #ff3a20;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-size: 11px;
}
.btn-ghost:hover { color: var(--text); }

/* ── STAT GRID ────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  gap: 12px;
}
.stat-grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
}
.stat-value {
  font-family: var(--display);
  font-size: clamp(26px, 4.5vw, 42px);
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }
.stat-label {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── OUTPUT ───────────────────────────────────────────────── */
.output-block {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 52px 16px 16px;
  font-size: 14px;
  word-break: break-all;
  min-height: 50px;
  line-height: 1.6;
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1px;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--t);
  font-family: var(--mono);
  text-transform: uppercase;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

/* ── CODE OUTPUT ──────────────────────────────────────────── */
.code-output {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── ALERTS ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  border: 1px solid;
  line-height: 1.5;
}
.alert-error   { border-color: var(--error);   color: var(--error);   background: rgba(255,85,85,0.05); }
.alert-success { border-color: var(--success); color: var(--success); background: rgba(0,200,150,0.05); }
.alert-warning { border-color: var(--warning); color: var(--warning); background: rgba(245,197,24,0.05); }

/* ── DIVIDER ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
}

/* ── TABS ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 18px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: all var(--t);
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── TOGGLE GROUP ─────────────────────────────────────────── */
.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  transition: all var(--t);
  user-select: none;
}
.toggle-item:hover { border-color: var(--border-2); color: var(--text); }
.toggle-item.active { border-color: var(--accent); color: var(--text); background: var(--accent-dim); }

/* ── SPINNER ──────────────────────────────────────────────── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* ── FOOTER ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--t);
}
.site-footer a:hover { color: var(--text); }

/* ── ANIMATIONS ───────────────────────────────────────────── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.animate-fade-down { animation: fadeDown 0.5s ease both; }
.animate-fade-up   { animation: fadeUp  0.55s ease 0.05s both; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 640px) {
  main { padding: 36px 16px 64px; }
  .site-nav { padding: 0 16px; }
  .card { padding: 20px 16px; }
  .stat-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .tool-header { margin-bottom: 36px; }
}

/* ── UTILITY ──────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-small { font-size: 12px; }
.text-xs { font-size: 11px; letter-spacing: 0.5px; }
.hidden { display: none !important; }
.w-full { width: 100%; }
