/*
 * Lemper PDF (web) - lembar gaya.
 * Pola interaksi (kartu bento, tombol, animasi) diadaptasi dari template
 * VexelFlow (https://github.com/LALUARIFTA/vexel-convert), lisensi MIT,
 * (c) 2026 LALU ARIFTA - lihat LICENSE.
 * Tanpa dependensi eksternal: tidak ada font CDN, tidak ada framework.
 */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);

  --brand-50: #F0FDF4;
  --brand-100: #DCFCE7;
  --brand-200: #BBF7D0;
  --brand-500: #22C55E;
  --brand-600: #16A34A;
  --brand-700: #15803D;
  --brand-900: #14532D;

  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-400: #94A3B8;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-900: #0F172A;

  --bg: #F7F6F2;
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.03);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--slate-900);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 700;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
}

/* ---------- Kepala ---------- */
.hero {
  background: linear-gradient(145deg, #14532D 0%, #166534 55%, #15803D 100%);
  border-radius: 20px;
  color: #fff;
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
}
.hero h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.01em; }
.hero p { margin: 0; font-size: 13px; color: #D1FAE5; line-height: 1.55; }

/* ---------- Kartu ---------- */
.card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.tool-card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 16px 14px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.26s var(--ease-spring), border-color 0.25s ease, box-shadow 0.26s var(--ease-spring);
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-200);
  background-color: #FAFFFC;
  box-shadow: 0 10px 22px -6px rgba(22, 163, 74, 0.16);
}
.tool-card.active {
  border-color: var(--brand-600);
  box-shadow: 0 10px 22px -6px rgba(22, 163, 74, 0.22);
}
.tool-card .t-ico {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--brand-50);
  color: var(--brand-700);
  margin-bottom: 10px;
}
.tool-card .t-name { font-weight: 700; font-size: 14px; }
.tool-card .t-desc { font-size: 11.5px; color: var(--slate-400); margin-top: 3px; line-height: 1.45; }

/* ---------- Animasi masuk ---------- */
@keyframes fadeSlideUp {
  0% { opacity: 0; transform: translateY(14px) scale(0.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.animate-in { opacity: 0; animation: fadeSlideUp 0.5s var(--ease-out-expo) forwards; }
.delay-1 { animation-delay: 0.04s; }
.delay-2 { animation-delay: 0.09s; }
.delay-3 { animation-delay: 0.14s; }

/* ---------- Tombol ---------- */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.24), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
}
.btn:hover::after { left: 140%; }

.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.btn-primary:hover { background: var(--brand-700); }
.btn-dark { background: var(--slate-900); color: #fff; }
.btn-dark:hover { background: var(--brand-700); }
.btn-ghost { background: var(--slate-100); color: var(--slate-700); }
.btn-ghost:hover { background: var(--slate-200); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ---------- Zona unggah ---------- */
.dropzone {
  border: 2px dashed var(--slate-200);
  border-radius: 14px;
  padding: 26px 16px;
  text-align: center;
  color: var(--slate-400);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.dropzone:hover { border-color: var(--brand-500); color: var(--slate-600); }
.dropzone-active {
  border-color: var(--brand-600) !important;
  background-color: var(--brand-50) !important;
  transform: scale(1.006);
}

.file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
}
.file-row .f-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .f-size { color: var(--slate-400); flex-shrink: 0; font-size: 11.5px; }

/* ---------- Panel kerja ---------- */
.workspace { margin-top: 4px; }
.workspace h2 { margin: 0 0 2px; font-size: 17px; }
.workspace .ws-sub { font-size: 12px; color: var(--slate-400); margin: 0 0 14px; }
.ws-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }

label.field { display: block; font-size: 12px; font-weight: 600; color: var(--slate-700); margin: 12px 0 4px; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--brand-200);
  outline-offset: 1px;
}

/* ---------- Viewer / kanvas ---------- */
.viewer-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 10px 0;
}
.viewer-bar .sep { flex: 1; }
.viewer-bar .pg { font-size: 12.5px; color: var(--slate-600); }
.page-stage {
  position: relative;
  background: #E8E5DD;
  border-radius: 14px;
  padding: 12px;
  overflow: auto;
  max-height: 70vh;
}
.page-box { position: relative; margin: 0 auto; transform-origin: 0 0; width: max-content; }
.page-box canvas { display: block; border-radius: 4px; box-shadow: 0 2px 10px rgba(15,23,42,.18); }
.overlay-layer {
  position: absolute; inset: 0;
  touch-action: none;
}
.text-item-preview {
  position: absolute;
  transform-origin: 0 0;
  white-space: pre;
  pointer-events: none;
  font-family: Helvetica, Arial, sans-serif;
}

/* ---------- Hasil ---------- */
.result-box {
  margin-top: 14px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  display: none;
}
.result-box.show { display: block; }
.result-box a.dl {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; margin-right: 8px;
  background: var(--brand-600); color: #fff;
  padding: 8px 14px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600;
  text-decoration: none;
}
.result-box a.dl:hover { background: var(--brand-700); }

.status-line { font-size: 12.5px; color: var(--slate-600); margin-top: 10px; min-height: 16px; }
.status-line.err { color: #B91C1C; }

/* ---------- Toast ---------- */
#toastArea { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--slate-900); color: #fff;
  border-radius: 12px; padding: 10px 16px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(15,23,42,.24);
  animation: fadeSlideUp 0.3s var(--ease-out-expo);
  max-width: 90vw;
}

/* ---------- Footer ---------- */
.foot {
  text-align: center;
  color: var(--slate-400);
  font-size: 11.5px;
  margin: 26px 0 12px;
  line-height: 1.6;
}

/* ---------- Aksesibilitas ---------- */
:where(button, a, input, select, textarea):focus-visible {
  outline: 3px solid var(--brand-200);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
