/* Latar Belakang Luar (Desktop) */
body { 
    background-color: #0f172a; /* Slate 900 untuk tema dark desktop yang elegan */
    display: flex; 
    justify-content: center; 
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
}

/* Tampilan Utama di HP (Layar Kecil)
   100dvh = tinggi layar yang benar-benar terlihat. 100vh di Chrome Android/Safari
   ikut menghitung address bar, jadi bagian bawah frame (termasuk navigasi) tertutup. */
.mobile-frame { 
    width: 100%; 
    max-width: 100%; /* Penuh 100% di HP asli */
    height: 100vh;
    height: 100dvh;
    background-color: #f9fafb; 
    position: relative; 
    overflow: hidden; 
    box-shadow: none;
}

/* Tablet (768–1023px): bingkai jadi kartu tipis & melebar, navigasi bawah tetap
   karena layar sentuh masih nyaman memakai bar mengambang. */
@media (min-width: 768px) and (max-width: 1023.98px) {
    body {
        padding: 1.5rem;
    }

    .mobile-frame {
        width: 100%;
        max-width: 720px;
        height: calc(100dvh - 3rem);
        max-height: none;
        border: 1px solid #e2e8f0;
        border-radius: 24px;
        box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.28);
    }

    /* Kolom selebar HP (28rem) menyisakan ruang kosong di bingkai 720px, jadi
       pembungkus konten dilepas batasnya dan isi memakai lebar yang ada. */
    .mobile-frame .max-w-md {
        max-width: 100%;
    }

    /* Huruf kecil khas HP dinaikkan sedikit: di tablet mata lebih jauh dari layar
       daripada di genggaman, tapi belum sebesar di laptop.
       line-height ikut dinaikkan karena utilitas Tailwind menautkan tinggi baris
       ke ukuran aslinya (0.75rem → 1rem); tanpa ini teks jadi tumpang tindih. */
    .mobile-frame .text-\[9px\] {
        font-size: 0.75rem;
        line-height: 1.1rem;
    }

    .mobile-frame .text-\[10px\] {
        font-size: 0.8rem;
        line-height: 1.15rem;
    }

    .mobile-frame .text-xs {
        font-size: 0.9rem;
        line-height: 1.35rem;
    }

    .mobile-frame .text-\[8px\] {
        font-size: 0.75rem;
        line-height: 1.05rem;
    }

    .mobile-frame .text-\[9\.5px\] {
        font-size: 0.8rem;
        line-height: 1.15rem;
    }
}

/* Laptop / desktop (>= 1024px): bingkai HP dilepas, aplikasi jadi shell penuh
   dengan navigasi mendatar di atas, seperti situs berita/blog pada umumnya. */
@media (min-width: 1024px) {
    body {
        background-color: #f1f5f9;
        padding: 0;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        height: 100dvh;
    }

    .mobile-frame {
        width: 100%;
        max-width: none;
        /* Baris kedua body: tinggi tersisa di bawah navigasi atas. min-height:0
           wajib, tanpa itu konten yang panjang membuat frame mendorong halaman. */
        height: auto;
        flex: 1 1 auto;
        min-height: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding-left: 0;
    }

    /* 7rem di bawah konten hanya perlu untuk navigasi mengambang versi HP. */
    .mobile-frame .pb-28 {
        padding-bottom: 1.5rem;
    }

    .acm-bottom-nav {
        display: none !important;
    }

    /* Pembungkus konten & modal yang dipatok lebar HP ikut dilebarkan. */
    .mobile-frame .max-w-md {
        max-width: 46rem;
    }

    /* Halaman yang isinya memang katalog (UMKM) memakai lebar penuh. */
    .mobile-frame .max-w-md.acm-lebar {
        max-width: 72rem;
    }

    .mobile-frame .max-w-xs {
        max-width: 26rem;
    }

    /* Skala huruf: kelas berukuran kecil khas HP dinaikkan supaya nyaman dibaca
       pada jarak laptop. Aturan ini sengaja menimpa utilitas Tailwind, jadi tidak
       perlu menyunting 30+ view satu per satu. Tinggi baris ikut dinaikkan supaya
       pasangan font-size/line-height tetap proporsional. */
    .mobile-frame .text-\[9px\] {
        font-size: 0.72rem;
        line-height: 1.05rem;
    }

    .mobile-frame .text-\[10px\] {
        font-size: 0.8rem;
        line-height: 1.15rem;
    }

    .mobile-frame .text-\[11px\] {
        font-size: 0.88rem;
        line-height: 1.25rem;
    }

    .mobile-frame .text-xs {
        font-size: 0.95rem;
        line-height: 1.4rem;
    }

    .mobile-frame .text-sm {
        font-size: 1.05rem;
        line-height: 1.6rem;
    }

    .mobile-frame .text-base {
        font-size: 1.2rem;
        line-height: 1.75rem;
    }

    .mobile-frame .text-\[8px\] {
        font-size: 0.72rem;
        line-height: 1.05rem;
    }

    .mobile-frame .text-\[9\.5px\] {
        font-size: 0.8rem;
        line-height: 1.15rem;
    }
}

/* Kartu KTA adalah tiruan fisik kartu 85,6 × 53,9 mm dengan lebar tetap
   (max-w-[380px]); skala huruf global di atas dikecualikan di dalamnya supaya
   isi tidak meluber keluar bingkai kartu. Ukuran micro (≤7,5px) sengaja tidak
   dinaikkan di halaman mana pun karena dipakai sebagai label cetak. */
.kta-card .text-\[8px\]   { font-size: 8px;    line-height: 10px; }
.kta-card .text-\[9px\]   { font-size: 9px;    line-height: 12px; }
.kta-card .text-\[9\.5px\]{ font-size: 9.5px;  line-height: 12px; }
.kta-card .text-\[10px\]  { font-size: 10px;   line-height: 12px; }
.kta-card .text-\[11px\]  { font-size: 11px;   line-height: 14px; }
.kta-card .text-xs        { font-size: 12px;   line-height: 16px; }

/* ---------- NAVIGASI UTAMA (bar atas di layar laptop) ---------- */
/* Di bawah 1024px navigasi memakai .acm-bottom-nav, jadi bar ini disembunyikan. */
.acm-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .acm-sidebar {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.35rem 1.25rem;
        flex: 0 0 auto;
        padding: 0.5rem 1.5rem;
        background-color: #ffffff;
        border-bottom: 1px solid #e5e7eb;
        z-index: 70;
    }
}

.acm-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #046b41;
    text-decoration: none;
}

.acm-sidebar-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 8px;
}

.acm-sidebar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    /* Menu rata kanan seperti bar navigasi blog pada umumnya. */
    margin-left: auto;
}

.acm-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.acm-sidebar-nav a i {
    font-size: 0.95rem;
}

.acm-sidebar-nav a:hover {
    background-color: #ecfdf5;
    color: #047857;
}

.acm-sidebar-nav a.aktif {
    background-color: #046b41;
    color: #ffffff;
}

/* Nama ranting tidak muat di bar atas; informasi ini tetap ada di footer/HP. */
.acm-sidebar-kaki {
    display: none;
}

.font-arabic {
    font-family: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
}

/* Sembunyikan Scrollbar */
.no-scrollbar::-webkit-scrollbar { 
    display: none; 
}
.no-scrollbar { 
    -ms-overflow-style: none; 
    scrollbar-width: none; 
}

/* STYLING KHUSUS CETAK PRINTER */
@media print {
    body {
        background-color: #ffffff !important;
        padding: 0 !important;
    }

    /* Hilangkan Bingkai HP Saat Mencetak */
    .mobile-frame {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: transparent !important;
        padding-left: 0 !important; /* ruang sidebar desktop tidak boleh ikut tercetak */
    }

    .acm-sidebar {
        display: none !important;
    }

    body * {
        visibility: hidden !important;
    }

    #ktaPrintArea, #ktaPrintArea * {
        visibility: visible !important;
    }

    #ktaPrintArea {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 10px 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 20px !important;
        background: #ffffff !important;
    }

    .kta-card {
        box-shadow: none !important;
        border: 1px solid #9ca3af !important;
        page-break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Navigasi bawah.
   Blok lama menargetkan ".bottom-nav / nav.fixed-bottom / footer.bottom-navigation"
   dengan position:fixed — tidak pernah cocok dengan markup sebenarnya
   (partials/bottom-nav.ejs memakai absolute di dalam .mobile-frame), jadi dihapus. */
.acm-bottom-nav {
    /* Naik sebesar area aman HP berponi supaya tombol tidak tertutup gesture bar */
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)) !important;
}

.acm-bottom-nav a {
    min-height: 44px; /* target sentuh minimum yang disarankan */
}

/* Chip filter/tab berpola "rounded-full + py-1.5" tingginya cuma ~29px — terlalu
   tipis untuk jari. Dinaikkan ke 40px dan teksnya ditengahkan secara vertikal.
   Aturan ini sengaja di CSS (bukan 30 view) karena polanya identik di mana-mana. */
.mobile-frame a.rounded-full[class*="py-1.5"],
.mobile-frame button.rounded-full[class*="py-1.5"] {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
}

/* Kotak centang & radio utilitas HP (w-4 h-4 = 16px) diperbesar di layar
   tablet/laptop: jarinya lebih besar, jaraknya lebih jauh. flex-shrink:0 karena
   di dalam <label> flex kotak ini ikut terhimpit sampai 13px. */
@media (min-width: 768px) {
    .mobile-frame input[type="checkbox"],
    .mobile-frame input[type="radio"] {
        width: 1.15rem;
        height: 1.15rem;
        flex-shrink: 0;
    }
}

@media (max-width: 360px) {
    /* HP layar sempit: label nav jangan sampai terpotong */
    .acm-bottom-nav span {
        font-size: 10px !important;
    }
}

