/* ==========================================================================
   Tampilan ala Google Form
   ========================================================================== */

:root {
    --gf-theme: #4caf50;
    /* Versi gelap warna tema, untuk teks putih di atas hijau dan teks hijau di atas --gf-bg (lolos kontras AA) */
    --gf-theme-strong: color-mix(in srgb, var(--gf-theme) 70%, #000);
    --gf-bg: #e4f3e5;
    --gf-text: #202124;
    --gf-text-2: #5f6368;
    --gf-text-3: #70757a;
    --gf-border: #dadce0;
    --gf-error: #d93025;
    --gf-radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.gf-body {
    margin: 0;
    min-height: 100vh;
    background: var(--gf-bg);
    color: var(--gf-text);
    font-family: Roboto, Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.43;
    letter-spacing: .2px;
}

[hidden] { display: none !important; }

.gf-container {
    width: 100%;
    max-width: 770px;
    margin: 0 auto;
    padding: 12px 0 24px;
}

/* ---------- Kartu ---------- */
.gf-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--gf-border);
    border-radius: var(--gf-radius);
    padding: 24px;
    margin-bottom: 12px;
    overflow-wrap: anywhere;
    transition: border-color .2s;
}

.gf-card--header {
    padding-top: 32px;
    border-top: 0;
}
.gf-card--header::before {
    content: "";
    position: absolute;
    top: 0; left: -1px; right: -1px;
    height: 10px;
    background: var(--gf-theme);
    border-radius: var(--gf-radius) var(--gf-radius) 0 0;
}

.gf-form-title {
    margin: 0;
    font-size: 32px;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: 0;
}

.gf-form-desc {
    margin-top: 12px;
    white-space: pre-wrap;
}

.gf-header-note {
    margin: 24px -24px 0;
    padding: 16px 24px 0;
    border-top: 1px solid var(--gf-border);
    color: var(--gf-error);
}

.gf-req { color: var(--gf-error); }

/* Kartu judul section: banner berwarna tema */
.gf-card--section {
    padding: 0;
    overflow: hidden;
}
.gf-section-banner {
    background: var(--gf-theme);
    color: #fff;
    padding: 12px 24px;
}
.gf-section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.33;
}
.gf-section-title b { font-weight: 500; }
.gf-section-desc {
    padding: 16px 24px 24px;
    white-space: pre-wrap;
}

/* ---------- Item pertanyaan ---------- */
.gf-item.has-error { border-color: var(--gf-error); }

.gf-item-title {
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: .1px;
    margin-bottom: 16px;
}
.gf-item-title p { margin: 0 0 12px; }
.gf-item-title p:last-of-type { margin-bottom: 0; display: inline; }
.gf-item-title b { font-weight: 700; }

/* Error */
.gf-error {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    color: var(--gf-error);
    font-size: 12px;
    letter-spacing: .3px;
}
.gf-error.show { display: flex; }
.gf-error-icon { width: 24px; height: 24px; fill: currentColor; flex: none; }

/* ---------- Radio ---------- */
.gf-options { display: flex; flex-direction: column; }

.gf-radio {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 4px 0;
    cursor: pointer;
}
.gf-radio input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
    margin: 0;
}
.gf-radio-circle {
    position: relative;
    flex: none;
    width: 20px; height: 20px;
    border: 2px solid var(--gf-text-2);
    border-radius: 50%;
    transition: border-color .15s;
}
.gf-radio-circle::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--gf-theme);
    transform: scale(0);
    transition: transform .15s ease-out;
}
.gf-radio-circle::before {
    /* halo hover/fokus */
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: var(--gf-theme);
    opacity: 0;
    transition: opacity .15s;
}
.gf-radio:hover .gf-radio-circle::before { opacity: .06; }
.gf-radio input:focus-visible + .gf-radio-circle::before { opacity: .15; }
.gf-radio input:checked + .gf-radio-circle { border-color: var(--gf-theme); }
.gf-radio input:checked + .gf-radio-circle::after { transform: scale(1); }
.gf-radio-label { font-size: 14px; }

.gf-clear-choice { margin-top: 8px; text-align: right; }

/* ---------- Jawaban singkat ---------- */
.gf-text {
    position: relative;
    width: 50%;
    min-width: 200px;
}
.gf-text-input {
    width: 100%;
    padding: 4px 0 6px;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, .12);
    outline: none;
    background: transparent;
    color: var(--gf-text);
    font: inherit;
    font-size: 14px;
}
.gf-text-input::placeholder { color: var(--gf-text-3); }
.gf-text-underline {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 2px;
    background: var(--gf-theme);
    transform: scaleX(0);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.gf-text-input:focus + .gf-text-underline { transform: scaleX(1); }
.has-error .gf-text-underline { background: var(--gf-error); transform: scaleX(1); }

/* ---------- Kisi pilihan ganda (grid) ---------- */
.gf-grid-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.gf-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
}
.gf-grid th, .gf-grid td {
    font-weight: 400;
    text-align: center;
    padding: 8px 4px;
    min-width: 84px;
}
.gf-grid thead th { color: var(--gf-text); font-size: 14px; }
.gf-grid tbody tr { background: #f8f9fa; }
.gf-grid tbody tr th:first-child { border-radius: 4px 0 0 4px; }
.gf-grid tbody tr td:last-child { border-radius: 0 4px 4px 0; }
.gf-grid .gf-grid-rowhead {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 150px;
    text-align: left;
    padding: 12px 8px 12px 12px;
    background: #f8f9fa;
}
.gf-grid thead .gf-grid-rowhead { background: #fff; }
.gf-grid tr.is-missing th, .gf-grid tr.is-missing td { background: #fce8e6; }
.gf-radio--grid { justify-content: center; min-height: 32px; padding: 0; }

/* ---------- Unggah file ---------- */
.gf-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.gf-file-button svg { width: 20px; height: 20px; fill: currentColor; }
.gf-file-input:focus-visible + .gf-file-button { box-shadow: 0 0 0 2px var(--gf-theme); }
.gf-file-chosen {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 6px 8px 6px 12px;
    border: 1px solid var(--gf-border);
    border-radius: 4px;
}
.gf-file-chosen svg { width: 20px; height: 20px; fill: var(--gf-text-2); flex: none; }
.gf-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-file-hint { margin-top: 8px; color: var(--gf-text-2); font-size: 12px; }

/* ---------- Gambar ---------- */
.gf-image { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.gf-image-missing {
    padding: 32px 16px;
    border: 1px dashed var(--gf-border);
    border-radius: 4px;
    color: var(--gf-text-2);
    text-align: center;
}

/* ---------- Tanda tangan digital ---------- */
.gf-signature {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gf-border);
}
.gf-signature-label { font-size: 16px; letter-spacing: .1px; }
.gf-signature-help { margin-top: 4px; color: var(--gf-text-2); font-size: 12px; }
.gf-signature-pad {
    position: relative;
    margin-top: 12px;
    height: 200px;
    border: 1px solid var(--gf-border);
    border-radius: 4px;
    background: #fafafa;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}
.gf-signature-pad.is-active { border-color: var(--gf-theme); box-shadow: 0 0 0 1px var(--gf-theme); }
.gf-signature.has-error .gf-signature-pad { border-color: var(--gf-error); }
.gf-signature-pad canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    touch-action: none;
    cursor: crosshair;
}
.gf-signature-baseline {
    position: absolute;
    left: 24px; right: 24px; bottom: 44px;
    border-bottom: 1px solid #bdc1c6;
    pointer-events: none;
}
.gf-signature-baseline span {
    position: absolute;
    left: 0; bottom: 2px;
    color: #9aa0a6;
    font-size: 18px;
    line-height: 1;
}
.gf-signature-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 24px;
    color: #9aa0a6;
    pointer-events: none;
}
.gf-signature.is-signed .gf-signature-placeholder { display: none; }
.gf-signature-actions { margin-top: 8px; text-align: right; }

/* ---------- Tombol ---------- */
.gf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    min-width: 64px;
    padding: 0 24px;
    border: 0;
    border-radius: 4px;
    background: #fff;
    color: var(--gf-theme);
    font: inherit;
    font-weight: 500;
    letter-spacing: .25px;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
    transition: box-shadow .2s, background-color .2s;
}
.gf-btn:hover { box-shadow: 0 1px 3px 0 rgba(60, 64, 67, .3), 0 4px 8px 3px rgba(60, 64, 67, .15); }
.gf-btn:focus-visible { outline: 2px solid var(--gf-theme); outline-offset: 2px; }
.gf-btn--primary { background: var(--gf-theme); color: #fff; }
.gf-btn--outline {
    box-shadow: none;
    border: 1px solid var(--gf-border);
    padding: 0 16px 0 12px;
}
.gf-btn--outline:hover { box-shadow: none; background: rgba(0, 0, 0, .03); }
.gf-btn[disabled] { opacity: .6; cursor: progress; }

.gf-btn-text {
    padding: 8px;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--gf-theme);
    font: inherit;
    font-weight: 500;
    letter-spacing: .25px;
    cursor: pointer;
}
.gf-btn-text:hover { background: rgba(0, 0, 0, .04); }

.gf-icon-btn {
    width: 28px; height: 28px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--gf-text-2);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.gf-icon-btn:hover { background: rgba(0, 0, 0, .06); }

.gf-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}
.gf-nav-buttons { display: flex; gap: 12px; }

/* ---------- Halaman terkirim ---------- */
.gf-confirmation { margin: 16px 0 24px; }
.gf-link { color: var(--gf-theme); }

/* ---------- Footer ---------- */
.gf-footer {
    margin-top: 24px;
    color: var(--gf-text-2);
    font-size: 12px;
    text-align: center;
}

/* ---------- Dialog ---------- */
.gf-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(32, 33, 36, .6);
}
.gf-dialog {
    width: 100%;
    max-width: 440px;
    padding: 24px 24px 12px;
    border-radius: var(--gf-radius);
    background: #fff;
    box-shadow: 0 11px 15px -7px rgba(0, 0, 0, .2), 0 24px 38px 3px rgba(0, 0, 0, .14);
}
.gf-dialog h3 { margin: 0 0 12px; font-size: 22px; font-weight: 400; }
.gf-dialog p { margin: 0 0 16px; color: var(--gf-text-2); }
.gf-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Responsif ---------- */
@media (max-width: 640px) {
    .gf-container { padding: 8px 8px 24px; }
    .gf-card { padding: 20px 16px; }
    .gf-card--header { padding-top: 28px; }
    .gf-header-note { margin: 20px -16px 0; padding: 14px 16px 0; }
    .gf-section-banner { padding: 12px 16px; }
    .gf-section-desc { padding: 14px 16px 20px; }
    .gf-form-title { font-size: 24px; }
    .gf-text { width: 100%; min-width: 0; }
    .gf-grid .gf-grid-rowhead { min-width: 130px; }
    .gf-grid th, .gf-grid td { min-width: 72px; font-size: 13px; }
    .gf-nav-buttons { gap: 8px; }
    .gf-btn { padding: 0 16px; }
    .gf-signature-pad { height: 180px; }
}
