/* Shared design system — colors, typography, buttons, cards, forms.
   Loaded by ALL tools and the homepage. Tool-specific layout stays in each tool's own CSS. */

/* ── Reset ──────────────────────────────────────────────────────────────────── */

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

/* ── Color tokens ────────────────────────────────────────────────────────────
   Single source of truth. Reference these in tool-specific CSS too.          */

:root {
  --bg-base:        #f8f9fa;
  --bg-surface:     #ffffff;
  --bg-overlay:     #f3f4f6;
  --bg-hover:       #e5e7eb;

  --border:         #e5e7eb;
  --border-mid:     #d1d5db;

  --text-primary:   #1a1a2e;
  --text-secondary: #374151;
  --text-muted:     #6b7280;

  --accent:         #7c3aed;
  --accent-dim:     #6d28d9;

  --danger:         #dc2626;
  --success:        #16a34a;
  --warning:        #d97706;

  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  10px;
  --radius-xl:  14px;
}

/* ── Dark mode variable overrides ────────────────────────────────────────────
   All pages: just add class="dark" on <body> to activate.                    */

body.dark {
  --bg-base:        #1e1e2e;
  --bg-surface:     #181825;
  --bg-overlay:     #313244;
  --bg-hover:       #45475a;
  --border:         #45475a;
  --border-mid:     #585b70;
  --text-primary:   #cdd6f4;
  --text-secondary: #bac2de;
  --text-muted:     #a6adc8;
  --accent:         #cba6f7;
  --accent-dim:     #b4a4e0;
}

/* html background + color-scheme: prevents black flash during browser navigation (back/forward).
   The browser paints <html> before <body> — without this, it shows black briefly. */
html              { background: #f8f9fa; color-scheme: light; }
html.dark         { background: #1e1e2e; color-scheme: dark; }
html.dark body    { background: #1e1e2e; }

/* ── Theme toggle button (used on all pages) ──────────────────────────────── */

.theme-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  line-height: 0;
  transition: opacity 0.15s;
}

.theme-toggle-btn:hover {
  opacity: 0.7;
}

.theme-toggle-btn img {
  display: block;
  height: 68px;
  width: auto;
}

/* ── Typography ──────────────────────────────────────────────────────────────*/

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 700;
}

/* ── Utility ─────────────────────────────────────────────────────────────────*/

.hidden { display: none !important; }

.text-accent   { color: var(--accent); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }

/* ── Buttons ─────────────────────────────────────────────────────────────────*/

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  min-height: 44px; /* touch target */
  white-space: nowrap;
  text-decoration: none;
}

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

.btn-secondary {
  background: var(--bg-overlay);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: var(--bg-surface);
}
.btn-danger:hover {
  opacity: 0.85;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  min-height: 32px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ── Cards ───────────────────────────────────────────────────────────────────*/

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.card-desc {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Tool card (clickable, navigates to a tool) ──────────────────────────────*/

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem 2rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.tool-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 24px rgba(203, 166, 247, 0.15);
  transform: translateY(-2px);
}

.tool-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.tool-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tool-card-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.tool-card-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  background: var(--bg-hover);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: auto;
}

.tool-card-badge.badge-ready {
  background: rgba(166, 227, 161, 0.12);
  color: var(--success);
}

.tool-card-badge.badge-soon {
  background: var(--bg-hover);
  color: var(--text-muted);
}

/* ── Form inputs ─────────────────────────────────────────────────────────────*/

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.form-input {
  background: var(--bg-overlay);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  padding: 0.45rem 0.7rem;
  width: 100%;
  transition: border-color 0.12s;
}

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

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

/* ── Section title ───────────────────────────────────────────────────────────*/

.section-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Divider ─────────────────────────────────────────────────────────────────*/

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* ── Print base ──────────────────────────────────────────────────────────────*/

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .no-print { display: none !important; }
}
