/* ============================================================
   gerar.app — Currículo
   Documento .cv-doc + 3 modelos (moderno/clássico/minimalista)
   + layout do construtor + impressão (PDF).
   AUTOSSUFICIENTE: não depende dos tokens do app.css, para que a
   exportação em HTML isolado funcione com este CSS embutido.
   ============================================================ */

/* ---------------- Documento base ---------------- */
.cv-doc {
  --cv: #1D4ED8;
  --cv-ink: #1f2430;
  --cv-muted: #5b6472;
  --cv-line: #e6e8ee;
  --cv-soft: #f4f6fa;
  color: var(--cv-ink);
  background: #fff;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  box-sizing: border-box;
}
.cv-doc *, .cv-doc *::before, .cv-doc *::after { box-sizing: border-box; }
.cv-doc h1, .cv-doc h2, .cv-doc h3, .cv-doc p, .cv-doc ul { margin: 0; padding: 0; }
.cv-doc ul { list-style: none; }
.cv-doc a { color: inherit; text-decoration: none; }
.cv-doc strong { font-weight: 700; }

/* Nome / cargo */
.cv-name { font-family: "Sora", "Inter", sans-serif; font-size: 1.95rem; font-weight: 800; line-height: 1.08; letter-spacing: -.02em; }
.cv-role { font-size: 1rem; font-weight: 600; color: var(--cv); margin-top: .15rem; }

/* Foto */
.cv-photo { flex: none; }
.cv-photo img, .cv-photo .cv-initials {
  display: grid; place-items: center;
  width: 92px; height: 92px; border-radius: 50%;
  overflow: hidden; background: var(--cv-soft);
  color: var(--cv); font-weight: 800; font-size: 2rem; font-family: "Sora","Inter",sans-serif;
}
.cv-photo img { object-fit: cover; }
.cv-top { display: flex; align-items: center; gap: 1.1rem; }

/* Blocos / títulos */
.cv-block { margin-bottom: 1.15rem; }
.cv-block:last-child { margin-bottom: 0; }
.cv-main .cv-block > h2 {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700;
  color: var(--cv); margin-bottom: .55rem; padding-bottom: .3rem; border-bottom: 2px solid var(--cv-line);
}
.cv-side .cv-block > h3 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: .5rem;
}

/* Contato / listas laterais */
.cv-contact li { margin-bottom: .4rem; font-size: .82rem; display: flex; gap: .45rem; align-items: flex-start; word-break: break-word; }
.cv-contact li svg { width: 14px; height: 14px; flex: none; margin-top: .15rem; opacity: .8; }
.cv-social li { margin-bottom: .35rem; font-size: .82rem; word-break: break-word; }
.cv-social a { font-weight: 600; color: var(--cv); }
.cv-langs li { margin-bottom: .35rem; font-size: .82rem; display: flex; justify-content: space-between; gap: .5rem; }
.cv-langs .lvl { color: var(--cv-muted); }

/* Contato em linha (modelos de coluna única) */
.cv-contact-inline { display: none; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .6rem; color: var(--cv-muted); font-size: .85rem; }
.cv-contact-inline li { display: inline-flex; gap: .35rem; align-items: center; }

/* Habilidades (tags) */
.cv-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.cv-tags span { font-size: .74rem; padding: .22rem .6rem; border-radius: 999px; background: var(--cv-soft); border: 1px solid var(--cv-line); }

/* Itens (experiência / formação) */
.cv-item { margin-bottom: .85rem; }
.cv-item:last-child { margin-bottom: 0; }
.cv-item-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.cv-item-title { font-weight: 700; font-size: .95rem; }
.cv-period { font-size: .76rem; color: var(--cv-muted); white-space: nowrap; }
.cv-org { font-size: .85rem; font-weight: 600; color: var(--cv); }
.cv-desc { font-size: .85rem; color: var(--cv-muted); margin-top: .25rem; white-space: pre-line; }
.cv-summary p { color: #39404d; }
.cv-empty { color: #9aa1ad; font-style: italic; font-size: .85rem; }

/* ================= MODELO: MODERNO (banner + 2 colunas) ================= */
.tpl-moderno { display: grid; grid-template-columns: 34% 1fr; grid-template-areas: "top top" "side main"; }
.tpl-moderno .cv-top { grid-area: top; display: flex; align-items: center; gap: 1.2rem; background: var(--cv); color: #fff; padding: 1.6rem 1.8rem; }
.tpl-moderno .cv-top .cv-role { color: rgba(255,255,255,.92); }
.tpl-moderno .cv-photo img, .tpl-moderno .cv-photo .cv-initials { width: 86px; height: 86px; border: 3px solid rgba(255,255,255,.4); background: rgba(255,255,255,.16); color: #fff; }
.tpl-moderno .cv-side { grid-area: side; background: var(--cv-soft); padding: 1.5rem 1.4rem; }
.tpl-moderno .cv-main { grid-area: main; padding: 1.5rem 1.7rem; }
.tpl-moderno .cv-contact-inline { display: none; }

/* ================= MODELO: CLÁSSICO (uma coluna, centralizado) ================= */
.tpl-classico { display: flex; flex-direction: column; padding: 2.1rem 2.3rem; }
.tpl-classico .cv-top { flex-direction: column; align-items: center; text-align: center; gap: .7rem; padding-bottom: 1.1rem; margin-bottom: 1.3rem; border-bottom: 3px solid var(--cv); }
.tpl-classico .cv-name { font-size: 2.15rem; }
.tpl-classico .cv-contact-inline { display: flex; justify-content: center; }
.tpl-classico .cv-main { order: 1; }
.tpl-classico .cv-side { order: 2; margin-top: .3rem; }
.tpl-classico .cv-side .cv-contact { display: none; }
.tpl-classico .cv-side .cv-block > h3 { font-size: .82rem; color: var(--cv); padding-bottom: .3rem; border-bottom: 2px solid var(--cv-line); }

/* ================= MODELO: MINIMALISTA (uma coluna, sóbrio) ================= */
.tpl-minimalista { display: flex; flex-direction: column; padding: 2.3rem 2.4rem; }
.tpl-minimalista .cv-top { align-items: center; gap: 1.1rem; padding-bottom: 1.1rem; margin-bottom: 1.4rem; border-bottom: 1px solid var(--cv-line); }
.tpl-minimalista .cv-photo img, .tpl-minimalista .cv-photo .cv-initials { width: 74px; height: 74px; }
.tpl-minimalista .cv-name { font-size: 1.85rem; }
.tpl-minimalista .cv-role { color: var(--cv-muted); }
.tpl-minimalista .cv-contact-inline { display: flex; }
.tpl-minimalista .cv-main { order: 1; }
.tpl-minimalista .cv-side { order: 2; margin-top: .3rem; }
.tpl-minimalista .cv-side .cv-contact { display: none; }
.tpl-minimalista .cv-main .cv-block > h2 { color: var(--cv-ink); }
.tpl-minimalista .cv-side .cv-block > h3 { font-size: .8rem; color: var(--cv-ink); padding-bottom: .3rem; border-bottom: 1px solid var(--cv-line); }

/* ---------------- Construtor (builder) ---------------- */
.cv-builder { display: grid; grid-template-columns: minmax(360px, 440px) 1fr; gap: 1.4rem; align-items: start; }
.cv-form-scroll { display: flex; flex-direction: column; gap: 1rem; }
.cv-fieldset { border: 0; padding: 0; margin: 0; }
.cv-fieldset > legend { font-family: var(--font-display, "Sora"), sans-serif; font-weight: 700; font-size: 1.02rem; margin-bottom: .5rem; padding: 0; }
.cv-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.cv-row > * { flex: 1 1 0; min-width: 0; }
.cv-dyn-item { border: 1px solid var(--border, #e6e8ee); border-radius: 12px; padding: .7rem; margin-bottom: .6rem; background: var(--surface, #fff); }
.cv-dyn-item .cv-row { margin-bottom: .5rem; }
.cv-dyn-item .cv-row:last-child { margin-bottom: 0; }
.cv-dyn-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.cv-dyn-head .lbl { font-size: .8rem; font-weight: 600; color: var(--text-muted, #5b6472); }

/* chips de modelo */
.cv-templates { display: flex; gap: .5rem; flex-wrap: wrap; }
.cv-tpl-chip { flex: 1 1 0; min-width: 96px; cursor: pointer; border: 2px solid var(--border, #e6e8ee); border-radius: 12px; padding: .6rem .5rem; text-align: center; background: var(--surface, #fff); transition: border-color .15s, transform .15s; }
.cv-tpl-chip:hover { transform: translateY(-1px); }
.cv-tpl-chip.active { border-color: var(--accent, #1D4ED8); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.cv-tpl-chip .mini { height: 38px; border-radius: 6px; margin-bottom: .4rem; overflow: hidden; display: flex; }
.cv-tpl-chip .mini i { display: block; background: var(--accent, #1D4ED8); }
.cv-tpl-chip[data-tpl="moderno"] .mini { background: #eef1f7; }
.cv-tpl-chip[data-tpl="moderno"] .mini i { width: 34%; height: 100%; }
.cv-tpl-chip[data-tpl="classico"] .mini { background: #eef1f7; flex-direction: column; align-items: center; padding-top: 5px; gap: 3px; }
.cv-tpl-chip[data-tpl="classico"] .mini i { width: 50%; height: 6px; border-radius: 2px; }
.cv-tpl-chip[data-tpl="minimalista"] .mini { background: #eef1f7; flex-direction: column; padding: 6px; gap: 4px; }
.cv-tpl-chip[data-tpl="minimalista"] .mini i { width: 60%; height: 4px; background: #c8cdd8; border-radius: 2px; }
.cv-tpl-chip[data-tpl="minimalista"] .mini i:first-child { width: 30%; background: var(--accent, #1D4ED8); }
.cv-tpl-chip .nm { font-size: .82rem; font-weight: 600; }

/* swatches de cor */
.cv-swatches { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.cv-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border, #e6e8ee); cursor: pointer; }
.cv-swatch.active { box-shadow: 0 0 0 2px var(--surface,#fff), 0 0 0 4px currentColor; }

/* foto no construtor */
.cv-foto { display: flex; align-items: center; gap: .7rem; }
.cv-foto-thumb { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2, #f4f6fa); display: grid; place-items: center; background-size: cover; background-position: center; color: var(--text-muted, #8a8f99); border: 1px solid var(--border, #e6e8ee); }
.cv-foto-thumb.has-img { color: transparent; }

/* preview pane */
.cv-preview-pane { position: sticky; top: 84px; }
.cv-preview-frame { background: #fff; border: 1px solid var(--border, #e6e8ee); border-radius: 14px; padding: 16px; box-shadow: var(--shadow, 0 10px 30px -18px rgba(0,0,0,.25)); overflow: hidden; }
.cv-preview-frame .cv-scale { transform-origin: top left; }
.cv-preview-doc { box-shadow: 0 6px 24px -16px rgba(0,0,0,.35); }
.cv-preview-hint { font-size: .8rem; color: var(--text-muted, #5b6472); margin: .6rem 2px 0; text-align: center; }

@media (max-width: 900px) {
  .cv-builder { grid-template-columns: 1fr; }
  .cv-preview-pane { position: static; }
}

/* ---------------- Página pública /cv/{slug} ---------------- */
.cv-page { min-height: 100vh; background: #eef1f6; padding: clamp(1rem, 4vw, 2.5rem) 1rem 4rem; }
.cv-page .cv-doc { box-shadow: 0 18px 50px -24px rgba(15,23,42,.45); border-radius: 10px; overflow: hidden; }
.cv-actions { max-width: 820px; margin: 0 auto 1rem; display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.cv-actions .cv-made { margin-right: auto; font-size: .85rem; color: #5b6472; display: inline-flex; align-items: center; gap: .35rem; }
.cv-actions .cv-made a { color: #1D4ED8; font-weight: 600; }
.cv-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .9rem; border-radius: 10px; font-weight: 600; font-size: .9rem; border: 1px solid #d4d8e2; background: #fff; color: #1f2430; cursor: pointer; text-decoration: none; }
.cv-btn svg { width: 16px; height: 16px; }
.cv-btn:hover { border-color: #1D4ED8; color: #1D4ED8; }
.cv-btn-primary { background: #1D4ED8; border-color: #1D4ED8; color: #fff; }
.cv-btn-primary:hover { filter: brightness(1.06); color: #fff; }

/* ---------------- Impressão (PDF) ---------------- */
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; }
  .cv-no-print, .site-header, .site-footer, .cv-actions { display: none !important; }
  .cv-page { background: #fff !important; padding: 0 !important; }
  .cv-page .cv-doc { box-shadow: none !important; border-radius: 0 !important; max-width: 100% !important; }
  .cv-doc { font-size: 12px; }
  .cv-item, .cv-block { break-inside: avoid; }
  .tpl-moderno .cv-top, .tpl-moderno .cv-side { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
