/* ================= RESET & BASE ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0f172a;
  --radius: 10px;
}

body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ================= TOPBAR ================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo { font-size: 22px; }
.brand-name { font-weight: 700; font-size: 18px; color: var(--accent); }
.actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Tombol Donasi (eye-catching) ---------- */
.btn-donate {
  --d1: #16a34a;
  --d2: #22c55e;
  --d3: #4ade80;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  text-decoration: none;
  letter-spacing: .2px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--d1), var(--d2) 45%, var(--d3));
  background-size: 200% 100%;
  box-shadow: 0 6px 18px rgba(34, 197, 94, .45), 0 0 0 0 rgba(34, 197, 94, .55);
  overflow: hidden;
  cursor: pointer;
  white-space: nowrap;
  transform: translateZ(0);
  animation: donatePulse 1.8s ease-in-out infinite, donateShift 4s linear infinite;
  transition: transform .18s ease, box-shadow .18s ease;
}
.btn-donate:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 26px rgba(34, 197, 94, .6);
  animation-play-state: paused;
}
.btn-donate:active { transform: translateY(0) scale(.98); }

/* Kilau bergerak melintasi tombol */
.btn-donate::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-20deg);
  animation: donateShine 2.6s ease-in-out infinite;
}

.btn-donate .donate-heart {
  font-size: 16px;
  display: inline-block;
  animation: donateBeat 1s ease-in-out infinite;
}
.btn-donate .donate-text { position: relative; z-index: 1; }

@keyframes donatePulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(34,197,94,.45), 0 0 0 0 rgba(34,197,94,.55); }
  50%      { box-shadow: 0 6px 18px rgba(34,197,94,.45), 0 0 0 10px rgba(34,197,94,0); }
}
@keyframes donateShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes donateShine {
  0% { left: -60%; }
  60%, 100% { left: 120%; }
}
@keyframes donateBeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.25); }
  40% { transform: scale(.95); }
  60% { transform: scale(1.15); }
}

@media (max-width: 640px) {
  .btn-donate { font-size: 12px; padding: 8px 14px; }
  .btn-donate .donate-text { max-width: 160px; white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-donate,
  .btn-donate::before,
  .btn-donate .donate-heart { animation: none; }
}

/* ---------- Language dropdown ---------- */
.lang-select {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}
.lang-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.lang-dropdown {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color .15s, box-shadow .15s;
}
.lang-dropdown:hover { border-color: var(--primary); }
.lang-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ================= BUTTONS ================= */
.btn {
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s, box-shadow .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: #f8fafc; color: var(--text); }
.btn-add {
  background: #eff6ff;
  color: var(--primary);
  border: 1px dashed var(--primary);
  width: 100%;
  margin-top: 8px;
}
.btn-add:hover { background: #dbeafe; }

.btn-remove {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-remove:hover { background: #fee2e2; }

/* ================= LAYOUT ================= */
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

/* ================= FORM PANEL ================= */
.form-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.page-title { font-size: 22px; margin-bottom: 6px; color: var(--accent); }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}
legend {
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  padding: 0 8px;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
  gap: 5px;
}
input, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-weight: 400;
  width: 100%;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.grid-2 label:last-child { grid-column: 1 / -1; }

/* ---------- Photo uploader ---------- */
.photo-uploader {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}
.photo-preview {
  width: 96px;
  height: 128px; /* rasio 3:4 */
  flex: 0 0 auto;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-placeholder { color: #94a3b8; font-size: 13px; }
.photo-controls { flex: 1; }
.photo-btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
}
.photo-btn:hover { background: var(--primary-dark); }
.photo-hint { font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 6px; line-height: 1.4; }
#photoRemove { margin-left: 8px; }

/* dynamic entry blocks */
.entry-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafafa;
}
.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.entry-title { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ================= PREVIEW PANEL ================= */
.preview-panel {
  position: sticky;
  top: 76px;
}
.preview-toolbar {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.preview-label { font-weight: 700; color: var(--accent); font-size: 15px; }

.cv-scroll {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border-radius: var(--radius);
  background: #cbd5e1;
  padding: 20px;
}

/* ================= CV PAPER (ATS - 2 KOLOM) ================= */
.cv-paper {
  background: #fff;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 44px 48px;
  color: #1a1a1a;
  font-family: "Calibri", "Arial", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 4px 18px rgba(0,0,0,.15);
  min-height: 1050px;
}
.cv-empty {
  color: #94a3b8;
  text-align: center;
  padding: 80px 20px;
  font-style: italic;
}

/* Header dengan foto */
.cv-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  border-bottom: 2px solid #111;
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.cv-photo {
  width: 92px;
  height: 122px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid #ccc;
}
.cv-header-text { flex: 1; }
.cv-name {
  font-size: 27px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #111;
  margin-bottom: 3px;
}
.cv-role {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 9px;
}
.cv-contact {
  font-size: 12px;
  color: #222;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.cv-contact span { white-space: nowrap; }

/* Body dua kolom */
.cv-body {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 0 30px;
}
.cv-col-left { min-width: 0; }
.cv-col-right { min-width: 0; }

.cv-section { margin-bottom: 16px; }
.cv-section h2 {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1.5px solid #111;
  padding-bottom: 3px;
  margin-bottom: 8px;
  color: #111;
}

.cv-item { margin-bottom: 12px; }
.cv-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.cv-item-title { font-weight: 700; font-size: 13.5px; color: #111; }
.cv-item-sub { font-size: 12.5px; color: #444; }
.cv-item-date { font-size: 12px; color: #555; white-space: nowrap; }
.cv-item ul { margin: 4px 0 0 16px; }
.cv-item li { margin-bottom: 3px; }

.cv-summary { font-size: 12.5px; text-align: justify; }

/* daftar poin di kolom kanan */
.cv-bullet-list { margin: 0; list-style: none; }
.cv-bullet-list li {
  font-size: 12.5px;
  margin-bottom: 5px;
  padding-left: 14px;
  position: relative;
}
.cv-bullet-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #111;
}

/* blok kolom kanan (pendidikan, sertifikasi) */
.cv-block { margin-bottom: 10px; }
.cv-block-title { font-weight: 700; font-size: 12.5px; color: #111; }
.cv-block-sub { font-size: 12px; color: #444; }

/* ================= RESPONSIVE ================= */
@media (max-width: 950px) {
  .layout { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .cv-scroll { max-height: none; }
}

/* ================= PRINT ================= */
@media print {
  /* margin 0 pada halaman -> menyembunyikan header/footer bawaan browser
     (tanggal & judul halaman). Margin isi diberikan pada .cv-paper. */
  @page { size: A4; margin: 0; }
  html, body { background: #fff; }
  .topbar, .form-panel, .preview-toolbar { display: none !important; }
  .layout { display: block; padding: 0; margin: 0; max-width: none; }
  .preview-panel { position: static; }
  .cv-scroll {
    max-height: none;
    overflow: visible;
    background: #fff;
    padding: 0;
    margin: 0;
  }
  .cv-paper {
    box-shadow: none;
    max-width: none;
    width: 100%;
    padding: 12mm 14mm;   /* margin isi CV, karena @page = 0 */
    margin: 0;
    min-height: auto;
    font-size: 11pt;
  }
  .cv-item, .cv-section { page-break-inside: avoid; }
}
