/* RESET & ANTI LONG-PRESS MENU BROWSER */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none; /* Cegah popup image/link (iOS/Android) */
  -webkit-user-select: none; /* Cegah blok/salin teks */
  user-select: none;
}

/* Izinkan ketik/blok pada form input saja */
input, textarea, select {
  -webkit-user-select: auto;
  user-select: auto;
}

button, a, .card, .cat-btn, .icon-btn, .fab, .toggle-btn, .admin-act-btn, .cat-chip {
  outline: none; 
}

/* VARIABEL WARNA BARU (Muted/Soft Slate Blue) */
:root {
  --bg-1: #0f172a; 
  --bg-2: #1e293b; /* Lebih gelap, tidak terlalu biru */
  --card-bg: rgba(15,23,42,.7);
  --card-border: rgba(255,255,255,.1);
  --text-main: #e2e8f0; 
  --text-muted: #94a3b8;
  --input-bg: rgba(15,23,42,.8);
  --modal-bg: rgba(15, 23, 42, 0.96);
  --brand: #4a6fa5; /* Slate Blue Soft */
  --brand-hover: #3b5998; 
  --shadow: 0 10px 30px rgba(0,0,0,.2);
  --radius-lg: 20px;
  --body-bg: linear-gradient(135deg, var(--bg-2), var(--bg-1));
}

body.light-mode {
  --bg-1: #f8fafc; 
  --bg-2: #e2e8f0;
  --card-bg: rgba(255,255,255,.9);
  --card-border: rgba(0,0,0,.08);
  --text-main: #0f172a; 
  --text-muted: #475569;
  --input-bg: rgba(255,255,255,.9);
  --modal-bg: rgba(255, 255, 255, 0.98);
  --body-bg: linear-gradient(135deg, var(--bg-2), var(--bg-1));
}

html, body { height: 100%; font-family: 'Inter', sans-serif; }
h1, h2, h3, .cat-btn, .cat-chip-name { font-family: 'Outfit', sans-serif; }

body { color: var(--text-main); background: var(--body-bg); background-attachment: fixed; transition: background 0.3s ease; }
body.no-scroll { overflow: hidden !important; }

.container { width: min(1200px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 90px; }

/* HEADER PERBAIKAN PADDING & WARNA */
.header { padding: 12px 20px; border-radius: var(--radius-lg); background: var(--brand); color: #fff; display: flex; align-items: center; gap: 14px; margin: 20px 0; box-shadow: var(--shadow); }
.header img { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; }
.header h1 { font-size: 22px; margin-bottom: 2px; display:flex; align-items:center; flex-wrap:wrap;}

.banner-container { aspect-ratio: 16 / 7; width: 100%; position: relative; border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 20px; box-shadow: var(--shadow); background: #000; }
.banner-slide { position: absolute; inset: 0; opacity: 0; transition: opacity 0.8s ease; }
.banner-slide.active { opacity: 1; }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }

.corner-controls { position: fixed; top: 20px; right: 20px; display: flex; gap: 10px; z-index: 1000; }
.icon-btn { width: 45px; height: 45px; border-radius: 50%; border: none; background: var(--card-bg); color: var(--text-main); font-size: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(10px); border: 1px solid var(--card-border); box-shadow: var(--shadow); transition: all 0.2s; }
.icon-btn:hover { background: var(--brand); color: #fff; transform: translateY(-2px); }

/* TOAST */
.toast { position: fixed; top: -100px; left: 50%; transform: translateX(-50%); background: var(--card-bg); color: var(--text-main); padding: 12px 20px; border-radius: 30px; border: 1px solid var(--card-border); box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: flex; align-items: center; gap: 8px; z-index: 9999; font-size: 14px; font-weight: bold; backdrop-filter: blur(10px); transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.toast.show { top: 20px; }
.toast.error i { color: #ef4444; }
.toast.success i { color: #10b981; }

.form-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; display: block; font-weight: 600; }
.input-field { width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--input-bg); color: var(--text-main); font-size: 15px; margin-bottom: 16px; outline: none; transition: border-color 0.2s; font-family: 'Inter', sans-serif;}
.input-field:focus { border-color: var(--brand); }

/* SEARCH BAR */
.search-container { position: relative; width: 100%; margin-bottom: 16px; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--text-muted); }
.search-box { width: 100%; padding: 14px 16px 14px 44px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--input-bg); color: var(--text-main); font-size: 15px; outline: none; transition: border-color 0.2s; font-family: 'Inter', sans-serif;}
.search-box:focus { border-color: var(--brand); }

/* KATEGORI GRID */
.cat-grid-selector { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; max-height: 200px; overflow-y: auto; padding-right: 5px;}
.cat-chip { background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 12px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; transition: 0.2s; color: var(--text-muted); text-align: center; }
.cat-chip:hover { border-color: var(--brand); color: var(--text-main); background: rgba(74, 111, 165, 0.1); }
.cat-chip.selected { background: var(--brand); color: #fff; border-color: var(--brand-hover); box-shadow: 0 4px 15px rgba(74,111,165,0.3); }
.cat-chip i { font-size: 24px; }
.cat-chip-name { font-size: 12px; line-height: 1.2; word-break: break-word; }

/* TOGGLE TABS */
.toggle-group { display: flex; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.toggle-btn { flex: 1; background: transparent; border: none; padding: 12px; color: var(--text-muted); cursor: pointer; font-weight: bold; font-size: 14px; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px; font-family: 'Inter', sans-serif;}
.toggle-btn.active { background: var(--brand); color: #fff; }

.btn-primary { width: 100%; padding: 14px; border-radius: 12px; border: none; background: var(--brand); color: #fff; font-weight: bold; font-family: 'Inter', sans-serif; cursor: pointer; transition: background 0.2s; display: flex; justify-content: center; align-items: center; gap: 8px; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-outline { padding: 10px 20px; border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-main); border-radius: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; font-weight: 600; font-family: 'Inter', sans-serif;}
.btn-outline:hover { background: rgba(74, 111, 165, 0.15); border-color: var(--brand); }

/* CHIP KATEGORI GALERI */
.category-container { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; }
.category-container::-webkit-scrollbar { display: none; }
.cat-btn { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 30px; border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-main); cursor: pointer; white-space: nowrap; font-weight: 600; transition: all 0.2s; scroll-snap-align: start; }
.cat-btn.active, .cat-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* GALERI & CARD */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-top: 10px; }
.card { background: var(--card-bg); border-radius: 16px; overflow: hidden; border: 1px solid var(--card-border); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; position: relative; box-shadow: var(--shadow); }
.card:hover { transform: translateY(-5px); border-color: var(--brand); box-shadow: 0 15px 35px rgba(0,0,0,.25); }

.img-wrapper { width: 100%; height: 180px; position: relative; overflow: hidden; background-color: rgba(0, 0, 0, 0.2); }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite linear; }
body.light-mode .skeleton { background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0.04) 75%); background-size: 200% 100%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Cegah hold-press image menu di dalam card */
.card img { pointer-events: none; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 0.5s ease-in-out; transform: translateZ(0); will-change: opacity; }
.card img.loaded { opacity: 1; }

.card-body { padding: 12px; }
.card-title { font-size: 14px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; font-family: 'Outfit', sans-serif;}

/* LABEL BADGES */
.badge-container { display: flex; flex-direction: column; gap: 6px; }
.badge-cat { font-size: 11px; color: var(--text-muted); font-weight: 500;}
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: bold; max-width: fit-content; }
.badge-dev { background: rgba(74, 111, 165, 0.15); color: #4a6fa5; border: 1px solid rgba(74, 111, 165, 0.3); }
.badge-user { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* TOMBOL ADMIN DI CARD */
.admin-card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 10; }
.admin-act-btn { width: 32px; height: 32px; border-radius: 8px; border: none; display: flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer; color: white; backdrop-filter: blur(5px); transition: 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.3);}
.admin-act-btn:hover { transform: scale(1.1); }
.btn-edit { background: rgba(74, 111, 165, 0.8); border: 1px solid rgba(74, 111, 165, 1); }
.btn-del { background: rgba(239, 68, 68, 0.8); border: 1px solid rgba(239, 68, 68, 1); }

.fab { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; background: var(--brand); color: white; border-radius: 50%; font-size: 30px; display: flex; justify-content: center; align-items: center; box-shadow: 0 10px 25px rgba(74, 111, 165, 0.4); cursor: pointer; z-index: 100; transition: transform 0.2s; }
.fab:hover { transform: scale(1.1); background: var(--brand-hover); }

/* MODALS */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; z-index: 2000; opacity: 0; visibility: hidden; transition: all 0.3s ease; padding: 20px; }
.overlay.active { opacity: 1; visibility: visible; }
.modal-content { background: var(--modal-bg); width: 100%; max-width: 500px; border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--card-border); position: relative; max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 50px rgba(0,0,0,0.5); }
.modal-large { max-width: 800px; height: 85vh; display: flex; flex-direction: column; }
.modal-large .scrollable { flex: 1; overflow-y: auto; margin-top: 10px; padding-right: 10px; }

.close-modal { position: absolute; top: 20px; right: 20px; font-size: 28px; cursor: pointer; color: var(--text-muted); transition: color 0.2s; z-index: 10;}
.close-modal:hover { color: #ef4444; }

/* DEV PROFILE CARD (FIX FONT WARNA) */
.dev-card-container { text-align: center; padding: 40px 24px; background: linear-gradient(180deg, var(--bg-1) 0%, var(--modal-bg) 100%);}
.dev-profile { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.dev-avatar { width: 90px; height: 90px; border-radius: 50%; background: linear-gradient(135deg, #1e293b, #0f172a); display: flex; justify-content: center; align-items: center; font-size: 45px; color: #475569; margin-bottom: 16px; border: 2px solid var(--card-border); box-shadow: 0 10px 25px rgba(0,0,0,0.3); }
.dev-name { font-family: 'Outfit', sans-serif; font-size: 24px; color: var(--text-main); margin-bottom: 4px; font-weight: 800; letter-spacing: 0.5px;} /* Color ikut tema */
.dev-title { font-size: 14px; color: var(--brand); display: flex; align-items: center; gap: 6px; font-weight: 600; justify-content: center;}
.verified-badge { color: #3b82f6; font-size: 16px; }
.dev-desc { background: var(--card-bg); padding: 16px; border-radius: 12px; border: 1px solid var(--card-border); font-size: 14px; color: var(--text-muted); line-height: 1.6; }

.admin-list { margin-top: 10px; display: flex; flex-direction: column; gap: 12px; }
.admin-item { background: var(--card-bg); padding: 12px; border-radius: 12px; border: 1px solid var(--card-border); display: flex; gap: 12px; align-items: center; }
.admin-item img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; }
.admin-info { flex: 1; }
.admin-info h4 { font-size: 14px; margin-bottom: 4px; font-family:'Outfit', sans-serif; }
.admin-info p { font-size: 12px; color: var(--text-muted); margin: 0; }
.admin-actions { display: flex; gap: 8px; }
.btn-acc { background: #10b981; color: white; border: none; padding: 8px; border-radius: 8px; cursor: pointer; display:flex; align-items:center; }
.btn-rej { background: #ef4444; color: white; border: none; padding: 8px; border-radius: 8px; cursor: pointer; display:flex; align-items:center; }

.viewer-img { max-width: 100%; max-height: 65vh; border-radius: 12px; object-fit: contain; margin: 20px auto; display: block; pointer-events: auto; }
.viewer-actions-bar { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 640px) {
  .header h1 { font-size: 20px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .fab { bottom: 20px; right: 20px; }
  .banner-container { aspect-ratio: 16 / 9; }
  .modal-large { height: 95vh; padding: 20px 16px; }
  .admin-item { flex-direction: column; align-items: stretch; text-align: center; }
  .admin-item img { width: 100%; height: 120px; }
  .admin-actions { justify-content: center; }
  .cat-grid-selector { grid-template-columns: repeat(2, 1fr); }
}
