/* ==========================================================
   PORTAL MASUK & PENDAFTARAN (login.php, layanan_mandiri/pendaftaran.php)
   Warna mengikuti variabel tema dari includes/tema_warna.php (tw_head()).
   ========================================================== */
:root { --ink:#0f172a; --ink-2:#475569; --ink-3:#64748b; --line:#e2e8f0; --bg:#f5f7fa; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin:0; font-family:'Plus Jakarta Sans', system-ui, sans-serif; color:var(--ink); background:var(--bg); -webkit-font-smoothing:antialiased; }
a { text-decoration:none; }

/* ---------- Splash: hanya saat dibuka sebagai aplikasi terpasang (PWA) ---------- */
#pwa-splash { display:none; position:fixed; inset:0; z-index:9999; background:var(--primary-dark); flex-direction:column; align-items:center; justify-content:center; gap:14px; transition:opacity .3s, visibility .3s; }
@media (display-mode: standalone) { #pwa-splash { display:flex; } }
#pwa-splash img { width:72px; height:72px; object-fit:contain; background:#fff; border-radius:16px; padding:8px; }
#pwa-splash span { color:#fff; font-weight:700; font-size:.95rem; letter-spacing:.02em; }

/* ---------- Kerangka ---------- */
.lg { min-height:100vh; display:grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }

/* Panel informasi (kiri) */
.lg-info { position:relative; overflow:hidden; color:#fff; min-height:100vh; padding-top:32px !important; background:linear-gradient(180deg, rgba(15,23,42,.45) 0%, rgba(15,23,42,.18) 55%, rgba(255,255,255,.04) 100%), var(--primary-dark); padding:44px 56px; display:flex; flex-direction:column; }
.lg-info::before { content:""; position:absolute; inset:0; pointer-events:none;
    background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 40px 40px; -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.25) 45%, transparent 60%); mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.25) 45%, transparent 60%); }
.lg-info > * { position:relative; z-index:1; }
.lg-info { padding-bottom:0; }
/* Ilustrasi mengisi sisa tinggi panel (min 150px, maks 330px); gambar selalu utuh (meet), sisi kiri-kanan diisi lanskap lanjutan */
.lg-scene { display:block; width:calc(100% + 112px); margin:auto -56px 0; flex:1 1 0; min-height:150px; max-height:330px; height:auto; }
.lg-tanah { background:#14532d; margin:0 -56px; padding:0 56px 18px; }
.lg-brand { display:flex; align-items:center; gap:14px; }
.lg-brand img { width:52px; height:52px; object-fit:contain; background:#fff; border-radius:12px; padding:6px; flex-shrink:0; }
.lg-brand b { display:block; font-size:1.02rem; font-weight:700; letter-spacing:.01em; }
.lg-brand small { display:block; font-size:.8rem; color:rgba(255,255,255,.72); margin-top:2px; }

.lg-isi { margin:0; padding:clamp(20px, 6vh, 64px) 0 12px; max-width:500px; flex-shrink:0; }
.lg-eyebrow { display:inline-block; font-size:.72rem; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:rgba(255,255,255,.7); margin-bottom:14px; }
.lg-isi h1 { font-size:1.9rem; line-height:1.2; font-weight:800; letter-spacing:-.02em; margin:0 0 14px; }
.lg-isi > p { font-size:.96rem; line-height:1.6; color:rgba(255,255,255,.8); margin:0 0 22px; }

.lg-akses { list-style:none; margin:0; padding:0; border-top:1px solid rgba(255,255,255,.14); }
.lg-akses li { display:flex; gap:14px; padding:12px 0; border-bottom:1px solid rgba(255,255,255,.14); }
.lg-akses i { width:36px; height:36px; flex-shrink:0; display:grid; place-items:center; border-radius:9px; background:rgba(255,255,255,.1); font-size:1.05rem; }
.lg-akses b { display:block; font-size:.92rem; font-weight:700; margin-bottom:2px; }
.lg-akses span { display:block; font-size:.84rem; line-height:1.55; color:rgba(255,255,255,.72); }
.lg-akses a { color:#fff; font-weight:600; border-bottom:1px solid rgba(255,255,255,.4); }
.lg-akses a:hover { border-bottom-color:#fff; }

.lg-kontak { display:flex; flex-wrap:wrap; gap:8px 22px; font-size:.8rem; color:rgba(255,255,255,.72); }
.lg-kontak span { display:inline-flex; align-items:center; gap:7px; }
.lg-kontak a { color:inherit; }
.lg-kontak a:hover { color:#fff; }
.lg-kaki { margin-top:12px; padding-top:12px; border-top:1px solid rgba(255,255,255,.14); font-size:.74rem; color:rgba(255,255,255,.55); display:flex; justify-content:space-between; gap:10px; }

/* Panel formulir (kanan) */
.lg-form { display:flex; flex-direction:column; justify-content:center; align-items:center; padding:40px 24px; background:#fff; }
.lg-box { width:100%; max-width:392px; }
.lg-mbrand { display:none; }
.lg-box h2 { font-size:1.55rem; font-weight:800; letter-spacing:-.015em; margin:0 0 6px; }
.lg-box .lg-sub { font-size:.9rem; color:var(--ink-3); margin:0 0 26px; line-height:1.55; }

.lg-alert { display:flex; gap:10px; align-items:flex-start; font-size:.86rem; line-height:1.5; padding:11px 14px; border-radius:10px; margin-bottom:18px; background:#fef2f2; color:#991b1b; border:1px solid #fecaca; }
.lg-alert i { margin-top:1px; }
.lg-box .alert { font-size:.86rem; border-radius:10px; }

.lg-field { margin-bottom:16px; }
.lg-field label { display:block; font-size:.84rem; font-weight:600; color:var(--ink); margin-bottom:7px; }
.lg-input { position:relative; }
.lg-input > i { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:#94a3b8; font-size:1rem; pointer-events:none; transition:color .15s; }
.lg-input input { width:100%; height:48px; padding:0 14px 0 42px; font:inherit; font-size:.95rem; color:var(--ink); background:#fff; border:1px solid #cbd5e1; border-radius:10px; outline:none; transition:border-color .15s, box-shadow .15s; }
.lg-input input::placeholder { color:#94a3b8; }
.lg-input input:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(var(--primary-rgb), .16); }
.lg-input:focus-within > i { color:var(--primary); }
.lg-input input:disabled { background:#f1f5f9; cursor:not-allowed; }
.lg-input.has-btn input { padding-right:48px; }
.lg-eye { position:absolute; right:4px; top:4px; width:40px; height:40px; border:0; background:transparent; color:#64748b; border-radius:8px; display:grid; place-items:center; }
.lg-eye:hover { background:#f1f5f9; color:var(--ink); }
.lg-eye:focus-visible { outline:2px solid var(--primary); outline-offset:1px; }
.lg-hint { font-size:.78rem; color:var(--ink-3); margin-top:6px; }
.lg-caps { display:none; font-size:.78rem; color:#b45309; margin-top:6px; }
.lg-caps.on { display:block; }

.lg-submit { width:100%; height:48px; margin-top:8px; border:0; border-radius:10px; background:var(--primary); color:#fff; font-weight:700; font-size:.95rem; display:inline-flex; align-items:center; justify-content:center; gap:8px; transition:background .15s, transform .05s; }
.lg-submit:hover { background:var(--primary-dark); }
.lg-submit:active { transform:translateY(1px); }
.lg-submit:focus-visible { outline:3px solid rgba(var(--primary-rgb), .35); outline-offset:2px; }
.lg-submit:disabled { opacity:.6; cursor:not-allowed; }
.lg-submit .spinner-border { width:1rem; height:1rem; border-width:2px; display:none; }
.lg-submit.loading .spinner-border { display:inline-block; }
.lg-submit.loading .bi { display:none; }

.lg-pisah { display:flex; align-items:center; gap:12px; margin:24px 0 16px; font-size:.8rem; color:var(--ink-3); }
.lg-pisah::before, .lg-pisah::after { content:""; flex:1; height:1px; background:var(--line); }
.lg-reg { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; height:46px; border:1px solid #cbd5e1; border-radius:10px; color:var(--ink); font-weight:600; font-size:.9rem; background:#fff; transition:border-color .15s, background .15s; }
.lg-reg:hover { border-color:var(--primary); color:var(--primary); background:var(--primary-soft); }

.btn-install-pwa { display:none; width:100%; margin-top:10px; height:42px; border:1px dashed #cbd5e1; border-radius:10px; background:transparent; color:var(--ink-2); font-size:.84rem; font-weight:600; }
.btn-install-pwa:hover { border-color:var(--primary); color:var(--primary); }

.lg-links { display:flex; justify-content:space-between; gap:12px; margin-top:26px; font-size:.84rem; }
.lg-links a { color:var(--ink-2); font-weight:600; display:inline-flex; align-items:center; gap:6px; }
.lg-links a:hover { color:var(--primary); }
.lg-aman { display:flex; gap:8px; align-items:flex-start; margin-top:22px; padding-top:18px; border-top:1px solid var(--line); font-size:.76rem; line-height:1.5; color:var(--ink-3); }
.lg-aman i { color:#16a34a; margin-top:1px; }

/* ---------- Tablet & ponsel ---------- */
@media (max-width: 991.98px) {
    .lg { grid-template-columns: 1fr; }
    .lg-info { display:none; }
    .lg-form { justify-content:flex-start; padding:0 0 28px; background:var(--bg); }
    .lg-mbrand { --msc:clamp(104px, 36.7vw, 250px); display:flex; width:100%; align-items:center; gap:12px; padding:calc(18px + env(safe-area-inset-top)) 20px calc(var(--msc) - 20px); color:#fff; background:linear-gradient(rgba(15,23,42,.32), rgba(15,23,42,.32)), var(--primary-dark); position:relative; overflow:hidden; }
    .lg-mbrand::before { content:""; position:absolute; inset:0; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size:32px 32px; }
    .lg-mbrand > * { position:relative; }
    .lg-mbrand > .lg-mscene { position:absolute; left:0; right:0; bottom:0; width:100%; height:var(--msc); display:block; pointer-events:none; }
    .lg-mbrand img { width:44px; height:44px; object-fit:contain; background:#fff; border-radius:10px; padding:5px; flex-shrink:0; }
    .lg-mbrand b { display:block; font-size:.95rem; font-weight:700; line-height:1.3; }
    .lg-mbrand small { display:block; font-size:.76rem; color:rgba(255,255,255,.75); }
    .lg-box { max-width:440px; margin:-34px auto 0; padding:26px 22px 22px; background:#fff; border:1px solid var(--line); border-radius:16px; box-shadow:0 8px 24px rgba(15,23,42,.06); position:relative; width:calc(100% - 28px); }
    .lg-box h2 { font-size:1.3rem; }
    .lg-box .lg-sub { margin-bottom:20px; font-size:.86rem; }
    .lg-input input { font-size:16px; } /* cegah zoom otomatis iOS */
    .lg-mfoot { display:block; text-align:center; font-size:.74rem; color:var(--ink-3); margin-top:18px; padding:0 20px; }
}
@media (min-width: 992px) { .lg-mfoot { display:none; } }
@media (max-width: 1199.98px) and (min-width: 992px) { .lg-info { padding:36px 40px 0; } .lg-scene { width:calc(100% + 80px); margin:auto -40px 0; } .lg-tanah { margin:0 -40px; padding:4px 40px 24px; } .lg-isi h1 { font-size:1.8rem; } }
/* Laptop layar pendek (mis. 1280x720 / 1366x768): rapatkan panel kiri agar muat satu layar */
@media (min-width: 992px) and (max-height: 899.98px) {
    .lg-info { padding-top:24px !important; }
    .lg-isi { padding:14px 0 4px; }
    .lg-isi h1 { font-size:1.6rem; margin-bottom:10px; }
    .lg-isi > p { font-size:.9rem; margin-bottom:14px; }
    .lg-eyebrow { margin-bottom:10px; }
    .lg-akses li { padding:9px 0; }
    .lg-akses span { font-size:.8rem; }
    .lg-scene { min-height:120px; }
    .lg-kaki { margin-top:8px; padding-top:8px; }
    .lg-tanah { padding-bottom:12px; }
}

/* Smartphone posisi mendatar: pita ringkas tanpa ilustrasi agar formulir tetap terlihat */
@media (max-width: 991.98px) and (orientation: landscape) and (max-height: 540px) {
    .lg-mbrand { padding-bottom:54px; }
    .lg-mbrand > .lg-mscene { display:none; }
}

/* ==========================================================
   LOGIN DI SMARTPHONE: PAS SATU LAYAR (tidak bisa digeser)
   - Tinggi tata letak = tinggi layar yang terlihat (100dvh, fallback 100vh).
   - Body dikunci (overflow hidden + overscroll-behavior none) sehingga tidak ada
     geser/pantul. Kolom formulir hanya bisa digulir bila isinya memang melebihi
     layar (mis. keyboard terbuka atau pesan error panjang di ponsel sangat kecil).
   - Jarak & ukuran menyesuaikan tinggi layar bertingkat (>=800, 700-799, <700, <600).
   ========================================================== */
@media (max-width: 991.98px) {
    html:has(body.hal-login), body.hal-login { height:100%; overflow:hidden; overscroll-behavior:none; }
    body.hal-login { position:fixed; inset:0; width:100%; }
    .hal-login .lg { height:100vh; height:100dvh; min-height:0; display:block; }
    .hal-login .lg-form { height:100%; padding:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
        display:flex; flex-direction:column; align-items:stretch; justify-content:flex-start; scrollbar-width:none; }
    .hal-login .lg-form::-webkit-scrollbar { display:none; }
    .hal-login .lg-mbrand { flex-shrink:0; --msc:clamp(96px, min(34vw, 17dvh), 180px); padding-bottom:calc(var(--msc) + 2px); align-items:center; }
    .hal-login .lg-box { flex-shrink:0; margin:-34px auto 0; }
    .hal-login .lg-mfoot { margin-top:auto; padding:14px 20px calc(12px + env(safe-area-inset-bottom)); flex-shrink:0; }
    .hal-login .btn-install-pwa { height:38px; margin-top:8px; }
}
/* Layar tinggi (>=880px): pita ilustrasi sedikit lebih besar agar proporsional */
@media (max-width: 991.98px) and (min-height: 880px) {
    .hal-login .lg-mbrand { --msc:clamp(120px, min(40vw, 19dvh), 200px); }
}
/* Layar sedang (700-799px tinggi) */
@media (max-width: 991.98px) and (max-height: 799.98px) {
    .hal-login .lg-mbrand { padding-top:calc(12px + env(safe-area-inset-top)); }
    .hal-login .lg-box { padding:20px 18px 16px; }
    .hal-login .lg-box h2 { font-size:1.2rem; margin-bottom:4px; }
    .hal-login .lg-box .lg-sub { font-size:.8rem; margin-bottom:14px; }
    .hal-login .lg-field { margin-bottom:11px; }
    .hal-login .lg-field label { font-size:.8rem; margin-bottom:5px; }
    .hal-login .lg-input input { height:44px; }
    .hal-login .lg-eye { top:2px; }
    .hal-login .lg-submit { height:46px; margin-top:4px; }
    .hal-login .lg-pisah { margin:14px 0 10px; font-size:.76rem; }
    .hal-login .lg-reg { height:42px; }
    .hal-login .lg-links { margin-top:14px; font-size:.8rem; }
    .hal-login .lg-aman { margin-top:12px; padding-top:10px; font-size:.72rem; }
    .hal-login .lg-mfoot { padding-top:10px; font-size:.7rem; }
}
/* Layar pendek (<700px tinggi, mis. 360x640, iPhone SE 375x667) */
@media (max-width: 991.98px) and (max-height: 699.98px) {
    .hal-login .lg-mbrand { --msc:clamp(84px, 15dvh, 104px); gap:10px; }
    .hal-login .lg-mbrand img { width:38px; height:38px; }
    .hal-login .lg-box { margin-top:-28px; }
}
@media (max-width: 991.98px) and (max-height: 699.98px) { .hal-login .lg-aman { display:none; } }
/* Layar sangat pendek (<600px tinggi) */
@media (max-width: 991.98px) and (max-height: 599.98px) {
    .hal-login .lg-box .lg-sub { display:none; }
    .hal-login .lg-box h2 { margin-bottom:12px; }
}
/* Smartphone mendatar: tanpa pita ilustrasi, formulir ringkas */
@media (max-width: 991.98px) and (orientation: landscape) and (max-height: 540px) {
    .hal-login .lg-mbrand { padding:calc(8px + env(safe-area-inset-top)) 20px 36px; }
    .hal-login .lg-mbrand img { width:32px; height:32px; }
    .hal-login .lg-box { margin-top:-28px; padding:14px 20px 10px; max-width:460px; }
    .hal-login .lg-box h2 { font-size:1.05rem; margin-bottom:10px; }
    .hal-login .lg-box .lg-sub, .hal-login .lg-pisah, .hal-login .lg-aman { display:none; }
    .hal-login .lg-field { margin-bottom:8px; }
    .hal-login .lg-field label { margin-bottom:3px; }
    .hal-login .lg-input input { height:40px; }
    .hal-login .lg-eye { top:0; }
    .hal-login .lg-submit { height:42px; }
    .hal-login .lg-reg { height:38px; margin-top:8px; }
    .hal-login .lg-links { margin-top:10px; }
    .hal-login .lg-mfoot { display:none; }
}

/* ---------- Animasi masuk (lembut) ---------- */
@keyframes lgNaik { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:none; } }
@keyframes lgPudar { from { opacity:0; } to { opacity:1; } }
.lg-box { animation:lgNaik .55s cubic-bezier(.2,.7,.2,1) both; }
.lg-brand, .lg-mbrand > div, .lg-mbrand > img { animation:lgPudar .6s ease-out both; }
.lg-isi > * { animation:lgNaik .6s cubic-bezier(.2,.7,.2,1) both; }
.lg-isi > *:nth-child(2) { animation-delay:.06s; } .lg-isi > *:nth-child(3) { animation-delay:.12s; } .lg-isi > *:nth-child(4) { animation-delay:.18s; }
.lg-akses li, .rg-fitur li { animation:lgNaik .5s cubic-bezier(.2,.7,.2,1) both; }
.lg-akses li:nth-child(1), .rg-fitur li:nth-child(1) { animation-delay:.22s; }
.lg-akses li:nth-child(2), .rg-fitur li:nth-child(2) { animation-delay:.29s; }
.lg-akses li:nth-child(3), .rg-fitur li:nth-child(3) { animation-delay:.36s; }
.rg-fitur li:nth-child(4) { animation-delay:.43s; } .rg-fitur li:nth-child(5) { animation-delay:.50s; } .rg-fitur li:nth-child(6) { animation-delay:.57s; }
.lg-scene, .lg-mscene { animation:lgPudar 1s ease-out .15s both; }
.lg-alert, .lg-box .alert { animation:lgNaik .35s ease-out both; }
@media (prefers-reduced-motion: reduce) {
    * { transition:none !important; }
    .lg-box, .lg-brand, .lg-mbrand > *, .lg-isi > *, .lg-akses li, .rg-fitur li, .lg-scene, .lg-mscene, .lg-alert, .lg-box .alert { animation:none !important; }
}
