/* ===== GLOBAL ===== */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #f0f0f0;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
}

.wrap {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
}

/* ===== TOP BAR ===== */
.bar {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  align-items: center;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 100;
}

.bar h1 {
  margin: 0;
  font-size: 16px;
}

.bar .spacer {
  flex: 1;
}

.btn,
label.file {
  appearance: none;
  border: 1px solid #bbb;
  background: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}

.btn.primary {
  background: #111;
  color: #fff;
  border-color: #111;
}

input[type="file"] {
  display: none;
}

/* ===== HALAMAN A4 =====
   - Di layar: kertas A4 di tengah, padding ~1.5cm
   - Di print: ukuran fisik A4, margin 1.5cm dari @page
*/
.paper {
  width: 210mm; /* lebar A4 */
  margin: 0 auto 24px auto;
  background: #ffffff;
  border: 1px solid #ccc;
  position: relative;
  overflow: visible;
  z-index: 0;
}

/* TAMPILAN DI LAYAR */
@media screen {
  .paper {
    padding: 1.5cm; /* “margin” isi 1.5cm saat di layar */
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.15);
  }
}

/* ===== WATERMARK KONSULTA (K1.PNG) ===== */
.paper::before {
  content: "";
  position: absolute; /* di layar: relatif ke .paper */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  background-image: url("K1.PNG"); /* pastikan nama file 100% sama */
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.08;
  pointer-events: none;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ===== HEADER CV ===== */
.head {
  display: block;
}

.name {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0;
}

.sub {
  font-weight: 700;
  margin: 4px 0 2px 0;
}

.contact {
  font-size: 13px;
  color: #222;
}

.hr {
  height: 0;
  border-top: 1px solid #000;
  margin: 14px 0;
}

/* ===== SECTIONS ===== */
.section {
  margin: 18px 0;
}

.section h3 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 8px 0;
  color: #222;
}

.muted {
  color: #444;
  text-align: justify;
}

.section.line {
  border-bottom: 1px solid #d0d0d0;
  padding-bottom: 12px;
  margin-bottom: 18px;
}

/* Experience list */
.exp-item {
  margin: 10px 0 14px 0;
}

.exp-top {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.exp-role {
  font-weight: 700;
}

.exp-company {
  font-weight: 700;
}

.exp-date {
  margin-left: auto;
  white-space: nowrap;
  color: #222;
}

.exp-bullets {
  margin: 6px 0 0 16px;
}

.exp-bullets li {
  margin: 4px 0;
  text-align: justify;
}

/* Generic bullets */
ul.clean {
  margin: 0;
  padding-left: 18px;
}

ul.clean li {
  margin: 4px 0;
  text-align: justify;
}

/* List item umum (Education, Course, dll.) */
.item-list-item {
  margin-bottom: 10px;
}

.item-list-title {
  font-weight: 700;
}

.item-list-sub {
  text-align: justify;
}

.skill-title {
  font-weight: 700;
  margin-bottom: 4px;
  margin-top: 10px;
}

.skill-title:first-child {
  margin-top: 0;
}

/* ===== PANEL DRAFT PDF ===== */
.draft-panel {
  margin-top: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
}

.draft-panel h2 {
  margin: 0 0 8px 0;
  font-size: 14px;
}

.draft-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.draft-panel th,
.draft-panel td {
  border: 1px solid #ddd;
  padding: 6px 8px;
  text-align: left;
}

.draft-panel th {
  background: #eee;
}

.hidden {
  display: none;
}

/* ===== PRINT / PDF (BROWSER) ===== */

/* Set ukuran & margin fisik kertas */
@page {
  size: A4;
  margin: 1.5cm; /* margin FISIK 1.5cm */
}

/* Saat print dari browser (Ctrl+P / Cetak / PDF) */
@media print {
  body {
    background: #ffffff;
  }

  .bar,
  .draft-panel {
    display: none;
  }

  .wrap {
    margin: 0;
    padding: 0;
    max-width: none;
  }

  .paper {
    width: auto;
    border: none;
    box-shadow: none;
    padding: 0; /* margin di-handle oleh @page */
  }

  /* Watermark dibuat fixed supaya muncul di setiap halaman */
  .paper::before {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

/* ===== MODE KHUSUS PDF SERVER (DOMPDF) =====
   body class="pdf-mode" dipakai di save_draft.php
   Tujuannya: layout sama persis seperti @media print di atas.
*/

body.pdf-mode {
  background: #ffffff;
}

body.pdf-mode .wrap {
  margin: 0;
  padding: 0;
  max-width: none;
}

body.pdf-mode .paper {
  width: auto;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Watermark untuk dompdf (tiap halaman) */
body.pdf-mode .paper::before {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
