/* ============================================================
   TOOLBOX — Shared Design System
   Import this in every tool page:
   <link rel="stylesheet" href="../assets/style.css">
   ============================================================ */

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

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

/* ── Tokens ── */
:root {
  --accent:        #0066FF;
  --accent-light:  #E5EFFF;
  --accent-dark:   #0047B3;

  --ink:           #0A0A0A;
  --ink-2:         #444444;
  --ink-3:         #888888;
  --ink-4:         #BBBBBB;

  --bg:            #FFFFFF;
  --bg-2:          #F7F7F7;
  --bg-3:          #F0F0F0;
  --nav-bg:        #0A0A0A;
  --nav-ink:       #FFFFFF;

  --border:        #E8E8E8;
  --border-strong: #D0D0D0;

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

  --sans:  'Syne', sans-serif;
  --mono:  'IBM Plex Mono', monospace;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow:    0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
}

html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* ── Shared Nav ── */
.site-nav {
  background: var(--nav-bg);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 0;
}
.site-nav .nav-logo {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 15px;
  color: var(--nav-ink);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-nav .nav-logo .logo-mark {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.site-nav .nav-spacer { flex: 1; }
.site-nav .nav-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav .nav-back {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.site-nav .nav-back:hover { color: #fff; }
.site-nav .nav-back::before { content: '←'; }

/* ── Tool page shell ── */
.tool-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.tool-header { margin-bottom: 32px; }
.tool-header .tool-category {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tool-header .tool-category::before {
  content: '';
  width: 16px; height: 1.5px;
  background: var(--accent);
  display: inline-block;
}
.tool-header h1 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 8px;
}
.tool-header p {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 300;
}

/* ── Cards / Surfaces ── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* ── Stat Cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-card.accent { background: var(--accent-light); border-color: #C0D8FF; }
.stat-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.stat-card.accent .stat-label { color: var(--accent-dark); }
.stat-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
}
.stat-card.accent .stat-value { color: var(--accent); }
.stat-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 4px;
  font-weight: 300;
}

/* ── Form elements ── */
textarea, input[type="text"], input[type="number"], select {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 300;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
textarea:focus, input[type="text"]:focus, input[type="number"]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,102,255,0.10);
}
textarea { resize: vertical; line-height: 1.7; }
textarea::placeholder, input::placeholder { color: var(--ink-4); }
label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  display: block;
  margin-bottom: 6px;
}

/* ── Buttons ── */
.btn {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); border-color: var(--ink-3); }
.btn-ghost.danger:hover { background: #FFF0F0; color: #CC0000; border-color: #FFB3B3; }
.btn-success { background: #00875A; color: #fff; border-color: #00875A; }
.btn-success:hover { background: #006644; }

/* ── Section label ── */
.section-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-wrap: wrap;
  gap: 8px;
}
.toolbar-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
}
.toolbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Editor wrap ── */
.editor-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  transition: box-shadow 0.2s;
}
.editor-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,102,255,0.10);
}
.editor-wrap textarea {
  border: none;
  border-radius: 0;
  padding: 18px;
  min-height: 220px;
  box-shadow: none !important;
}

/* ── Progress bar ── */
.progress-bar { height: 3px; background: var(--bg-3); }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s, background 0.2s; }
.progress-fill.warn { background: #F59E0B; }
.progress-fill.over { background: #EF4444; }

/* ── Tags / Badges ── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-2);
}
.tag-count {
  background: var(--border-strong);
  color: var(--ink-3);
  border-radius: 99px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 500;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 20px;
  border-radius: 99px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 999;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 300;
}

/* ── Utilities ── */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.text-muted { color: var(--ink-3); font-family: var(--mono); font-size: 12px; font-weight: 300; }

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-page { padding: 24px 16px 60px; }
}
