/* cv-generator.css — editor CV, pratinjau A4, dan gaya cetak. */

/* ---------- Toolbar ---------- */
.cv-tool { display: flex; flex-direction: column; gap: 16px; }

.cv-toolbar {
  position: sticky; top: calc(var(--header-h) + 8px); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}
.cv-toolbar__status { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--muted); font-size: .8125rem; }
.cv-toolbar__status i { flex: none; color: var(--success); }
.cv-toolbar__status.is-error { color: var(--danger); }
.cv-toolbar__status.is-error i { color: var(--danger); }
.cv-toolbar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }

/* ---------- Layout editor + pratinjau ---------- */
.cv-studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 430px); gap: 20px; align-items: start; }
.cv-editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---------- Section editor ---------- */
.cv-editor .cv-section {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden;
}
.cv-editor .cv-section__head {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.cv-editor .cv-section__num {
  display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: .6875rem; font-weight: 700; line-height: 1;
}
.cv-editor .cv-section__title { margin: 0; font-size: .9375rem; line-height: 1.35; }
.cv-editor .cv-section__desc { margin: 2px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.cv-editor .cv-section__body { padding: 14px; }
.cv-editor .cv-section__body > .field:last-child { margin-bottom: 0; }

.cv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.cv-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cv-span-2 { grid-column: 1 / -1; }
.cv-grid .cv-check { align-self: end; margin-bottom: 14px; }

/* ---------- Foto profil ---------- */
.cv-photo-field {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 18px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.cv-photo-field__thumb {
  display: grid; place-items: center; width: 66px; height: 82px; flex: none; overflow: hidden;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
  color: var(--muted); font-size: 1.25rem;
}
.cv-photo-field__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cv-photo-field__thumb img[hidden], .cv-photo-field__thumb i[hidden] { display: none; }
.cv-photo-field__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cv-photo-field__body .field__hint { margin: 0; line-height: 1.45; }
.cv-photo-field__actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 3px 0; }
.cv-optional { margin-left: 5px; color: var(--muted); font-size: .6875rem; font-weight: 500; }

/* ---------- Pemilih template ---------- */
.cv-templates { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.cv-template {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.cv-template:hover { border-color: var(--accent-border); background: var(--surface-2); }
.cv-template.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); background: var(--surface); }
.cv-template input {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.cv-template:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.cv-template__thumb {
  display: flex; flex-direction: column; gap: 3px; width: 54px; height: 72px; flex: none;
  padding: 7px 6px; border: 1px solid #d1d5db; border-radius: 2px; background: #fff;
  box-shadow: var(--shadow-sm);
}
.cv-template__thumb-name { display: block; width: 62%; height: 5px; margin: 0 auto 4px; background: #111827; }
.cv-template__thumb-line { display: block; width: 100%; height: 2px; background: #d1d5db; }
.cv-template__thumb-line--short { width: 72%; }

.cv-template--two-column .cv-template__thumb { position: relative; padding-left: 20px; }
.cv-template--two-column .cv-template__thumb::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 16px;
  border-radius: 2px 0 0 2px; background: #e5e7eb;
}
.cv-template--two-column .cv-template__thumb::after {
  content: ""; position: absolute; top: 6px; left: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: #9ca3af;
}
.cv-template--two-column .cv-template__thumb-name { width: 82%; margin-left: 0; }

.cv-template__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cv-template__name { font-size: .875rem; font-weight: 600; line-height: 1.35; }
.cv-template__tag { color: var(--accent); font-size: .625rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.cv-template__desc { color: var(--muted); font-size: .75rem; line-height: 1.45; }

/* ---------- Item berulang ---------- */
.cv-repeat__items { display: flex; flex-direction: column; gap: 10px; }
.cv-repeat__items:empty { display: none; }

.cv-item {
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.cv-item__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cv-item__title {
  overflow: hidden; color: var(--muted); font-size: .6875rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis;
}
.cv-remove {
  display: grid; place-items: center; width: 26px; height: 26px; flex: none;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted);
  transition: background-color .15s, border-color .15s, color .15s;
}
.cv-remove:hover { border-color: #fecaca; background: var(--danger-soft); color: var(--danger); }
.cv-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cv-add {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  min-height: 38px; margin-top: 10px; padding: 6px 10px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm); background: transparent;
  color: var(--muted); font-size: .8125rem; font-weight: 600;
  transition: border-color .15s, color .15s, background-color .15s;
}
.cv-add:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.cv-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Pratinjau ---------- */
.cv-side {
  position: sticky; top: calc(var(--header-h) + 76px);
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.cv-preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cv-preview-bar__title { display: flex; align-items: baseline; gap: 8px; font-size: .875rem; }
.cv-preview-bar__name { color: var(--muted); font-size: .75rem; }
.cv-preview-scroll {
  max-height: calc(100vh - var(--header-h) - 170px); overflow: auto;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #e8ecf1;
}
.cv-preview-stage { width: 210mm; margin-inline: auto; }
.cv-preview-hint { margin: 0; line-height: 1.5; }
.cv-note { margin-top: 2px; }

/* ---------- Dokumen CV: tema Klasik ---------- */
.cv-doc {
  --cv-accent: #111827;
  width: 210mm;
  min-height: 297mm;
  padding: 16mm 18mm 18mm;
  background: #fff;
  color: #111827;
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 10.5pt;
  line-height: 1.45;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
  overflow-wrap: break-word;
}
.cv-doc * { box-sizing: border-box; }

.cv-doc .cv-header {
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 2px solid var(--cv-accent); text-align: center;
}
.cv-doc .cv-name {
  margin: 0; color: var(--cv-accent);
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 24pt; font-weight: 700; letter-spacing: .08em; line-height: 1.1; text-transform: uppercase;
}
.cv-doc .cv-headline { margin: 4px 0 6px; font-size: 11pt; font-style: italic; }
.cv-doc .cv-contact { margin: 0; font-size: 9pt; line-height: 1.5; }

.cv-doc .cv-section { margin-top: 13px; }
.cv-doc .cv-section__title {
  margin: 0 0 7px; padding-bottom: 3px;
  border-bottom: 1px solid var(--cv-accent);
  font-family: 'Arial Narrow', Arial, sans-serif;
  font-size: 9.5pt; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  break-after: avoid; page-break-after: avoid;
}
.cv-doc .cv-summary { margin: 0; text-align: justify; }

.cv-doc .cv-entry { margin-bottom: 9px; break-inside: avoid; page-break-inside: avoid; }
.cv-doc .cv-entry:last-child { margin-bottom: 0; }
.cv-doc .cv-entry__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cv-doc .cv-entry__left { min-width: 0; }
.cv-doc .cv-entry__title { margin: 0; font-family: inherit; font-size: 10.5pt; font-weight: 700; line-height: 1.35; }
.cv-doc .cv-entry__sub { margin: 1px 0 0; color: #374151; font-size: 9.5pt; font-style: italic; }
.cv-doc .cv-entry__date { flex: none; font-size: 9pt; font-style: italic; text-align: right; white-space: nowrap; }
.cv-doc .cv-entry__bullets { margin: 4px 0 0; padding-left: 16px; }
.cv-doc .cv-entry__bullets li { margin: 0 0 1px; }
.cv-doc .cv-inline { margin: 0; }
.cv-doc .cv-list { margin: 0; padding-left: 16px; }
.cv-doc .cv-list li { margin-bottom: 1px; }
.cv-doc .cv-placeholder {
  margin: 45mm auto 0; max-width: 70mm;
  color: #9ca3af; font-family: var(--font-body); font-size: 9.5pt;
  line-height: 1.5; text-align: center;
}

/* ---------- Dokumen CV: tema Dua Kolom ---------- */
.cv-doc--two-column {
  --cv-accent: #1f2937;
  display: grid;
  grid-template-columns: 60mm minmax(0, 1fr);
  padding: 14mm 14mm 15mm;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9.8pt;
  line-height: 1.5;
}
.cv-doc--two-column .cv-col--side {
  align-self: start; padding-right: 6mm;
  border-right: 1px solid #d1d5db;
  break-inside: avoid; page-break-inside: avoid;
}
.cv-doc--two-column .cv-col--main { min-width: 0; padding-left: 7mm; }

.cv-doc--two-column .cv-photo {
  width: 46mm; height: 52mm; margin: 0 0 12px; overflow: hidden;
  border: 1px solid #d1d5db; border-radius: 3px; background: #f3f4f6;
  break-inside: avoid; page-break-inside: avoid;
}
.cv-doc--two-column .cv-photo__img { display: block; width: 100%; height: 100%; object-fit: cover; }

.cv-doc--two-column .cv-header {
  margin: 0 0 12px; padding: 0 0 9px;
  border-bottom: 2px solid var(--cv-accent); text-align: left;
}
.cv-doc--two-column .cv-name {
  margin: 0; color: var(--cv-accent);
  font-family: inherit; font-size: 22pt; font-weight: 700;
  letter-spacing: 0; line-height: 1.12; text-transform: none;
}
.cv-doc--two-column .cv-headline {
  margin: 3px 0 0; color: #4b5563; font-size: 10.5pt; font-style: normal;
}

.cv-doc--two-column .cv-section { margin-top: 11px; }
.cv-doc--two-column .cv-section__title {
  margin: 0 0 6px; padding-bottom: 3px;
  border-bottom: 1px solid #9ca3af;
  font-family: inherit; font-size: 8.3pt; letter-spacing: .12em;
}
.cv-doc--two-column .cv-summary { text-align: left; }

.cv-doc--two-column .cv-entry { margin-bottom: 10px; }
.cv-doc--two-column .cv-entry__title { font-family: inherit; font-size: 10pt; }
.cv-doc--two-column .cv-entry__sub,
.cv-doc--two-column .cv-entry__date { color: #4b5563; font-size: 8.8pt; font-style: normal; }
.cv-doc--two-column .cv-entry__bullets { margin-top: 3px; padding-left: 14px; }

.cv-doc--two-column .cv-side-list {
  margin: 0; padding: 0; list-style: none;
  font-size: 8.8pt; line-height: 1.55;
}
.cv-doc--two-column .cv-side-list li { margin: 0 0 2px; overflow-wrap: anywhere; }

/* ---------- Responsif ---------- */
@media (max-width: 1100px) {
  .cv-studio { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
}

@media (max-width: 980px) {
  .cv-studio { grid-template-columns: 1fr; }
  .cv-side { position: static; }
  .cv-preview-scroll { max-height: 72vh; }
}

@media (max-width: 720px) {
  .cv-toolbar__actions { width: 100%; }
  .cv-toolbar__actions .btn:last-child { margin-left: auto; }
  .cv-grid, .cv-grid--3 { grid-template-columns: 1fr; }
  .cv-span-2 { grid-column: auto; }
  .cv-grid .cv-check { margin-bottom: 12px; }
}

@media (max-width: 480px) {
  .cv-toolbar__status { font-size: .75rem; }
  .cv-toolbar__actions .btn { flex: 1; }
  .cv-toolbar__actions .btn:last-child { margin-left: 0; }
  .cv-templates { grid-template-columns: 1fr; }
  .cv-photo-field { gap: 10px; padding: 10px; }
  .cv-photo-field__thumb { width: 56px; height: 70px; }
}

/* ---------- Cetak: hanya dokumen CV ---------- */
@media print {
  @page { size: A4; margin: 14mm 16mm; }

  html, body { background: #fff !important; }
  body.site { overflow: visible !important; }

  .header,
  .footer,
  .chat-float,
  .skip-link,
  .page-head,
  .tool-side,
  .cv-toolbar,
  .cv-editor,
  .cv-preview-bar,
  .cv-preview-hint,
  .cv-note { display: none !important; }

  #main,
  .section,
  .container,
  .tool-layout,
  .tool-workspace,
  .tool-panel,
  .cv-tool,
  .cv-studio,
  .cv-side,
  .cv-preview-scroll {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  .cv-preview-stage { width: auto !important; margin: 0 !important; zoom: 1 !important; }

  .cv-doc {
    width: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  .cv-doc--two-column { grid-template-columns: 58mm minmax(0, 1fr); }

  .cv-doc .cv-placeholder { display: none !important; }
}
