/* =========================================================
   Hireme AI - AI Resume Builder
   Two-pane builder (editor + live A4 preview) and a clean,
   single-column ATS template that prints to an exact 2-page PDF.
   Everything inside .rb-sheet is sized in `em` off a single
   font-size var (--rb-fs) so the auto-fit routine can shrink
   the whole resume to fit two A4 pages by changing ONE value.
   ========================================================= */

/* ---------- layout shell ---------- */
.rb-wrap { padding: 30px 0 60px; }
.rb-grid {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
@media (max-width: 980px) { .rb-grid { grid-template-columns: 1fr; } }

/* ---------- editor column ---------- */
.rb-editor { display: flex; flex-direction: column; gap: 18px; }
.rb-panel {
  background: #fff; border: 1px solid #ece9f5; border-radius: 16px;
  padding: 20px; box-shadow: 0 6px 24px rgba(76, 29, 149, .05);
}
.rb-panel h2 { font-size: 1.1rem; margin: 0 0 4px; }
.rb-panel .rb-sub { color: var(--muted, #6b6786); font-size: .88rem; margin: 0 0 16px; }

/* upload box */
.rb-up {
  border: 2px dashed #cfc6ee; border-radius: 14px; padding: 22px 16px;
  text-align: center; cursor: pointer; transition: .15s; background: #faf9ff;
}
.rb-up:hover, .rb-up.over { border-color: var(--violet-500, #7c3aed); background: #f3efff; }
.rb-up .rb-up-ic { font-size: 1.8rem; }
.rb-up b { display: block; margin-top: 6px; }
.rb-up span { display: block; color: var(--muted, #6b6786); font-size: .82rem; margin-top: 2px; }
.rb-filename { font-size: .82rem; margin-top: 10px; color: var(--violet-600, #6d28d9); font-weight: 600; min-height: 1em; }

.rb-or { text-align: center; color: var(--muted, #9b95b5); font-size: .78rem; margin: 14px 0 4px; text-transform: uppercase; letter-spacing: .08em; }

.rb-label { display: block; font-weight: 600; font-size: .85rem; margin: 14px 0 6px; }
.rb-label .rb-opt { color: var(--muted, #9b95b5); font-weight: 500; }
.rb-field textarea, .rb-field input, .rb-rep textarea, .rb-rep input {
  width: 100%; box-sizing: border-box; border: 1px solid #ddd6f0; border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: .9rem; background: #fff; resize: vertical;
}
.rb-field textarea:focus, .rb-field input:focus, .rb-rep textarea:focus, .rb-rep input:focus {
  outline: none; border-color: var(--violet-500, #7c3aed); box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}
#rbResume { min-height: 90px; } #rbJD { min-height: 78px; }

.rb-genbtn { width: 100%; margin-top: 16px; }
.rb-status { font-size: .85rem; margin-top: 10px; min-height: 1.1em; color: var(--muted, #6b6786); }

/* JD match meter */
.rb-jd { margin-top: 14px; background: #f6f3ff; border: 1px solid #e6def9; border-radius: 12px; padding: 12px 14px; display: none; }
.rb-jd.show { display: block; }
.rb-jd-top { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; font-weight: 700; }
.rb-jd-bar { height: 8px; border-radius: 6px; background: #e7e0f7; margin: 8px 0; overflow: hidden; }
.rb-jd-bar i { display: block; height: 100%; background: var(--grad-brand, linear-gradient(90deg,#7c3aed,#a855f7)); border-radius: 6px; transition: width .5s; }
.rb-jd-miss { font-size: .8rem; color: #b4530a; }
.rb-jd-miss b { color: #7c2d12; }

/* full JD analysis + match report */
.rb-jd-report { margin-top: 6px; }
.rb-jd-role { font-weight: 800; font-size: .95rem; color: #4c1d95; margin: 4px 0 8px; }
.rb-jd-sec { margin-top: 10px; }
.rb-jd-sec > b { display: block; font-size: .8rem; color: #2e2748; margin-bottom: 5px; }
.rb-kws { display: flex; flex-wrap: wrap; gap: 5px; }
.rb-kw { font-size: .76rem; border-radius: 999px; padding: 3px 9px; line-height: 1.3; border: 1px solid transparent; }
.rb-kw.req { background: #ede9fe; color: #5b21b6; }
.rb-kw.pref { background: #eef2ff; color: #3730a3; }
.rb-kw.ok { background: #dcfce7; color: #166534; }
.rb-kw.miss { background: #fff1e6; color: #b4530a; border-color: #fcd9b6; }
.rb-jd-list { margin: 2px 0 0; padding-left: 18px; }
.rb-jd-list li { font-size: .8rem; color: #4b4564; margin: 3px 0; }

/* ---------- interview prep sheet ---------- */
.rb-iv-sheet { line-height: 1.3; }
.rb-iv-head { text-align: center; margin: 0 0 1em; padding-bottom: .5em; border-bottom: 1px solid #555; }
.rb-iv-head .rb-h-name { font-size: 1.9em; }
.rb-iv-item { margin-bottom: 1em; }
.rb-iv-q { font-weight: 700; color: #111; }
.rb-iv-n { color: #6d28d9; margin-right: .35em; }
.rb-iv-cat { display: inline-block; font-size: .82em; font-weight: 700; color: #6d28d9; background: #f1ebff; border-radius: 5px; padding: 0 .45em; margin-right: .45em; }
.rb-iv-qt { font-weight: 700; }
.rb-iv-a { margin-top: .25em; color: #1a1a1a; }
.rb-iv-a b { font-style: italic; font-weight: 400; color: #555; }

/* editable fields (prefilled by AI) */
.rb-fields { display: none; }
.rb-fields.show { display: flex; flex-direction: column; gap: 18px; }
.rb-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .rb-row2 { grid-template-columns: 1fr; } }

/* repeatable rows */
.rb-rep-row { border: 1px solid #eee7fb; border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fbfaff; }
.rb-rep-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rb-rep-head b { font-size: .85rem; flex: 1; }
.rb-rep-del { border: none; background: #fff0f0; color: #dc2626; width: 26px; height: 26px; border-radius: 7px; cursor: pointer; }
.rb-rep .rb-field { margin-bottom: 8px; }
.rb-addbtn { width: 100%; border: 1px dashed #c9bff0; background: #f7f4ff; color: var(--violet-600, #6d28d9); border-radius: 10px; padding: 9px; cursor: pointer; font-weight: 600; font-size: .85rem; }

/* skills chips */
.rb-chipbox { border: 1px solid #ddd6f0; border-radius: 10px; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; cursor: text; min-height: 42px; align-content: flex-start; }
.rb-chip { background: #efe9fd; color: #5b21b6; border-radius: 999px; padding: 4px 10px; font-size: .8rem; display: inline-flex; align-items: center; gap: 6px; }
.rb-chip button { border: none; background: none; color: #7c3aed; cursor: pointer; font-size: 1rem; line-height: 1; }
.rb-chipbox input { border: none; outline: none; flex: 1; min-width: 100px; font: inherit; font-size: .85rem; padding: 4px; }

/* ---------- preview column ---------- */
.rb-previewcol { position: sticky; top: 80px; }
@media (max-width: 980px) { .rb-previewcol { position: static; } }
.rb-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #1c1431; color: #fff; border-radius: 14px 14px 0 0; padding: 12px 16px;
}
.rb-toolbar .rb-pages { font-size: .82rem; color: #cfc4ee; }
.rb-toolbar .rb-grow { flex: 1; }
.rb-toolbar .btn { padding: 8px 14px; font-size: .85rem; }

/* preview view tabs (Resume / Cover letter) */
.rb-viewtabs { display: inline-flex; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18); border-radius: 9px; padding: 3px; gap: 2px; }
.rb-tab { border: none; background: transparent; color: #cfc4ee; font: inherit; font-size: .82rem; font-weight: 600; padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; transition: .15s; }
.rb-tab:hover { color: #fff; }
.rb-tab.active { background: #fff; color: #1c1431; }

.rb-stage {
  background: #e9e6f3; border-radius: 0 0 14px 14px; padding: 22px;
  overflow: auto; max-height: calc(100vh - 150px); display: flex; justify-content: center;
}
@media (max-width: 980px) { .rb-stage { max-height: none; } }
.rb-sheets { transform-origin: top center; }

/* ===========================================================
   THE A4 SHEET  ·  classic serif (LaTeX-style) ATS template
   =========================================================== */
.rb-sheet {
  width: 210mm; min-height: 297mm; box-sizing: border-box;
  padding: 14mm 15mm; margin: 0 auto 22px; background: #fff;
  box-shadow: 0 10px 40px rgba(28, 20, 49, .18);
  color: #1a1a1a; font-family: "PT Serif", Georgia, "Times New Roman", Times, serif;
  font-size: var(--rb-fs, 14px); line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}
.rb-sheet:last-child { margin-bottom: 0; }

/* header (centered) — mirrors the downloaded PDF: uppercase name, light tracking */
.rb-head { text-align: center; margin-bottom: .2em; }
.rb-h-name { font-size: 1.95em; font-weight: 400; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .1em; color: #111; }
.rb-h-title { font-size: 1.12em; color: #333; margin: .1em 0; }
.rb-h-loc { font-size: 1em; color: #222; margin: .12em 0; }
.rb-h-contact { font-size: .98em; color: #222; }
.rb-h-contact a { color: #222; text-decoration: none; }
.rb-h-contact { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .15em 1em; }
.rb-h-contact .rb-c { display: inline-flex; align-items: center; white-space: nowrap; }
.rb-ico { width: 1em; height: 1em; margin-right: .5em; flex: 0 0 auto; }

/* header WITH photo: text left-aligned beside a circular headshot on the right (matches the PDF) */
.rb-head-photo { display: flex; align-items: center; justify-content: space-between; gap: 1.4em; text-align: left; }
.rb-head-photo .rb-head-text { flex: 1 1 auto; min-width: 0; }
.rb-head-photo .rb-h-contact { justify-content: flex-start; }
.rb-head-img { flex: 0 0 auto; width: 109px; height: 109px; border-radius: 50%; object-fit: cover; background: #eee; }  /* 109px ~= the PDF's 82pt headshot */

/* section header: bold serif + full-width rule */
.rb-sec-h {
  font-size: 1.24em; font-weight: 700; color: #111; margin: 1em 0 .4em;
  border-bottom: 1px solid #333; padding-bottom: .1em;
}
.rb-summary { margin: 0; text-align: justify; }

/* ---------- photo uploader control (in the editor form) ---------- */
.rb-photo { display: flex; gap: 14px; align-items: center; margin: 4px 0 2px; padding: 12px 14px; background: #faf9ff; border: 1px solid #ece8fb; border-radius: 12px; }
.rb-photo-thumb { width: 60px; height: 60px; border-radius: 50%; flex: 0 0 auto; border: 2px solid #e3dcff; background: #efeaff center/cover no-repeat;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b7abe0'><circle cx='12' cy='8' r='4'/><path d='M4 20c0-4 3.6-6 8-6s8 2 8 6z'/></svg>"); background-size: 62%; }
.rb-photo-thumb.has { background-size: cover; border-color: #7c3aed; }
.rb-photo-main { flex: 1 1 auto; min-width: 0; }
.rb-photo-actions { display: flex; gap: 8px; margin: 2px 0 10px; }
.rb-photo-actions .rb-addbtn { margin: 0; }
.rb-photo-remove { color: #dc2626; border-color: #f3c9c9 !important; }
.rb-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: .86rem; color: #4b456b; user-select: none; }
.rb-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.rb-switch-tk { width: 38px; height: 21px; border-radius: 21px; background: #cfc8e8; position: relative; transition: .2s; flex: 0 0 auto; }
.rb-switch-tk::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.rb-switch input:checked + .rb-switch-tk { background: #7c3aed; }
.rb-switch input:checked + .rb-switch-tk::after { transform: translateX(17px); }

/* ---------- photo editor (drag / zoom / rotate) ---------- */
.rb-photo-thumb { cursor: pointer; }
.rb-crop-card { max-width: 372px; margin: 6vh auto; background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 30px 80px rgba(20,14,38,.45); }
.rb-crop-stage { display: flex; justify-content: center; }
#rbCropCanvas { width: 300px; height: 300px; border-radius: 14px; background: #f4f1fb; cursor: grab; touch-action: none; display: block; }
#rbCropCanvas:active { cursor: grabbing; }
.rb-crop-zoom { width: 100%; accent-color: #7c3aed; }
.rb-crop-tools { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.rb-crop-tools .rb-addbtn { margin: 0; flex: 1; }

/* core skills: two columns of bullets */
.rb-skills-grid { columns: 2; column-gap: 2.4em; margin: 0; padding: 0; list-style: none; }
.rb-skills-grid li { position: relative; padding-left: 1em; margin: .12em 0; break-inside: avoid; }
.rb-skills-grid li::before { content: "•"; position: absolute; left: 0; }
.rb-skills-grid li b { font-weight: 700; }

/* experience / projects / education entry */
.rb-xp { margin-bottom: .5em; }
.rb-xp-r1 { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; }
.rb-xp-r1 .l { font-weight: 700; color: #111; }
.rb-xp-r1 .r { font-weight: 700; color: #111; white-space: nowrap; }
.rb-xp-r2 { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; font-style: italic; color: #333; }
.rb-xp-r2 .r { white-space: nowrap; }
/* bullet lists mirror the PDF: visible disc markers (override the global ul reset) + roomy spacing */
.rb-bullets { margin: .28em 0 0; padding-left: 1.15em; list-style: disc; }
.rb-bullets li { margin: .28em 0; }
.rb-ptech { margin-top: .24em; font-style: italic; color: #333; }
.rb-ptech b { font-weight: 700; font-style: normal; color: #111; }

/* simple lists (certs / languages) */
.rb-list { margin: 0; padding-left: 1.15em; list-style: disc; }
.rb-list li { margin: .28em 0; }

/* keep every atomic block (a whole company, a project, a degree) intact across the page break */
.rb-blk, .rb-xp, .rb-sec-h { break-inside: avoid; page-break-inside: avoid; }
.rb-blk { margin-bottom: 1em; }
.rb-blk:last-child { margin-bottom: 0; }
.rb-blk > .rb-sec-h:first-child { margin-top: 0; }
/* split-entry continuation blocks: a job's remaining bullets flow as their own
   blocks so a page can fill mid-job. These must read as one seamless list. */
.rb-blk.rb-keepnext { margin-bottom: 0; }
.rb-blk.rb-keepnext .rb-xp { margin-bottom: 0; }
.rb-blk.rb-cont > .rb-bullets { margin-top: 0; }

/* ---------- cover letter sheet ---------- */
.rb-cl-sheet { line-height: 1.42; }
.rb-cl-topo { text-align: center; margin: 0 0 1em; padding-bottom: .55em; border-bottom: 1px solid #555; }
.rb-cl-topo .rb-h-name { font-size: 2.15em; margin-bottom: .04em; }
.rb-cl-topo .rb-h-title { margin: .04em 0; }
.rb-cl-date { margin: .2em 0 1.1em; color: #1a1a1a; }
.rb-cl-rec { margin: 0 0 1em; line-height: 1.35; }
.rb-cl-sub { margin: 0 0 1em; color: #111; }
.rb-cl-sal { margin: 0 0 .9em; }
.rb-cl-p { margin: 0 0 .85em; text-align: justify; }
.rb-cl-sign { margin-top: 1.2em; }

/* ---------- cover letter editor block ---------- */
.rb-clbox { border-top: 2px dashed #e6def9; padding-top: 16px; margin-top: 2px; }
.rb-clhead { font-size: 1rem; margin: 0 0 12px; }
.rb-clhead .rb-opt { font-weight: 500; font-size: .8rem; }
#f_cl_body { min-height: 180px; line-height: 1.5; }

/* empty state */
.rb-empty { text-align: center; color: #9b95b5; padding: 60px 20px; }
.rb-empty .rb-empty-ic { font-size: 2.4rem; }

/* ---------- download chooser modal ---------- */
.rb-dl-card { max-width: 440px; margin: 7vh auto; background: #fff; border-radius: 18px; padding: 26px; box-shadow: 0 30px 80px rgba(20,14,38,.45); }
.rb-dl-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rb-dl-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 2px solid #e6def9; background: #faf9ff; border-radius: 14px; padding: 16px 10px; cursor: pointer; transition: .15s; }
.rb-dl-opt:hover { border-color: var(--violet-500, #7c3aed); background: #f3efff; transform: translateY(-2px); }
.rb-dl-opt .rb-dl-ic { font-size: 1.7rem; }
.rb-dl-opt b { font-size: 1rem; color: #14101f; }
.rb-dl-opt span { font-size: .75rem; color: #6b6786; }

/* ---------- full-screen preview ---------- */
.rb-full { position: fixed; inset: 0; z-index: 6000; background: rgba(20,14,38,.72); display: none; overflow: auto; }
.rb-full.open { display: block; }
.rb-full-bar { position: sticky; top: 0; display: flex; gap: 10px; align-items: center; justify-content: center; padding: 12px; background: #1c1431; }
.rb-full-page { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 26px 12px 60px; }

/* ===========================================================
   PRINT  ·  exactly the sheets, real selectable text, A4 pages
   =========================================================== */
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body * { visibility: hidden !important; }
  #rbSheets, #rbSheets * { visibility: visible !important; }

  /* hide every sibling chrome (NOT the ancestors of #rbSheets) */
  .site-header, .page-hero, .site-footer, .fab-wa,
  .rb-toolbar, .rb-editor, .rb-full { display: none !important; }

  /* neutralise positioned / clipping ancestors so the sheets sit at the page origin */
  .rb-previewcol { position: static !important; }
  .rb-stage {
    overflow: visible !important; max-height: none !important;
    padding: 0 !important; background: #fff !important; display: block !important;
  }
  #rbSheets {
    position: absolute; left: 0; top: 0; margin: 0 !important;
    width: auto !important; height: auto !important; transform: none !important;
  }
  .rb-sheet {
    box-shadow: none !important; margin: 0 !important;
    page-break-after: always; break-after: page;
  }
  .rb-sheet:last-child { page-break-after: auto; break-after: auto; }
}

/* =========================================================
   TEMPLATE VARIANTS — header + section-heading chrome only.
   Body layout/spacing is shared so pagination + fit stay identical.
   Scoped on a standalone .tpl-* class so it also applies to the
   hidden #rbMeasure element while paginating.
   ========================================================= */

/* ---------- Azure — full-width blue banner (modern, sans-serif) ---------- */
.tpl-azure { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; }
.tpl-azure .rb-head.rb-banner { text-align: center; margin: 0 0 .7em; }
.tpl-azure .rb-bn-head { background: #4a9fe0; padding: 3.8mm 6mm; }
.tpl-azure .rb-bn-name { color: #fff; font-size: 2em; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; margin: 0; line-height: 1.1; }
.tpl-azure .rb-bn-sub { background: #d6ebfb; color: #357abd; font-size: .9em; padding: 2.4mm 8mm; line-height: 1.55; border-bottom: 4px double #4a9fe0; }
.tpl-azure .rb-bn-sub a { color: #357abd; text-decoration: none; }
.tpl-azure .rb-bn-sub b { font-weight: 700; }
.tpl-azure .rb-sec-h { text-transform: uppercase; letter-spacing: .02em; color: #1a1a1a; border-bottom: 1px solid #333; font-size: 1.14em; }

/* ---------- Onyx — dark contact bar + accent surname (serif) ---------- */
.tpl-onyx .rb-head.rb-onyx-head { text-align: right; margin: 0 0 .2em; }
.tpl-onyx .rb-on-name { font-size: 2.05em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #1a1a1a; margin: 0 0 .06em; line-height: 1.06; }
.tpl-onyx .rb-on-accent { color: #c0563b; }
.tpl-onyx .rb-on-title { color: #444; font-size: 1.05em; margin: 0 0 .12em; }
.tpl-onyx .rb-on-bar { text-align: center; margin: .45em -15mm 0; padding: 2.2mm 15mm; background: #1c1c1c; color: #fff; font-size: .86em; }
.tpl-onyx .rb-on-bar a { color: #fff; text-decoration: none; }
.tpl-onyx .rb-on-sep { opacity: .45; margin: 0 .7em; }
.tpl-onyx .rb-sec-h { color: #1a1a1a; border-bottom: 1px solid #333; }

/* ---------- template picker bar (in the preview toolbar area) ---------- */
.rb-tplbar { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: #f6f4fd; border-bottom: 1px solid #ece8fb; flex-wrap: wrap; }
.rb-tpl-lbl { font-size: .8rem; font-weight: 700; color: #6b6390; margin-right: 2px; }
.rb-tpl { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: .84rem; font-weight: 600; color: #4b456b; background: #fff; border: 1.5px solid #e3dcff; border-radius: 9px; padding: 6px 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s, color .15s; }
.rb-tpl:hover { border-color: #c9bdf5; }
.rb-tpl.active { border-color: #7c3aed; color: #4c1d95; box-shadow: 0 0 0 2px rgba(124, 58, 237, .12); }
.rb-tpl-sw { width: 15px; height: 15px; border-radius: 4px; flex: none; border: 1px solid rgba(0, 0, 0, .12); }
.sw-classic { background: #fff; box-shadow: inset 0 0 0 2px #111; }
.sw-azure { background: #2b7fd4; }
.sw-onyx { background: #1c1c1c; position: relative; }
.sw-onyx::after { content: ""; position: absolute; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%; background: #c0563b; }
