/* Resumerush Design Tokens */
:root {
  /* Light mode colors */
  --bg-canvas: #FAFAF7;
  --bg-surface: #FFFFFF;
  --bg-sunken: #F1EFEA;
  --text-primary: #111111;
  --text-secondary: #5A5A5A;
  --text-muted: #8C8C8C;
  --accent-primary: #6CB274;
  --accent-primary-hover: #5BA065;
  --accent-rgb: 108, 178, 116;
  --accent-secondary: #1E3A8A;
  --success: #16A34A;
  --warning: #D97706;
  --error: #DC2626;
  --border-default: #E5E3DE;
  --border-strong: #C4C2BC;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 24px 48px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 0 4px rgba(var(--accent-rgb), 0.22);

  /* Type */
  --font-display: 'Instrument Serif', 'Georgia', serif;
  --font-ui: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Radii */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-pill: 9999px;

  /* Motion */
  --e-out: cubic-bezier(0.16, 1, 0.3, 1);
  --e-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --d-fast: 120ms;
  --d-base: 220ms;
  --d-slow: 360ms;
}

.dark {
  --bg-canvas: #0E0F12;
  --bg-surface: #16181C;
  --bg-sunken: #0A0B0E;
  --text-primary: #F5F5F2;
  --text-secondary: #A3A3A0;
  --text-muted: #6E6E6B;
  --accent-primary: #7FC788;
  --accent-primary-hover: #92D29B;
  --accent-secondary: #7AA2FF;
  --success: #4ADE80;
  --warning: #FBBF24;
  --error: #F87171;
  --border-default: #26282E;
  --border-strong: #3A3D44;
  --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 24px 48px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
/* Poppins runs a touch heavier — calibrate weights down */
h1, h2, h3, h4 { font-weight: 600; }
strong, b { font-weight: 600; }

#root { min-height: 100vh; }

/* Type scale */
.t-display { font-family: var(--font-display); font-size: 56px; line-height: 60px; letter-spacing: -0.02em; font-weight: 400; }
.t-h1 { font-family: var(--font-display); font-size: 40px; line-height: 44px; letter-spacing: -0.015em; font-weight: 400; }
/* When display font is a sans, headlines need heavier weight + tighter tracking */
[data-display-font="poppins"] .t-display,
[data-display-font="poppins"] .t-h1 { font-weight: 700; letter-spacing: -0.035em; }
[data-display-font="poppins"] .t-display { line-height: 1.02; }
[data-display-font="poppins"] .t-h1 { line-height: 1.08; }
.t-h2 { font-size: 28px; line-height: 34px; letter-spacing: -0.015em; font-weight: 600; }
.t-h3 { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
.t-body-lg { font-size: 17px; line-height: 26px; font-weight: 400; }
.t-body { font-size: 15px; line-height: 22px; font-weight: 400; }
.t-body-sm { font-size: 13px; line-height: 19px; font-weight: 400; }
.t-caption { font-size: 11px; line-height: 16px; letter-spacing: 0.02em; }
.t-mono { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.02em; }

/* Poppins display use — when in display contexts swap to display sans */
.font-display-sans .t-display,
.font-display-sans .t-h1 { font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.03em; }

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

/* Buttons */
.btn {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--d-fast) var(--e-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  height: 40px;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  color: inherit;
}
.btn:focus-visible { outline: none; box-shadow: var(--shadow-glow); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 14px; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-sunken); }
.btn-text {
  background: transparent;
  color: var(--accent-primary);
  padding: 0 8px;
}
.btn-text:hover { background: rgba(var(--accent-rgb),0.10); }
.btn-destructive {
  background: var(--error);
  color: #fff;
}
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--bg-sunken); color: var(--text-primary); }

/* Inputs */
.input {
  font-family: var(--font-ui);
  font-size: 16px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  transition: border-color var(--d-fast) var(--e-out), box-shadow var(--d-fast) var(--e-out);
}
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--border-strong); box-shadow: var(--shadow-glow); }
.input::placeholder { color: var(--text-muted); }
.input.error { border-color: var(--error); }
.input-lg { font-size: 18px; padding: 14px 18px; }
.input-xl { font-size: 32px; padding: 18px 0; border: none; border-bottom: 2px solid var(--border-default); border-radius: 0; background: transparent; }
.input-xl:focus { border-bottom-color: var(--accent-primary); box-shadow: none; }

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 20px;
  transition: all var(--d-base) var(--e-out);
}
.card-lg { border-radius: var(--r-lg); padding: 32px; }
.card-hoverable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.card-selectable {
  cursor: pointer;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--d-fast) var(--e-out);
}
.card-selectable:hover { border-color: var(--border-strong); background: var(--bg-sunken); }
.card-selectable.selected { border-color: var(--accent-primary); background: rgba(var(--accent-rgb),0.06); box-shadow: var(--shadow-glow); }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--d-fast) var(--e-out);
  user-select: none;
}
.chip:hover { border-color: var(--border-strong); }
.chip.selected {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.chip.tag {
  background: var(--bg-sunken);
  border-color: transparent;
  font-size: 12px;
  height: 24px;
  padding: 0 10px;
  cursor: default;
}

/* Pill / eyebrow */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-sunken);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

/* Progress */
.progress {
  height: 4px;
  background: var(--border-default);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--r-pill);
  transition: width var(--d-slow) var(--e-out);
}

/* Animation helpers */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer {
  0% { background-position: -800px 0; }
  100% { background-position: 800px 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.97); }
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(var(--r, 0deg)); }
  50% { transform: translate(0, -10px) rotate(var(--r, 0deg)); }
}

.fade-up { animation: fadeUp var(--d-slow) var(--e-out) both; }
.fade-in { animation: fadeIn var(--d-base) var(--e-out) both; }

.shimmer {
  background: linear-gradient(90deg, var(--bg-sunken) 0%, var(--border-default) 40%, var(--bg-sunken) 80%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}

/* App shell */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}

/* Top route bar (prototype-only) */
.proto-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(17,17,17,0.92);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 6px;
  display: flex;
  gap: 4px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  font-size: 13px;
}
.proto-bar button {
  background: transparent;
  border: 0;
  color: #d0d0cc;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--d-fast) var(--e-out);
}
.proto-bar button:hover { color: #fff; background: rgba(255,255,255,0.08); }
.proto-bar button.active { background: var(--accent-primary); color: #fff; }

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: var(--text-primary);
  color: var(--bg-canvas);
  padding: 14px 18px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 999;
  animation: fadeUp var(--d-base) var(--e-out) both;
  font-size: 14px;
}
.toast-success::before { content: '✓'; color: var(--success); font-weight: 700; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17,17,17,0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--d-base) var(--e-out) both;
  padding: 24px;
}
.modal {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  padding: 32px;
  animation: fadeUp var(--d-base) var(--e-out) both;
}

/* Resume canvas */
.resume-doc {
  background: #fff;
  color: #111;
  font-family: 'Times New Roman', Georgia, serif;
  padding: 56px 64px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  min-height: 900px;
}
.resume-doc h1 { font-size: 24px; margin: 0 0 4px; font-weight: 700; }
.resume-doc h2 { font-size: 13px; margin: 22px 0 6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid #111; padding-bottom: 3px; }
.resume-doc h3 { font-size: 13px; margin: 10px 0 2px; font-weight: 700; }
.resume-doc p, .resume-doc li { font-size: 12px; line-height: 1.5; margin: 2px 0; }
.resume-doc ul { padding-left: 18px; margin: 4px 0 8px; }
.resume-doc .contact-line { font-size: 11px; color: #444; margin-bottom: 8px; }
.resume-doc .job-meta { font-size: 11px; color: #444; display: flex; justify-content: space-between; font-style: italic; }

/* Beautify resume */
.resume-beautify {
  background: #fff;
  color: #1a1a1a;
  font-family: 'Poppins', 'Inter', sans-serif;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  min-height: 900px;
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}
.resume-beautify .side {
  background: var(--bf-accent, var(--accent-primary));
  color: #fff;
  padding: 40px 24px;
}
.resume-beautify .main { padding: 40px 36px; }

/* Section dot used in dashboards */
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* Resume thumbnail miniature */
.thumb {
  background: #fff;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-default);
  aspect-ratio: 8.5 / 11;
  overflow: hidden;
  position: relative;
}
.thumb-line { height: 3px; background: #2a2a2a; border-radius: 2px; margin: 4px 0; }
.thumb-line.short { width: 40%; }
.thumb-line.med { width: 70%; background: #b0b0b0; }
.thumb-line.title { width: 60%; background: #111; height: 5px; }

/* Utility */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.stack-sm > * + * { margin-top: 8px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 24px; }
.center { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.grow { flex: 1; }

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-default);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  min-width: 18px;
  color: var(--text-secondary);
}

/* Floating resume stack on landing */
.landing-stack {
  position: relative;
  width: 100%;
  height: 460px;
  perspective: 1200px;
}
.landing-stack .paper {
  position: absolute;
  width: 280px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.12), 0 10px 24px rgba(0,0,0,0.06);
  padding: 24px;
  transition: transform var(--d-slow) var(--e-out);
}
.landing-stack .p1 { top: 40px; left: 40px; transform: rotate(-6deg); animation: drift 5s var(--e-inout) infinite; --r: -6deg; }
.landing-stack .p2 { top: 20px; left: 160px; transform: rotate(2deg); animation: drift 6s var(--e-inout) infinite; animation-delay: -2s; --r: 2deg; z-index: 2; }
.landing-stack .p3 { top: 80px; left: 280px; transform: rotate(8deg); animation: drift 7s var(--e-inout) infinite; animation-delay: -3s; --r: 8deg; }

/* Beautify thumbnails */
.template-thumb {
  aspect-ratio: 8.5/11;
  border-radius: 8px;
  background: #fff;
  border: 2px solid var(--border-default);
  padding: 8px;
  cursor: pointer;
  transition: all var(--d-fast) var(--e-out);
  position: relative;
  overflow: hidden;
}
.template-thumb:hover { border-color: var(--border-strong); }
.template-thumb.selected { border-color: var(--accent-primary); box-shadow: var(--shadow-glow); }

/* Sidebar nav buttons */
.side-action {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  font-size: 14px; color: var(--text-secondary);
  cursor: pointer; transition: background var(--d-fast) var(--e-out);
  background: transparent; border: 0; width: 100%; text-align: left;
  font-family: inherit;
}
.side-action:hover { background: var(--bg-sunken); color: var(--text-primary); }
.side-action.danger:hover { color: var(--error); }

/* Bullet hover toolbar */
.bullet-row {
  position: relative;
  padding: 2px 8px 2px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  margin: 0 -8px 4px;
  transition: all var(--d-fast) var(--e-out);
}
.bullet-row:hover {
  background: rgba(var(--accent-rgb),0.07);
  border-color: rgba(var(--accent-rgb),0.3);
}
.bullet-toolbar {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  display: none;
  padding: 2px;
}
.bullet-row:hover .bullet-toolbar { display: flex; }
.bullet-toolbar button {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
}
.bullet-toolbar button:hover { background: var(--bg-sunken); color: var(--text-primary); }

/* Brand logo R */
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.brand-mark-lg {
  width: 64px; height: 64px;
  border-radius: 18px;
  font-size: 36px;
}

/* Tweaks panel — minimal */
.tweaks-panel-host {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 900;
}

/* Star icon */
.star-row { display: inline-flex; gap: 2px; color: #FFB23F; font-size: 14px; }

/* Particle field (welcome) */
.particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.particles span {
  position: absolute;
  width: 4px; height: 4px;
  background: var(--accent-primary);
  border-radius: 50%;
  opacity: 0.15;
  animation: drift 6s var(--e-inout) infinite;
}

/* Conditional follow-up reveal — slides down when "Yes" is picked */
.sub-reveal {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows var(--d-slow) var(--e-out),
    opacity var(--d-slow) var(--e-out);
}
.sub-reveal.open {
  grid-template-rows: 1fr;
  opacity: 1;
}
.sub-reveal > * {
  overflow: hidden;
  min-height: 0;
}
/* Stagger sub-questions on reveal */
.sub-reveal.open .stack-lg > *,
.sub-reveal.open .stack > * {
  animation: fadeUp var(--d-slow) var(--e-out) both;
}
.sub-reveal.open .stack-lg > *:nth-child(1),
.sub-reveal.open .stack > *:nth-child(1) { animation-delay: 80ms; }
.sub-reveal.open .stack-lg > *:nth-child(2),
.sub-reveal.open .stack > *:nth-child(2) { animation-delay: 160ms; }
.sub-reveal.open .stack-lg > *:nth-child(3),
.sub-reveal.open .stack > *:nth-child(3) { animation-delay: 240ms; }
.sub-reveal.open .stack-lg > *:nth-child(4),
.sub-reveal.open .stack > *:nth-child(4) { animation-delay: 320ms; }
.sub-reveal.open .stack-lg > *:nth-child(5),
.sub-reveal.open .stack > *:nth-child(5) { animation-delay: 400ms; }

/* SubQuestion typography */
.sub-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0;
  margin-bottom: 8px;
}
.sub-input {
  font-size: 15px !important;
  padding: 11px 14px !important;
}
textarea.sub-input {
  padding: 12px 14px !important;
}
.scroll { overflow-y: auto; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 10px; }
.scroll::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Print — Beautify "Download PDF" prints only the resume (Save as PDF) */
@media print {
  body { background: #fff; }
  body * { visibility: hidden !important; }
  #rr-print-area, #rr-print-area * { visibility: visible !important; }
  #rr-print-area {
    position: absolute !important;
    left: 0; top: 0;
    width: 720px !important;
    transform: none !important;
  }
  #rr-print-area .resume-beautify,
  #rr-print-area .resume-doc { box-shadow: none !important; }
  .twk-panel, .proto-bar, .toast { display: none !important; }
  @page { margin: 0.4in; }
}
