/* Create Resume — page styles
 * Loaded by /create-resume.html
 *
 * Two-pane layout: form on the left, live resume preview on the right.
 * The .cr-preview node is what html2pdf.js exports, so its inner CSS
 * has to be self-contained (no reliance on the global stylesheet's
 * variables) and print-friendly.
 */

/* Full-width: sidebar is intentionally hidden on this page. */
.page-wrap.page-full { grid-template-columns: 1fr; gap: 0; }
.page-wrap.page-full > main { padding-right: 0; }

.cr-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-top: 14px;
}
.cr-templates { display: flex; gap: 6px; flex-wrap: wrap; }
.cr-tpl {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
}
.cr-tpl:hover { border-color: var(--brand); color: var(--brand); }
.cr-tpl.on   {
  background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600;
}

.cr-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cr-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}
.cr-btn:hover { border-color: var(--brand); color: var(--brand); }
.cr-btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.cr-btn.primary:hover { background: #16385A; color: #fff; }
.cr-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cr-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 1024px) { .cr-layout { grid-template-columns: 1fr; } }

/* ─── Form ─────────────────────────────────────────────────── */
.cr-form { display: flex; flex-direction: column; gap: 10px; }
.cr-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0;
}
.cr-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  user-select: none;
  position: relative;
}
.cr-section > summary::-webkit-details-marker { display: none; }
.cr-section > summary::after {
  content: '+';
  position: absolute;
  right: 16px;
  top: 12px;
  font-size: 20px;
  color: var(--ink-3);
  font-weight: 400;
}
.cr-section[open] > summary::after { content: '−'; }
.cr-section .cr-opt {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--ink-3);
  font-size: 11px;
  margin-left: 6px;
}
.cr-section > .cr-grid,
.cr-section > .cr-rows,
.cr-section > .cr-add,
.cr-section > .cr-objective,
.cr-section > .cr-field,
.cr-section > .cr-check {
  margin: 0 16px 14px;
}
.cr-section > .cr-add { margin-top: 4px; margin-bottom: 16px; }
.cr-section > details > summary { /* nested if any */ padding: 8px 0; }

.cr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.cr-field { display: flex; flex-direction: column; gap: 4px; }
.cr-field.cr-wide { grid-column: span 2; }
.cr-field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.cr-field span em { color: #B91C1C; font-style: normal; margin-left: 2px; }
.cr-field input[type=text],
.cr-field input[type=email],
.cr-field input[type=tel],
.cr-field input[type=url],
.cr-field input[type=date],
.cr-field input[type=number],
.cr-field select,
.cr-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}
.cr-field textarea { resize: vertical; min-height: 60px; line-height: 1.45; font-family: inherit; }
.cr-field input:focus, .cr-field select:focus, .cr-field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}

.cr-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}

.cr-add {
  display: inline-block;
  padding: 7px 14px;
  border: 1px dashed var(--line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--brand);
  font-weight: 600;
}
.cr-add:hover { background: var(--brand-light, #E8F1FA); border-color: var(--brand); }

.cr-rows { display: flex; flex-direction: column; gap: 12px; }
.cr-row {
  background: #F8FAFC;
  border: 1px solid #E5EAF0;
  border-radius: 8px;
  padding: 12px 12px 12px;
  position: relative;
}
.cr-row .cr-rm {
  position: absolute;
  right: 10px;
  top: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
}
.cr-row .cr-rm:hover { background: #FBE2DC; color: #B91C1C; }
.cr-row .cr-grid { margin: 0; }

/* Objective preset chips */
.cr-objective {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cr-obj-preset {
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}
.cr-obj-preset:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light, #E8F1FA); }
.cr-obj-preset.on  { border-color: var(--brand); background: var(--brand-light, #E8F1FA); color: var(--ink); }
.cr-obj-preset b   { color: var(--brand); font-weight: 700; margin-right: 6px; }

/* ─── Preview pane ─────────────────────────────────────────── */
.cr-preview-wrap {
  background: #E8ECF1;
  border-radius: var(--r-md);
  padding: 14px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow: auto;
}
@media (max-width: 1024px) { .cr-preview-wrap { position: static; max-height: none; } }
.cr-preview-note {
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
  margin: 8px 0 0;
}

/* The actual resume sheet — A4 ratio at 210x297mm.
 * Self-contained typography so html2pdf can render it standalone. */
.cr-preview {
  background: #fff;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 22mm 18mm;
  min-height: 297mm;
  /* border-box keeps the padding *inside* the 297 mm min-height so
     the rendered element is exactly one A4 page tall — without this,
     22 mm + 297 mm + 22 mm = 341 mm and PDF/Word/Print produce a
     trailing blank page. */
  box-sizing: border-box;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  font-family: Arial, Helvetica, sans-serif;
  color: #1A1A1A;
  font-size: 10.5pt;
  line-height: 1.45;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.cr-preview * { box-sizing: border-box; }
.cr-preview p { margin: 0 0 6pt; }
.cr-preview h1, .cr-preview h2, .cr-preview h3 { margin: 0; }
.cr-preview ul { margin: 4pt 0 6pt 16pt; padding: 0; }
.cr-preview li { margin: 0 0 3pt; line-height: 1.4; }

/* Header */
.cr-resume-head {
  text-align: center;
  border-bottom: 1.5pt solid #1A1A1A;
  padding-bottom: 10pt;
  margin-bottom: 12pt;
}
.cr-resume-name {
  font-size: 22pt;
  font-weight: 700;
  letter-spacing: 0.5pt;
  margin-bottom: 4pt;
  text-transform: uppercase;
}
.cr-resume-title {
  font-size: 11pt;
  color: #4B5563;
  margin-bottom: 6pt;
  font-weight: 500;
}
.cr-resume-contact {
  font-size: 9.5pt;
  color: #4B5563;
  line-height: 1.55;
}
.cr-resume-contact a { color: #1F4E79; text-decoration: none; }
.cr-resume-contact span + span::before { content: ' · '; color: #B6C0CC; margin: 0 4px; }

/* Section heading */
.cr-resume-section { margin-bottom: 11pt; }
.cr-resume-section h2 {
  font-size: 11.5pt;
  text-transform: uppercase;
  letter-spacing: 1pt;
  color: #1A1A1A;
  border-bottom: 0.6pt solid #1A1A1A;
  padding-bottom: 3pt;
  margin: 0 0 6pt;
}
.cr-resume-row { margin-bottom: 7pt; }
.cr-resume-row:last-child { margin-bottom: 0; }
.cr-resume-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12pt;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 2pt;
}
.cr-resume-row-title {
  font-weight: 700;
  font-size: 10.5pt;
  color: #1A1A1A;
}
.cr-resume-row-sub {
  font-style: italic;
  font-size: 10pt;
  color: #4B5563;
}
.cr-resume-row-meta {
  font-size: 9.5pt;
  color: #4B5563;
  white-space: nowrap;
}
.cr-resume-row-desc { font-size: 10pt; color: #1A1A1A; }
.cr-resume-bullets {
  margin: 3pt 0 0 16pt;
  padding: 0;
}
.cr-resume-bullets li {
  font-size: 10pt;
  color: #1A1A1A;
}

.cr-skill-line { margin-bottom: 3pt; font-size: 10pt; }
.cr-skill-line b { font-weight: 700; color: #1A1A1A; }

.cr-decl {
  margin-top: 14pt;
  padding-top: 8pt;
  border-top: 0.4pt solid #B6C0CC;
  font-size: 9.5pt;
  font-style: italic;
  color: #4B5563;
}

/* ─── Modern template ──────────────────────────────────────── */
.cr-tpl-modern {
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 11pt;
}
.cr-tpl-modern .cr-resume-name {
  text-transform: none;
  letter-spacing: 0;
  font-size: 24pt;
  color: #1F4E79;
  border-bottom: none;
}
.cr-tpl-modern .cr-resume-head {
  text-align: left;
  border-bottom: 2pt solid #1F4E79;
}
.cr-tpl-modern .cr-resume-section h2 {
  color: #1F4E79;
  border-bottom: 0.6pt solid #1F4E79;
  text-transform: uppercase;
  letter-spacing: 0.6pt;
}
.cr-tpl-modern .cr-resume-row-title { color: #1F4E79; }

/* ─── Compact template ─────────────────────────────────────── */
.cr-tpl-compact {
  font-family: "Times New Roman", Georgia, serif;
  font-size: 10pt;
  line-height: 1.35;
  padding: 16mm 16mm;
}
.cr-tpl-compact .cr-resume-name { font-size: 18pt; letter-spacing: 0.3pt; }
.cr-tpl-compact .cr-resume-section { margin-bottom: 8pt; }
.cr-tpl-compact .cr-resume-section h2 {
  font-size: 10.5pt;
  letter-spacing: 0.8pt;
}
.cr-tpl-compact .cr-resume-row { margin-bottom: 4pt; }
.cr-tpl-compact .cr-resume-bullets { margin-top: 2pt; }
.cr-tpl-compact .cr-resume-bullets li { font-size: 9.5pt; }

/* Print rules — hide the rest of the page when printing.
 * Used by the "Print" button as a fallback to PDF export. */
@media print {
  body * { visibility: hidden !important; }
  .cr-preview, .cr-preview * { visibility: visible !important; }
  .cr-preview {
    position: absolute;
    inset: 0;
    box-shadow: none;
    margin: 0;
    padding: 18mm 16mm;
    width: 100%;
    max-width: none;
    /* Let the printed sheet size to its content — no forced 297 mm,
       otherwise a half-page resume reserves a full page and the
       browser may add a trailing blank page. */
    min-height: auto;
  }
}
