/* =========================================================================
   ResumeDesk Design System v0.1
   Source of truth: design handoff tokens (Design System.dc.html).
   Trust, clarity, truthfulness — never a black box, never a generic
   SaaS template.
   ========================================================================= */

:root {
  /* Primary — Signal (blue) */
  --rd-primary-50: #EEF1FF;
  --rd-primary-100: #DCE3FF;
  --rd-primary-200: #B9C8FF;
  --rd-primary-400: #6478FF;
  --rd-primary-500: #3652F6;
  --rd-primary-600: #2A3ED1;
  --rd-primary-700: #202FA3;
  --rd-primary-900: #141C5C;

  /* Neutral — Ink (warm gray) */
  --rd-ink-0: #FFFFFF;
  --rd-ink-50: #F8F9FB;
  --rd-ink-100: #F1F2F5;
  --rd-ink-200: #E4E6EB;
  --rd-ink-300: #D2D5DC;
  --rd-ink-400: #B0B4BF;
  --rd-ink-500: #7C8191;
  --rd-ink-600: #5B6072;
  --rd-ink-700: #3F4354;
  --rd-ink-800: #292C3A;
  --rd-ink-900: #1B1D27;
  --rd-ink-950: #14161A;

  /* Semantic */
  --rd-success: #12A594;
  --rd-success-bg: #E4F7F4;
  --rd-success-text: #0B6B60;
  --rd-warning: #F0A83E;
  --rd-warning-bg: #FDF0DC;
  --rd-warning-text: #8A5A0C;
  --rd-error: #E5484D;
  --rd-error-hover: #C93338;
  --rd-error-active: #A8262B;
  --rd-error-bg: #FCE8E8;
  --rd-error-text: #A3282C;
  --rd-info: #2F80ED;
  --rd-info-bg: #EAF2FE;
  --rd-info-text: #1D4E9B;

  /* Typography */
  --rd-font-display: 'Sora', sans-serif;
  --rd-font-body: 'Public Sans', sans-serif;
  --rd-font-mono: 'IBM Plex Mono', monospace;

  /* Spacing (4px base unit) */
  --rd-space-1: 4px;
  --rd-space-2: 8px;
  --rd-space-3: 12px;
  --rd-space-4: 16px;
  --rd-space-6: 24px;
  --rd-space-8: 32px;
  --rd-space-12: 48px;
  --rd-space-16: 64px;
  --rd-space-24: 96px;

  /* Radius */
  --rd-radius-control: 8px;
  --rd-radius-card: 12px;
  --rd-radius-card-lg: 16px;
  --rd-radius-full: 999px;

  /* Shadows */
  --rd-shadow-card: 0 1px 2px rgba(16,17,25,0.04), 0 4px 16px rgba(16,17,25,0.06);
  --rd-shadow-elevated: 0 20px 46px rgba(20,28,92,0.18);
  --rd-shadow-btn-primary: 0 8px 18px rgba(54,82,246,0.3);

  --rd-content-max: 1180px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--rd-font-body);
  font-size: 16px;
  color: var(--rd-ink-800);
  background: var(--rd-ink-50);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }

/* lucide.createIcons() replaces every <i data-lucide="..."> with an inline
   <svg class="lucide lucide-{name}">. Many of those sit inside a
   `display:flex` row (icon + label) that never sets `align-items`, which
   defaults to `stretch` - that vertically stretches a small square icon
   into a distorted rectangle instead of leaving it at its own width/height.
   Fixing it here, on the class the library itself applies, corrects every
   icon everywhere at once instead of patching dozens of inline flex
   containers one by one. */
svg.lucide { flex-shrink: 0; align-self: center; }

a { color: var(--rd-primary-500); text-decoration: none; }
/* Scoped to exclude .btn: a bare `a:hover` rule beats `.btn-primary`'s own
   (non-hover) `color: #fff` in specificity for the `color` property, since
   none of the .btn-*:hover rules below redeclare color - so every plain
   `<a class="btn btn-primary">` anywhere in the app (which is most CTAs;
   only POST-form buttons are real <button> elements) silently got its text
   repainted to --rd-primary-600 on hover. For .btn-primary specifically,
   that's the exact same value the hover background already changes to,
   making the label disappear completely. Excluding .btn here - plus the
   explicit `color` added to each .btn-*:hover rule below - closes this off
   for every current and future button variant, not just this one. */
a:not(.btn):hover { color: var(--rd-primary-600); }
::selection { background: var(--rd-primary-100); }
h1, h2, h3, h4 { font-family: var(--rd-font-display); margin: 0; color: var(--rd-ink-800); }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }

.rd-container {
  max-width: var(--rd-content-max);
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 640px) {
  .rd-container { padding: 0 20px; }
}

/* ---------- Typography scale ---------- */
.rd-display { font-family: var(--rd-font-display); font-weight: 800; font-size: 56px; line-height: 1.1; letter-spacing: -0.02em; }
.rd-h1 { font-family: var(--rd-font-display); font-weight: 700; font-size: 34px; line-height: 1.2; letter-spacing: -0.01em; }
.rd-h2 { font-family: var(--rd-font-display); font-weight: 600; font-size: 24px; }
.rd-h3 { font-family: var(--rd-font-display); font-weight: 600; font-size: 17px; }
.rd-body { font-size: 16px; line-height: 1.6; color: var(--rd-ink-800); }
.rd-body-sm { font-size: 14px; line-height: 1.5; color: var(--rd-ink-600); }
.rd-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--rd-ink-500); }
.rd-mono { font-family: var(--rd-font-mono); color: var(--rd-primary-900); }
@media (max-width: 640px) {
  .rd-display { font-size: 36px; }
  .rd-h1 { font-size: 26px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--rd-radius-control);
  border: none;
  font-family: var(--rd-font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
  text-decoration: none;
}
.btn:disabled { cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 13px; }

.btn-primary { background: var(--rd-primary-500); color: #fff; box-shadow: var(--rd-shadow-btn-primary); }
.btn-primary:hover:not(:disabled) { background: var(--rd-primary-600); color: #fff; transform: translateY(-1px); }
.btn-primary:disabled { background: var(--rd-ink-200); color: var(--rd-ink-400); box-shadow: none; }

.btn-secondary { background: #fff; color: var(--rd-ink-800); border: 1px solid var(--rd-ink-300); }
.btn-secondary:hover:not(:disabled) { border-color: var(--rd-primary-500); background: var(--rd-primary-50); color: var(--rd-ink-800); }
.btn-secondary:disabled { color: var(--rd-ink-300); }

.btn-ghost { background: transparent; color: var(--rd-ink-700); }
.btn-ghost:hover:not(:disabled) { background: var(--rd-ink-100); color: var(--rd-ink-700); }
.btn-ghost:disabled { color: var(--rd-ink-300); }

/* White text directly on --rd-error (#E5484D) measures 3.91:1 - below the
   4.5:1 WCAG AA minimum for normal-size text, even though the same red
   reads fine elsewhere (icons, borders, badges paired with a dark text
   color instead of white). --rd-error-hover as the resting fill clears
   AA (5.23:1); --rd-error-active is a further-darkened step for :hover. */
.btn-destructive { background: var(--rd-error-hover); color: #fff; }
.btn-destructive:hover:not(:disabled) { background: var(--rd-error-active); color: #fff; }
.btn-destructive:disabled { background: var(--rd-error-bg); color: #F0AEB0; }

/* ---------- Form inputs ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--rd-ink-700); margin-bottom: 6px; }
.form-control {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--rd-ink-300);
  border-radius: var(--rd-radius-control);
  font-family: var(--rd-font-body);
  font-size: 14px;
  color: var(--rd-ink-800);
  background: #fff;
}
textarea.form-control { height: auto; padding: 12px 14px; resize: vertical; min-height: 96px; }
.form-control:focus {
  outline: none;
  border-color: var(--rd-primary-500);
  box-shadow: 0 0 0 3px rgba(54,82,246,0.15);
}
.form-control::placeholder { color: var(--rd-ink-400); }
.form-control:disabled { background: var(--rd-ink-50); color: var(--rd-ink-400); }
.form-control.has-error { border-color: var(--rd-error); }
.form-error { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--rd-error-text); margin-top: 6px; }
.form-hint { font-size: 12px; color: var(--rd-ink-500); margin-top: 6px; }
.form-password-wrap { position: relative; }
.form-password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer; padding: 4px; display: flex; color: var(--rd-ink-500);
}
.form-check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--rd-ink-800); }
.form-check input { width: 18px; height: 18px; accent-color: var(--rd-primary-500); }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--rd-ink-200); border-radius: var(--rd-radius-card); box-shadow: var(--rd-shadow-card); padding: 20px; }
.card:hover.card-hoverable { border-color: var(--rd-primary-200); box-shadow: 0 4px 20px rgba(16,17,25,0.08); transform: translateY(-1px); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: var(--rd-radius-full); }
.badge-success { background: var(--rd-success-bg); color: var(--rd-success-text); }
.badge-warning { background: var(--rd-warning-bg); color: var(--rd-warning-text); }
.badge-error { background: var(--rd-error-bg); color: var(--rd-error-text); }
.badge-info { background: var(--rd-info-bg); color: var(--rd-info-text); }
.badge-neutral { background: var(--rd-ink-100); color: var(--rd-ink-700); }
.badge-pro { background: var(--rd-primary-900); color: #fff; font-weight: 700; }
.badge-outline { border: 1px solid var(--rd-ink-300); color: var(--rd-ink-600); }

/* ---------- Alerts / banners ---------- */
.alert { display: flex; gap: 9px; align-items: flex-start; border-radius: var(--rd-radius-control); padding: 12px 14px; font-size: 13px; line-height: 1.4; }
.alert-error { background: var(--rd-error-bg); border: 1px solid #F5C2C4; color: var(--rd-error-text); }
.alert-success { background: var(--rd-success-bg); border: 1px solid #A9E4DB; color: var(--rd-success-text); }
.alert-warning { background: var(--rd-warning-bg); border: 1px solid #F5D9A8; color: var(--rd-warning-text); }
.alert-info { background: var(--rd-info-bg); border: 1px solid #BBD6FA; color: var(--rd-info-text); }

/* ---------- Skeleton / spinner ---------- */
@keyframes rd-spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: rd-spin 0.7s linear infinite;
}
.spinner-dark { border: 3px solid var(--rd-ink-200); border-top-color: var(--rd-primary-500); width: 26px; height: 26px; }

/* ---------- Empty state ---------- */
.empty-state { background: #fff; border: 1px dashed var(--rd-ink-300); border-radius: var(--rd-radius-card); padding: 48px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty-state-icon { width: 44px; height: 44px; border-radius: var(--rd-radius-card); background: var(--rd-primary-50); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }

/* ---------- Animations ---------- */
@keyframes rd-fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rd-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes rd-shake { 10%,90% { transform: translateX(-1px); } 20%,80% { transform: translateX(2px); } 30%,50%,70% { transform: translateX(-4px); } 40%,60% { transform: translateX(4px); } }
@keyframes rd-grow-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.rd-fade-up { animation: rd-fade-up 0.4s ease both; }
.rd-shake { animation: rd-shake 0.5s ease; }

/* ---------- Utility ---------- */
.rd-flex { display: flex; }
.rd-flex-col { display: flex; flex-direction: column; }
.rd-items-center { align-items: center; }
.rd-justify-between { justify-content: space-between; }
.rd-gap-1 { gap: 4px; } .rd-gap-2 { gap: 8px; } .rd-gap-3 { gap: 12px; } .rd-gap-4 { gap: 16px; } .rd-gap-6 { gap: 24px; }
.rd-mt-2 { margin-top: 8px; } .rd-mt-4 { margin-top: 16px; } .rd-mt-6 { margin-top: 24px; } .rd-mt-8 { margin-top: 32px; }
.rd-mb-2 { margin-bottom: 8px; } .rd-mb-4 { margin-bottom: 16px; } .rd-mb-6 { margin-bottom: 24px; } .rd-mb-8 { margin-bottom: 32px; }
.rd-text-center { text-align: center; }
.rd-w-full { width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Minimum tap target enforcement per accessibility brief */
button, a.btn, input, select, textarea { min-height: 44px; }
textarea { min-height: 96px; }
