/* ============================================================================
 * VUR — assets/style.css
 * ----------------------------------------------------------------------------
 * CATATAN MAINTENANCE:
 *  - Semua token desain (warna/font/radius/transisi) dikelola di :root —
 *    cukup ubah di satu tempat.
 *  - Breakpoint responsive: 768px (tablet) & 480px (mobile kecil).
 *  - Migrasi GitHub → GitLab TIDAK menyentuh file ini (semua URL repo
 *    terpusat di script.js → REPO_CONFIG).
 *  - Library ikon: Phosphor saja (Font Awesome dihapus dari index.html).
 * ========================================================================== */

/* --- CSS VARIABLES & RESET --- */
:root {
    --bg: #1a1a1a;
    --bg-card: #242424;
    --bg-hover: #2d2d2d;
    --primary: #478061;
    --primary-hover: #5a9a76;
    --accent: #bfa76f;
    --text: #e5e5e5;
    --text-muted: #a3a3a3;
    --border: #333333;
    --danger: #ff6b6b;          /* status error (view gagal load) */
    --font-ui: 'Inter', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    --radius: 8px;
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Mencegah scroll horizontal body */
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

/* Aksesibilitas: indikator fokus keyboard yang jelas */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- LAYOUT UTILITIES --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Wrapper <main> — pengganti inline style di index.html */
.main-content { flex: 1; padding-top: 2rem; padding-bottom: 2rem; }

/* Baris "judul seksi + tombol aksi" (Latest Package / Package Index) */
.list-header { flex-wrap: wrap; gap: 1rem; }

/* Pesan <noscript> */
.noscript-msg { text-align: center; padding: 2rem; color: var(--text-muted); }

/* --- HEADER --- */
header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    white-space: nowrap;
}
.logo span { color: var(--primary); }
.logo i { color: var(--accent); font-size: 1.5rem; }

nav ul { list-style: none; display: flex; gap: 20px; align-items: center; }
nav a { font-weight: 500; color: var(--text-muted); white-space: nowrap; }
nav a:hover, nav a.active { color: var(--primary); }

/* Link ikon repo di navbar — diberi padding agar area sentuh memadai */
.nav-repo { display: inline-flex; align-items: center; font-size: 1.25rem; padding: 4px; }

/* --- HERO & SEARCH --- */
.hero { text-align: center; padding: 3rem 0 2rem; }

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--text), var(--primary));
    -webkit-background-clip: text;
    background-clip: text; /* FIX: tambahan properti standar (non-webkit) */
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.hero p { color: var(--text-muted); margin-bottom: 2rem; }

.search-container { max-width: 600px; margin: 0 auto; position: relative; width: 100%; }

/* Search yang menempel di baris judul (view Packages) — pengganti inline style */
.search-inline { max-width: 100%; margin: 0; flex: 1; min-width: 220px; }

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 1rem; /* ≥16px mencegah auto-zoom saat fokus di iOS */
    transition: var(--transition);
    -webkit-appearance: none;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(71, 128, 97, 0.2);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
    pointer-events: none;
}

/* --- CATEGORY FILTER --- */
.category-filters { display: flex; gap: 10px; margin-bottom: 1.5rem; flex-wrap: wrap; }

.filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    border-radius: 99px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font-ui);
    transition: var(--transition);
    white-space: nowrap;
}
.filter-btn:hover { border-color: var(--text); color: var(--text); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* --- STATS --- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 3rem; }

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-value {
    font-size: clamp(1.5rem, 5vw, 2rem); /* mengecil otomatis di layar kecil */
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-code);
}

/* Nilai stat berupa teks (mis. "Void Linux") — sedikit lebih kecil dari angka */
.stat-value--text { font-size: clamp(1.05rem, 3.5vw, 1.4rem); }

.stat-label { color: var(--text-muted); font-size: 0.9rem; }

/* --- PACKAGE TABLE --- */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;                          /* horizontal scroll di mobile */
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 600px; /* jaga lebar minimum agar tabel tidak gepeng */
}

th {
    background: var(--bg-hover);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

td { padding: 1rem; border-bottom: 1px solid var(--border); color: var(--text); white-space: nowrap; }
tr:last-child td { border-bottom: none; }

/* FIX: hanya baris paket (bukan baris "No data.") yang interaktif */
tr[data-pkg] { cursor: pointer; }
tr[data-pkg]:hover td { background-color: rgba(255, 255, 255, 0.02); }

.pkg-name { font-weight: 600; color: var(--primary); font-family: var(--font-code); }
.pkg-ver { font-family: var(--font-code); color: var(--accent); font-size: 0.9rem; }
.pkg-cat {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(71, 128, 97, 0.15);
    color: var(--primary);
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* FIX: kolom deskripsi boleh wrap supaya tabel tidak melebar tak terkendali */
.pkg-desc { white-space: normal; min-width: 180px; color: var(--text-muted); }

/* Pesan "No data." di tengah tabel */
.table-empty { text-align: center; color: var(--text-muted); }

/* --- PACKAGE DETAIL --- */
.detail-header {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.detail-title h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-family: var(--font-code);
    word-break: break-word;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    align-items: center;
}

/* Pengganti inline style color: var(--text) pada <strong> di meta */
.detail-meta strong { color: var(--text); }

.meta-item { display: flex; align-items: center; gap: 5px; }

.detail-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: var(--font-ui);
    transition: var(--transition);
    min-height: 44px; /* standar touch target (aksesibilitas) */
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-muted); background: var(--bg-hover); }

/* Tombol kecil "See All" — pengganti inline style */
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* Tombol "Return to List" — pengganti inline style */
.btn-back {
    margin-bottom: 1rem;
    border: none;
    padding-left: 0;
    justify-content: flex-start;
    min-height: auto;
    color: var(--text-muted);
}

.detail-section { margin-bottom: 2rem; }
.detail-section h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.detail-desc { font-size: 1.1rem; }

/* Catatan kecil sebelum code block — pengganti inline style */
.install-note { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }

.code-block {
    background: #0f0f0f;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.code-block pre {
    margin: 0;
    font-family: var(--font-code);
    color: #d4d4d4;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-block code { color: var(--accent); }

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 36px;
}
.copy-btn:hover { color: var(--primary); border-color: var(--primary); }

/* Status "Copied!" — pengganti manipulasi style langsung dari JS */
.copy-btn--done { color: var(--primary); border-color: var(--primary); }

/* --- FOOTER --- */
footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.footer-note { margin-top: 0.5rem; font-size: 0.8rem; opacity: 0.7; }

/* --- LOADING, EMPTY & ERROR STATES --- */
.loading, .empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }

/* Ikon besar pada state kosong — pengganti inline style */
.empty-state i { font-size: 3rem; margin-bottom: 1rem; display: inline-block; }

/* View gagal load (di-render oleh script.js) */
.load-error i { font-size: 3rem; color: var(--danger); }
.load-error code { font-family: var(--font-code); color: var(--accent); word-break: break-all; font-size: 0.85rem; }

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(71, 128, 97, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* --- RESPONSIVE MEDIA QUERIES --- */

/* Tablet (potret) & mobile besar */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero { padding: 2rem 0 1.5rem; }
    .logo { font-size: 1.1rem; }
    nav ul { gap: 10px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .detail-header { flex-direction: column; }
    .detail-actions { width: 100%; flex-direction: column; }
    .btn { width: 100%; }
}

/* Mobile kecil (iPhone SE, Android kecil) */
@media (max-width: 480px) {
    .container { padding: 0 15px; }
    header .container { flex-direction: column; gap: 1rem; }
    nav ul { width: 100%; justify-content: space-between; }
    nav a { font-size: 0.9rem; }
    .logo { font-size: 1rem; }

    /* Tagline logo disembunyikan agar tidak overflow di layar sempit */
    .logo span { display: none; }

    .stats-grid { grid-template-columns: 1fr; }

    /* FIX: sembunyikan kolom kategori via class .col-cat (lebih aman
       daripada nth-child bila urutan kolom tabel berubah) */
    .col-cat { display: none; }

    .detail-title h1 { font-size: 1.5rem; }
}