/* =========================================================
   BP3IP Kirim Sertifikat - wizard mobile-first
   Palet: navy #0B2447 / teal #14919B / amber #B45309
   ========================================================= */

:root {
    --navy: #0B2447;
    --navy-soft: #33425e;
    --teal: #14919B;
    --teal-dark: #0C6E76;
    --teal-tint: #E7F5F6;
    --amber-tint: #FEF6E7;
    --amber-text: #92600A;
    --bg: #F4F6F9;
    --card: #FFFFFF;
    --line: #E2E7EE;
    --line-strong: #C6CFDA;
    --text: #1B2430;
    --text-2: #5B6674;
    --muted: #8B95A3;
    --error: #C0392B;
    --radius: 12px;
    --nav-h: 76px;
}

* { box-sizing: border-box; }

/* atribut hidden harus selalu menang atas aturan display apa pun */
[hidden] { display: none !important; }

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

body {
    margin: 0;
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
}

/* ---------- header ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--navy);
    color: #fff;
    padding-top: env(safe-area-inset-top);
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
    max-width: 560px;
    margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--teal);
    position: relative;
    flex-shrink: 0;
}

.brand-mark::after {
    /* siluet amplop/sertifikat sederhana */
    content: "";
    position: absolute;
    inset: 9px 8px;
    border: 2px solid #fff;
    border-radius: 2px;
}

.brand-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.2; }
.brand-sub { margin: 0; font-size: 12px; color: #AFC0D8; line-height: 1.3; }

.step-indicator { margin: 0; font-size: 13px; font-weight: 600; color: #AFC0D8; }
.step-indicator #stepNow { color: #fff; font-size: 16px; }

.progress-track {
    display: flex;
    gap: 5px;
    padding: 0 20px 14px;
    max-width: 560px;
    margin: 0 auto;
}

.progress-seg {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.22);
    transition: background 0.25s ease;
}

.progress-seg.active { background: var(--teal); }

/* ---------- shell & step ---------- */
.wizard-shell {
    max-width: 560px;
    margin: 0 auto;
    padding: 20px 20px calc(var(--nav-h) + 28px);
}

.step-heading { margin: 4px 0 4px; font-size: 21px; font-weight: 700; color: var(--navy); }
.step-lede { margin: 0 0 20px; font-size: 14px; color: var(--text-2); }

/* ---------- fields ---------- */
.field { margin-bottom: 16px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy-soft);
    margin-bottom: 6px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    font: inherit;
    font-size: 16px; /* mencegah zoom otomatis iOS */
    color: var(--text);
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235B6674' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(20, 145, 155, 0.18);
}

input.invalid, select.invalid, textarea.invalid { border-color: var(--error); }

.hint { margin: 6px 2px 0; font-size: 12px; color: var(--muted); }

.field-error { margin: 8px 2px 0; font-size: 13px; color: var(--error); font-weight: 600; }

/* ---------- pencarian sertifikat ---------- */
.search-wrap { position: relative; }

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
}

.search-wrap input { padding-left: 42px; }

.cert-results { margin: 4px 0 6px; }

.cert-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    font: inherit;
    font-size: 14.5px;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.cert-option:active { background: var(--teal-tint); border-color: var(--teal); }

.cert-option .cat {
    font-size: 11px;
    font-weight: 600;
    color: var(--teal-dark);
    background: var(--teal-tint);
    border-radius: 99px;
    padding: 3px 9px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cert-none { font-size: 13px; color: var(--muted); margin: 4px 2px; }

/* ---------- chips terpilih ---------- */
.selected-block {
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    margin-top: 8px;
}

.selected-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy-soft);
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-badge {
    background: var(--navy);
    color: #fff;
    font-size: 12px;
    min-width: 22px;
    height: 22px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chips-empty { margin: 2px 0; font-size: 13px; color: var(--muted); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--teal-tint);
    color: var(--teal-dark);
    border: 1px solid #BFE3E6;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 8px 8px 12px;
    border-radius: 99px;
    max-width: 100%;
}

.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(12, 110, 118, 0.12);
    color: var(--teal-dark);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

/* ---------- upload ---------- */
.upload-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    padding: 26px 16px;
    background: var(--card);
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-box svg { width: 26px; height: 26px; color: var(--teal); margin-bottom: 4px; }

.upload-box.filled { border-style: solid; border-color: var(--teal); background: var(--teal-tint); }

.upload-title { font-size: 14.5px; font-weight: 600; color: var(--navy); }
.upload-sub { font-size: 12px; color: var(--muted); }

.visually-hidden-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* ---------- ringkasan & COD ---------- */
.review-card {
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 20px 0 14px;
}

.review-title { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--navy); }

.review-list { margin: 0; }
.review-list div { display: flex; gap: 12px; padding: 5px 0; border-top: 1px solid var(--line); }
.review-list div:first-child { border-top: none; }
.review-list dt { flex: 0 0 42%; font-size: 13px; color: var(--text-2); }
.review-list dd { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); word-break: break-word; }

.cod-notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--amber-tint);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
}

.cod-notice svg { width: 22px; height: 22px; color: var(--amber-text); flex-shrink: 0; margin-top: 2px; }
.cod-notice p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--amber-text); }

.error-notice { background: #FDECEA; margin-bottom: 20px; }
.error-notice svg, .error-notice p { color: var(--error); }

.consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13.5px;
    color: var(--text-2);
    cursor: pointer;
}

.consent input {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    accent-color: var(--teal);
    flex-shrink: 0;
}

/* ---------- navigasi bawah ---------- */
.nav-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    gap: 10px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    max-width: 560px;
    margin: 0 auto;
}

@media (min-width: 561px) {
    .nav-bar { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

.btn-primary,
.btn-ghost {
    min-height: 50px;
    border-radius: var(--radius);
    font: inherit;
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.08s ease, background 0.15s ease;
}

.btn-primary {
    flex: 2;
    border: none;
    background: var(--teal);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:active { transform: scale(0.985); background: var(--teal-dark); }

.btn-ghost {
    flex: 1;
    background: transparent;
    border: 1.5px solid var(--line-strong);
    color: var(--navy-soft);
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
    animation: spin 0.7s linear infinite;
}

.is-submitting .btn-spinner { display: inline-block; }
.is-submitting .btn-label { opacity: 0.75; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- halaman sukses ---------- */
.success-shell {
    max-width: 560px;
    margin: 0 auto;
    padding: 48px 24px 40px;
    text-align: center;
}

.success-icon {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--teal-tint);
    color: var(--teal-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.success-icon svg { width: 36px; height: 36px; }

.success-title { margin: 0 0 8px; font-size: 22px; font-weight: 700; color: var(--navy); }
.success-lede { margin: 0 auto 24px; font-size: 14.5px; color: var(--text-2); max-width: 380px; }

.ticket-card {
    background: var(--card);
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.ticket-label { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.ticket-code { margin: 0; font-size: 24px; font-weight: 700; color: var(--navy); letter-spacing: 0.06em; }

.success-info {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    text-align: left;
    background: var(--teal-tint);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 28px;
}

.success-info svg { width: 22px; height: 22px; color: var(--teal-dark); flex-shrink: 0; margin-top: 2px; }
.success-info p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--teal-dark); }

.btn-block {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    border-radius: var(--radius);
    background: var(--teal);
    color: #fff;
    font: inherit;
    font-size: 15.5px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-block:active { background: var(--teal-dark); }

/* ---------- laptop/tablet: tetap layout mobile, kolom terpusat ---------- */
@media (min-width: 561px) {
    body { background: #E4E9F0; }

    .app-header { max-width: 560px; margin: 0 auto; }

    .wizard-shell,
    .success-shell {
        background: var(--bg);
        border-left: 1px solid var(--line);
        border-right: 1px solid var(--line);
        min-height: calc(100vh - 110px);
    }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}