/* ResumeSmith dashboard. The chrome follows the system theme; the paper stays white. */

:root {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --ink: #1b2130;
  --muted: #5d6675;
  --line: #e1e5ea;
  --field: #ffffff;
  --brand: #2f5bd0;
  --brand-ink: #ffffff;
  --good: #16794a;
  --warn: #9a5b06;
  --bad: #b3261e;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161b;
    --panel: #1c1f26;
    --ink: #e8ebf1;
    --muted: #9aa3b2;
    --line: #2b303a;
    --field: #22262e;
    --brand: #6f9bff;
    --brand-ink: #10131a;
    --good: #57c795;
    --warn: #e5a75a;
    --bad: #ef8178;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: -0.01em; }
.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.controls label, .check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.files { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- controls ---------- */
.select, .input, .color {
  font: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}
.color { padding: 2px; width: 38px; height: 30px; }
.input { width: 100%; }
.input:focus, .select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
textarea.area { resize: vertical; min-height: 38px; line-height: 1.4; }

.btn {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; padding: 8px 20px; }
.btn.ghost { background: transparent; }
.btn.add { border-style: dashed; color: var(--muted); width: 100%; margin-top: 6px; }
.btn.icon { padding: 2px 7px; line-height: 1.3; color: var(--muted); background: transparent; }
.btn.icon.danger:hover { color: var(--bad); border-color: var(--bad); }
.pill { background: var(--line); border-radius: 999px; padding: 1px 7px; font-size: 12px; margin-left: 4px; }

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: minmax(380px, 44%) 1fr; min-height: 0; }
/* min-height: 0 lets these panels scroll instead of growing past the window and covering the export bar */
.form-panel { min-height: 0; overflow-y: auto; padding: 12px 16px 32px; border-right: 1px solid var(--line); background: var(--bg); }
.preview-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }

/* ---------- form ---------- */
.sec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.sec > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::before { content: "▸"; color: var(--muted); display: inline-block; }
.sec[open] > summary::before { transform: rotate(90deg); }
.sec-label { flex: 1; }

/* dragging a section here moves it in the resume */
.grip { cursor: grab; color: var(--muted); line-height: 1; padding: 2px 4px; border-radius: 4px; }
.grip:hover { background: var(--line); color: var(--ink); }
.grip:active { cursor: grabbing; }
.sec-tools { display: flex; gap: 2px; opacity: 0; }
.sec:hover .sec-tools, .sec-tools:focus-within { opacity: 1; }
.sec.dragging { opacity: 0.45; }
.sec.drop-above { box-shadow: 0 -3px 0 0 var(--brand); }
.sec.drop-below { box-shadow: 0 3px 0 0 var(--brand); }
.sec-body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 10px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; min-width: 0; }
.field.wide { flex-basis: 100%; }
.label { font-size: 12px; color: var(--muted); }
.hint { margin: 0; font-size: 12px; color: var(--muted); }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; background: var(--field); }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools { margin-left: auto; display: flex; gap: 4px; }

.stack { display: flex; flex-direction: column; gap: 6px; }
.line { display: flex; gap: 6px; align-items: center; }
.line .input { flex: 1; min-width: 0; }
.link-label { flex: 0 0 132px; }
.bullets { display: flex; flex-direction: column; gap: 8px; }
.bullet-row { display: flex; gap: 6px; align-items: flex-start; }
.bullet-main { flex: 1; min-width: 0; }
.tip { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.tip.warn { color: var(--warn); }
.tip.error { color: var(--bad); }

/* ---------- preview ---------- */
.preview-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--line); color: var(--muted); }
.badge.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.status { font-size: 12px; color: var(--muted); }
.status.bad { color: var(--bad); }
#review-toggle { margin-left: auto; }
.note { margin: 0; padding: 7px 16px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); font-size: 13px; }
.error { margin: 0; padding: 8px 16px; background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); font-size: 13px; white-space: pre-line; }

.paper-wrap { flex: 1; min-height: 0; overflow: auto; padding: 24px; display: flex; justify-content: center; align-items: flex-start; }
#paper { background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.16), 0 12px 32px rgb(0 0 0 / 0.14); }
#preview { display: block; border: 0; background: #fff; transform-origin: top left; }

.review { max-height: 40%; overflow-y: auto; padding: 10px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.issues { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.issues li { display: grid; grid-template-columns: 16px 1fr; gap: 6px; }
.issues .ic { font-weight: 700; color: var(--muted); }
.issues li.error .ic { color: var(--bad); }
.issues li.warn .ic { color: var(--warn); }

/* ---------- export bar ---------- */
.exportbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.formats { display: flex; gap: 14px; flex-wrap: wrap; }
.fmt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.export-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.downloads { position: fixed; right: 16px; bottom: 62px; width: min(380px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgb(0 0 0 / 0.18); padding: 12px 14px; }
.dl-head { display: flex; align-items: center; margin-bottom: 8px; }
.dl-head .btn { margin-left: auto; }
.dl-files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.dl { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); }
.dl:hover { border-color: var(--brand); }
.dl b { font-size: 11px; letter-spacing: 0.06em; color: var(--brand); }
.dl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); }

/* Narrow window: stack the panels and let the page itself scroll, with the export bar kept in reach. */
/* the line that tells people where their data lives */
.privacy { margin: 0; padding: 9px 16px; font-size: 12px; color: var(--muted); background: var(--bg); border-top: 1px solid var(--line); }

@media (max-width: 950px) {
  body { height: auto; overflow: auto; }
  .layout { grid-template-columns: 1fr; }
  .form-panel { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .preview-panel { overflow: visible; }
  .paper-wrap { padding: 12px; overflow: visible; }
  .review { max-height: none; }
  .exportbar { position: sticky; bottom: 0; }
  .downloads { bottom: 74px; }
}
