/* Rubby Design System — clean, minimalist, flat dark-mode */
/* Deep dark layers, subtle borders, vibrant crimson primary */

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

/* ─── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  /* Color — solid dark layers */
  --bg-base: #09090b;
  --bg-surface: #121215;
  --bg-raised: #18181b;
  --bg-overlay: #1f1f23;
  --border: #27272a;
  --border-hover: #3f3f46;

  /* Primary — crimson red */
  --primary: #dc2626;
  --primary-hover: #ef4444;
  --primary-muted: rgba(220, 38, 38, 0.12);
  --primary-border: rgba(220, 38, 38, 0.3);

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  /* Accent (success/warning) */
  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.12);
  --warning: #eab308;
  --warning-muted: rgba(234, 179, 8, 0.12);

  /* Typography */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Shadows (subtle, no glow) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ─── Base Reset ────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Typography ────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 0.9375rem; font-weight: 600; }

p, label, a, li {
  font-family: var(--font-body);
  font-weight: 400;
}

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

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

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary — crimson */
.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

/* Secondary — subtle border */
.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-overlay);
  border-color: var(--border-hover);
}

/* Ghost — minimal */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

/* Danger */
.btn-danger {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.btn-danger:hover {
  background: var(--primary-muted);
}

/* Small variant */
.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

/* ─── Inputs ────────────────────────────────────────────────────────────── */
.input {
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

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

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.input {
  resize: vertical;
  min-height: 80px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease;
  position: relative;
}

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

.card-flat {
  background: var(--bg-raised);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 1px solid var(--border);
}

/* ─── Badges / Chips ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}

.badge-success {
  background: var(--success-muted);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-muted);
  color: var(--warning);
}

.badge-primary {
  background: var(--primary-muted);
  color: var(--primary-hover);
}

.badge-neutral {
  background: var(--bg-overlay);
  color: var(--text-secondary);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-overlay);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ─── Stat Cards ────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Motion: respect reduced-motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .card,
  .input {
    transition: none;
  }
}

/* ─── Focus states (keyboard accessibility) ─────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.input:focus-visible {
  outline: none;
}

a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
