:root {
    --bg: #121212;
    --bg-card: #1e1e1e;
    --bg-elevated: #262626;
    --border: #333333;
    --accent: #8e278b;
    --accent-light: #a940a6;
    --text: #f0f0f0;
    --text-dim: #a0a0a0;
    --green: #2ea843;
    --red: #d9432e;
    --orange: #e8a33d;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
}
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ── Navbar ────────────────────────────────────────────────────────── */
.navbar {
    background: #1a1a1a;
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.navbar nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.navbar .brand { font-weight: bold; font-size: 20px; color: #fff; }
.navbar .brand span { color: var(--accent-light); }
.navbar nav a {
    color: var(--text);
    margin-left: 4px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    display: inline-block;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.navbar nav a:hover {
    background: var(--accent);
    color: #fff;
}
.navbar nav a.active {
    background: rgba(255,255,255,0.08);
}
.navbar .user-chip { display: flex; align-items: center; gap: 8px; }
.navbar .user-chip img { width: 28px; height: 28px; border-radius: 50%; }

/* ── User menu dropdown (avatar jadi tombol, Profil+Logout nongol pas diklik) ── */
.user-menu { position: relative; }
.user-menu-toggle {
    display: flex; align-items: center; gap: 8px;
    background: transparent; border: none; cursor: pointer;
    padding: 6px 10px; border-radius: 6px; color: var(--text); font-size: 14px;
}
.user-menu-toggle:hover { background: rgba(255,255,255,0.08); }
.user-menu-toggle img { width: 28px; height: 28px; border-radius: 50%; }
.user-menu-toggle .caret { font-size: 10px; color: #888; }
.user-menu-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 6px);
    background: #1a1a1a; border: 1px solid var(--border); border-radius: 8px;
    min-width: 160px; padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 50;
}
.user-menu.open .user-menu-dropdown { display: block; }
.user-menu-dropdown a, .user-menu-dropdown button {
    display: block; width: 100%; text-align: left; background: none; border: none;
    color: var(--text); font-size: 14px; padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.user-menu-dropdown a:hover, .user-menu-dropdown button:hover { background: rgba(255,255,255,0.08); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-download { display: inline-flex; align-items: center; gap: 8px; }
.btn-download svg { flex-shrink: 0; }
.btn-wa { background: #25D366; color: #063; color: #fff; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ── Badges ────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: bold; }
.badge-trial { background: rgba(232,163,61,0.2); color: var(--orange); }
.badge-active { background: rgba(46,168,67,0.2); color: var(--green); }
.badge-expired, .badge-revoked { background: rgba(217,67,46,0.2); color: var(--red); }

/* ── Forms ─────────────────────────────────────────────────────────── */
label { display: block; font-size: 13px; margin-bottom: 4px; color: var(--text-dim); }
input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 14px;
}

/* input[type=file] BEDA dari input teks biasa -- browser render tombol
   "Choose File"/"Browse" pakai widget native-nya sendiri, gak nurut ke
   background/padding CSS biasa (ini penyebab tombol browse keliatan gak
   ke-style/beda sendiri dari input lain). ::file-selector-button didukung
   semua browser modern, dipakai buat gantiin tampilan tombolnya biar
   konsisten sama tema gelap situs ini. */
input[type="file"] {
    padding: 8px 0;
    background: transparent;
    border: none;
}
input[type="file"]::file-selector-button {
    padding: 10px 16px;
    margin-right: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.15s;
}
input[type="file"]::file-selector-button:hover {
    opacity: 0.85;
}

/* ── Progress bar upload (installer) ─────────────────────────────────── */
.progress-bar-wrap {
    display: none;
    width: 100%;
    height: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0 4px;
}
.progress-bar-wrap.active { display: block; }
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.2s ease;
}
table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
table th { color: var(--text-dim); font-weight: normal; font-size: 12px; text-transform: uppercase; }

/* ── Misc ──────────────────────────────────────────────────────────── */
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 13px; }
.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.section { padding-top: 40px; padding-bottom: 40px; }
.hero { padding: 60px 0 40px; text-align: center; }
.hero h1 { font-size: 36px; margin-bottom: 10px; }
.app-icon { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--bg-elevated); }
.gallery-thumb { width: 100%; border-radius: 8px; aspect-ratio: 16/9; object-fit: cover; background: var(--bg-elevated); }
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(217,67,46,0.15); color: #ff9d8a; border: 1px solid rgba(217,67,46,0.4); }
.alert-success { background: rgba(46,168,67,0.15); color: #a3e6ae; border: 1px solid rgba(46,168,67,0.4); }

/* ── Carousel ──────────────────────────────────────────────────────── */
.carousel {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-elevated);
    aspect-ratio: 4/3;
    max-height: 380px;
    margin: 0 auto 16px;
}
.carousel-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* contain, BUKAN cover -- biar gambar portrait (screenshot HP) gak
       ke-crop/zoom paksa buat penuhin kotak landscape. Sisi kosongnya
       (letterbox) otomatis ke-isi warna background kotak (bg-elevated). */
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: zoom-in;
}
.carousel-slide.active { opacity: 1; z-index: 1; }
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}
.carousel-nav:hover { background: rgba(0,0,0,0.8); }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }
.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 2;
}
.carousel-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
}
.carousel-dot.active { background: #fff; }

/* ── Lightbox ──────────────────────────────────────────────────────── */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 40px;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: 90%; max-height: 85vh; border-radius: 6px; }
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ── Navbar di layar sempit -- nama user disembunyiin (avatar+caret doang),
   biar .user-chip tetap muat sebaris sama brand+nav, gak kepental ke
   baris baru sendirian. ── */
@media (max-width: 768px) {
    .navbar .user-chip span { display: none; }
    .navbar nav a { padding: 6px 10px; font-size: 13px; }

    /* Baris 1 tegas: logo/hamburger di kiri, avatar di kanan (order
       dipaksa, BUKAN ngandelin urutan wrap otomatis -- itu yang bikin
       avatar suka "kececer" pindah ke kiri sendirian). Baris 2: nav link,
       dipaksa turun penuh 1 baris sendiri lewat width:100%. */
    .navbar .container { flex-wrap: wrap; }
    .navbar .container > .user-chip { order: 2; }
    .navbar .container > nav { order: 3; width: 100%; margin-top: 4px; }

    /* ── Forum di HP: .flex-between normalnya majang 2 item di ujung kiri
       kanan tanpa wrap -- di layar sempit itu yang bikin tombol/kolom
       kanan "kepepet" nempel ke tepi (gak overflow, tapi keliatan mepet
       banget). Dipaksa numpuk ke bawah (wrap) + full-width biar ada napas
       kiri-kanannya, SELARAS sama padding .container yang lain. Discope
       cuma ke hero & thread-row forum -- .flex-between di admin/dashboard
       sengaja gak disentuh biar gak ganggu layout yang udah jalan. ── */
    .hero .flex-between {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        text-align: left;
    }
    .hero .flex-between .btn { width: 100%; text-align: center; }

    .thread-row .flex-between {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .thread-row-stats {
        text-align: left !important;
        white-space: normal !important;
    }
}

/* ── Forum ─────────────────────────────────────────────────────────── */
.vote-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    width: 40px;
}
.vote-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 32px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vote-btn:hover { border-color: var(--accent); color: var(--text); }
.vote-btn.vote-up.active { background: rgba(46,168,67,0.2); border-color: var(--green); color: var(--green); }
.vote-btn.vote-down.active { background: rgba(217,67,46,0.2); border-color: var(--red); color: var(--red); }
.vote-score { font-weight: bold; font-size: 14px; padding: 2px 0; }

.post-content { line-height: 1.7; word-break: break-word; }
.post-content a { text-decoration: underline; }

.forum-attachment-img {
    max-width: 260px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: cover;
    cursor: zoom-in;
    margin: 4px 8px 4px 0;
    border: 1px solid var(--border);
}
.forum-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    margin: 4px 8px 4px 0;
    font-size: 13px;
    color: var(--text);
}
.forum-file-chip:hover { border-color: var(--accent); text-decoration: none; }

/* ── Language switcher (EN | ID) ── */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; margin-right: 8px; font-size: 12px; }
.lang-switch a { color: #888; padding: 3px 7px; border-radius: 4px; }
.lang-switch a:hover { color: #fff; text-decoration: none; }
.lang-switch a.active { color: #fff; font-weight: bold; background: var(--accent); }

/* ── Tombol aksi di kartu app (beranda) ──
   Tombol utama selalu 1 baris penuh; tombol download ada di baris bawahnya,
   melebar rata. Teks panjang (EN/ID) gak lagi kepotong jadi 2 baris. */
.app-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.app-actions > .btn-primary { flex: 1 0 100%; text-align: center; white-space: nowrap; }
.app-actions > form { flex: 1 1 96px; min-width: 0; }
.app-actions .btn-download { width: 100%; justify-content: center; white-space: nowrap; }

/* ── Ikon panah download di semua tombol download app ──
   Dibuat lewat CSS (mask + currentColor) jadi otomatis ikut warna teks tombol
   dan berlaku di beranda maupun halaman detail app tanpa ubah markup. */
.btn-download::after {
    content: "";
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-left: 2px;
    background-color: currentColor;
    opacity: 0.85;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11m0 0l-4.5-4.5M12 15l4.5-4.5M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11m0 0l-4.5-4.5M12 15l4.5-4.5M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ── Transisi halus antar halaman ──
   Cara paling sederhana & aman: isi halaman (main / .content) muncul dengan
   fade-in + naik tipis tiap halaman dibuka. Navbar & sidebar SAMA SEKALI gak
   ikut dianimasikan, jadi gak ada kedip. Tanpa JavaScript & tanpa View
   Transitions API. Dimatikan kalau pengguna memilih "reduce motion". */
@keyframes page-in {
    from { opacity: 0; transform: translateY(8px); }
}
@media (prefers-reduced-motion: no-preference) {
    main, .content { animation: page-in 0.3s ease backwards; }
}

/* ── Pagination ── */
.pager { margin: 24px 0 8px; }
.pager-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pager-item {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: 8px;
    background: #1a1a1a; color: #ddd; font-size: 14px; line-height: 1;
    text-decoration: none; transition: border-color .15s, color .15s;
}
a.pager-item:hover { border-color: var(--accent); color: #fff; text-decoration: none; }
.pager-item.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: bold; }
.pager-item.disabled { opacity: .4; cursor: default; }
.pager-info { margin: 10px 0 0; font-size: 13px; color: #888; }
