/* ============================================================
   SINTESA VOKASI — Stylesheet
   ============================================================ */
:root {
    --bg: #eef1f6;
    --panel: #ffffff;
    --ink: #1f2933;
    --muted: #6b7280;
    --line: #dfe3eb;
    --brand: #1f6feb;
    --brand-dark: #1552b0;
    --accent: #0f9d58;
    --danger: #d9534f;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}

/* ---------- Header ---------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), #4a9df8);
    color: #fff; font-weight: 800; letter-spacing: .5px;
}
.app-header h1 { font-size: 18px; margin: 0; }
.tagline { margin: 0; font-size: 12px; color: var(--muted); }
.header-right { display: flex; align-items: center; gap: 14px; }
.counter {
    text-align: center;
    padding: 4px 14px;
    background: #eef4ff;
    border: 1px solid #d3e2ff;
    border-radius: 10px;
    line-height: 1.1;
}
.counter-num { display: block; font-size: 20px; font-weight: 800; color: var(--brand-dark); }
.counter-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* ---------- Layout split ---------- */
.layout {
    display: grid;
    grid-template-columns: minmax(340px, 460px) 1fr;
    gap: 16px;
    padding: 16px;
    align-items: start;
}
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 16px; }
.hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.panel-input { position: sticky; top: 74px; max-height: calc(100vh - 90px); overflow: auto; }

/* ---------- Form ---------- */
.form { padding: 14px 18px 20px; }
fieldset {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px 4px;
    margin: 0 0 16px;
}
legend { font-weight: 700; font-size: 13px; color: var(--brand-dark); padding: 0 6px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; color: #374151; }
.opt { font-weight: 400; color: var(--muted); font-size: 11px; }
.req { color: #d9534f; font-weight: 700; }
input:required, select:required { background-image: none; }
input:invalid, select:invalid { border-color: #e3b1af; }
input[type="text"], select, textarea {
    width: 100%;
    margin-top: 5px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    font-weight: 400;
    color: var(--ink);
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(31,111,235,.12);
}
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.advanced { margin-bottom: 16px; }
.advanced summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--brand-dark); padding: 6px 0; }

/* ---------- Buttons ---------- */
.actions { display: flex; gap: 10px; }
button { cursor: pointer; font: inherit; border-radius: 8px; border: 1px solid transparent; }
.btn-primary {
    flex: 1;
    padding: 12px 16px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    border: none;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-secondary { padding: 12px 16px; background: #f1f3f7; color: #374151; border: 1px solid var(--line); }
.btn-secondary:hover { background: #e7ebf2; }
.btn-ghost { padding: 8px 14px; background: transparent; border: 1px solid var(--line); color: #374151; font-weight: 600; }
.btn-ghost:hover { background: #f1f3f7; }

/* ---------- Preview ---------- */
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-tools { display: flex; gap: 8px; }
.btn-toggle { padding: 8px 12px; background: #eef4ff; color: var(--brand-dark); border: 1px solid #d3e2ff; font-weight: 600; font-size: 12px; }
.btn-toggle.off { background: #f1f3f7; color: var(--muted); border-color: var(--line); }
.btn-download {
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    border: none;
}
.btn-download:hover { background: #0c7d45; }
.btn-download:disabled { opacity: .5; cursor: not-allowed; }

.preview-wrapper { padding: 18px; background: #e3e7ee; border-radius: 0 0 var(--radius) var(--radius); min-height: 60vh; }

/* Tampilan "kertas" A4 */
.paper {
    background: #fff;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 48px 56px;
    box-shadow: 0 4px 18px rgba(16,24,40,.12);
    border-radius: 4px;
    min-height: 55vh;
    font-family: "Times New Roman", Georgia, serif;
    font-size: 15px;
    color: #111;
}
.paper:focus { outline: 2px solid var(--brand); outline-offset: 4px; }
.paper h1 { font-size: 19px; text-align: center; margin: 0 0 4px; text-transform: uppercase; }
.paper h1 + h1 { margin-bottom: 18px; font-size: 16px; }
.paper h2 { font-size: 16px; margin: 22px 0 8px; border-bottom: 2px solid #333; padding-bottom: 3px; }
.paper h3 { font-size: 14px; margin: 16px 0 6px; }
.paper p { margin: 0 0 10px; text-align: justify; }
.paper ul, .paper ol { margin: 0 0 12px; padding-left: 26px; }
.paper li { margin-bottom: 4px; }
.paper table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: 13.5px; }
.paper th, .paper td { border: 1px solid #9aa1ac; padding: 7px 9px; text-align: left; vertical-align: top; }
.paper th { background: #eef0f4; }
/* Tabel tanda tangan: tanpa garis, dua kolom, rata tengah */
.paper table.ttd { margin-top: 26px; }
.paper table.ttd td { border: none; text-align: center; width: 50%; vertical-align: top; }
/* Penanda ganti halaman (tampil sebagai garis putus di preview, jadi page break di DOCX) */
.paper .page-break { break-before: page; border-top: 2px dashed #b8c0cc; margin: 26px 0 18px; height: 0; position: relative; }
.paper .page-break::after { content: "⤵ Halaman baru"; position: absolute; right: 0; top: 4px; font-size: 10px; color: #8a93a3; font-family: sans-serif; }
.placeholder-empty { color: var(--muted); text-align: center; padding: 60px 20px; font-family: sans-serif; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%; bottom: 24px;
    transform: translateX(-50%);
    background: #1f2933;
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    z-index: 60;
    font-size: 14px;
    max-width: 90vw;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--accent); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.5); }
.modal-card {
    position: relative;
    background: #fff;
    border-radius: 14px;
    max-width: 560px;
    width: 92%;
    max-height: 88vh;
    overflow: auto;
    padding: 26px 28px;
    box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.modal-card h2 { margin-top: 0; }
.modal-card h3 { margin: 18px 0 6px; font-size: 15px; color: var(--brand-dark); }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); }
.version { margin-top: 20px; color: var(--muted); font-size: 12px; }

/* Badge sumber hasil */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge.ai { background: #e7f7ee; color: #0c7d45; }
.badge.smart { background: #fff3e0; color: #b05a00; }

/* ---------- Responsif ---------- */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .panel-input { position: static; max-height: none; }
    .row { grid-template-columns: 1fr; }
    .paper { padding: 30px 24px; }
}
