/* =========================================================
   SAYUTIHUB v5 (Cleaned & Optimized)
========================================================= */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --purple: #8b5cf6;
  --bg-body: #090d16;
  --bg-card: rgba(30, 41, 59, 0.72);
  --bg-card-hover: rgba(30, 41, 59, 0.94);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-soft: #cbd5e1;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(129, 140, 248, 0.38);
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-cyan: #22d3ee;
  --radius-sm: 8px;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.16);
  --shadow-hover: 0 18px 45px rgba(0, 0, 0, 0.30);
  --transition: 0.22s ease;
}

/* BASE & RESET */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  scrollbar-color: rgba(148, 163, 184, 0.18) transparent;
  scrollbar-width: thin;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  color: var(--text-main);
  background: 
    radial-gradient(circle at 10% 0%, rgba(99, 102, 241, 0.08), transparent 30%),
    radial-gradient(circle at 90% 45%, rgba(139, 92, 246, 0.06), transparent 32%),
    linear-gradient(180deg, #090d16 0%, #080c14 100%);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection { color: #fff; background: rgba(99, 102, 241, 0.35); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.18); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(129, 140, 248, 0.45); }

/* BACKGROUND GLOW */
.glow-orb {
  position: fixed; border-radius: 50%; filter: blur(100px);
  pointer-events: none; z-index: -1; opacity: 0.7;
}
.glow-1 { width: 300px; height: 300px; top: -120px; left: -120px; background: rgba(99, 102, 241, 0.2); }
.glow-2 { width: 350px; height: 350px; top: 50%; right: -150px; background: rgba(139, 92, 246, 0.14); }

/* NAVBAR */
nav {
  position: sticky; top: 0; z-index: 100; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; background: rgba(9, 13, 22, 0.88);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text-main); font-size: 1.05rem; font-weight: 800;
  text-decoration: none; transition: transform var(--transition);
}
.brand:hover { transform: translateY(-1px); }
.brand > i {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.15rem; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  box-shadow: 0 7px 22px var(--primary-glow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.brand:hover > i { transform: rotate(-4deg) scale(1.05); box-shadow: 0 10px 28px rgba(99, 102, 241, 0.48); }

.nav-actions {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
}
.nav-actions::-webkit-scrollbar { display: none; }

.nav-btn {
  min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; color: var(--text-main); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  font: inherit; font-size: 0.78rem; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: var(--transition);
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.nav-btn:active { transform: scale(0.98); }

.nav-btn.primary-action {
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-color: var(--primary); box-shadow: 0 5px 16px rgba(99, 102, 241, 0.2);
}
.nav-btn.primary-action:hover {
  background: linear-gradient(135deg, #7174f7, #554ce8);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

/* HEADER & CONTAINER */
header { padding: 38px 20px 22px; text-align: center; }
header h1 {
  margin-bottom: 8px; color: transparent;
  font-size: clamp(1.55rem, 4vw, 2.1rem); font-weight: 800; line-height: 1.2; letter-spacing: -0.035em;
  background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 55%, #c4b5fd 100%);
  -webkit-background-clip: text; background-clip: text;
}
header p { max-width: 620px; margin: 0 auto; color: var(--text-muted); font-size: 0.85rem; line-height: 1.65; }

.container { width: 100%; max-width: 1240px; flex: 1; margin: 0 auto; padding: 10px 16px 40px; }

/* VIEW SECTION */
.view-section { display: none; animation: viewFade 0.25s ease; }
.view-section.active { display: block; }
@keyframes viewFade {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* CONTROLS (SEARCH & FILTER) */
.controls-wrapper { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.search-sort-row { display: flex; gap: 10px; width: 100%; }

.search-box { position: relative; flex: 1; }
.search-box i {
  position: absolute; left: 16px; top: 50%; z-index: 1; color: var(--text-muted);
  transform: translateY(-50%); pointer-events: none; transition: color var(--transition);
}
.search-box:focus-within i { color: var(--primary-light); }

.search-box input, .sort-select, .form-control {
  color: var(--text-main); background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: 14px;
  outline: none; font: inherit; font-size: 0.90rem; transition: var(--transition);
}

.search-box input { width: 100%; height: 48px; padding: 12px 42px 12px 46px; backdrop-filter: blur(10px); }
.search-box input::placeholder, .form-control::placeholder { color: #64748b; }
.search-box input:hover, .sort-select:hover, .form-control:hover { border-color: rgba(255, 255, 255, 0.12); }
.search-box input:focus, .sort-select:focus, .form-control:focus {
  background: rgba(30, 41, 59, 0.88); border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.sort-select { width: 190px; height: 48px; padding: 0 14px; cursor: pointer; }
.sort-select option, select.form-control option { color: #fff; background: #111827; }

.filter-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-btn {
  min-height: 38px; display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px;
  color: var(--text-muted); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color); border-radius: 12px;
  font: inherit; font-size: 0.82rem; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.filter-btn.active {
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-color: var(--primary); box-shadow: 0 5px 16px var(--primary-glow);
}

/* APP GRID & CARDS */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }

.app-card {
  position: relative; display: flex; flex-direction: column; min-height: 100%; overflow: hidden; padding: 16px;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.78), rgba(15, 23, 42, 0.68));
  border: 1px solid var(--border-color); border-radius: 18px; box-shadow: var(--shadow-card);
  cursor: pointer; transition: 0.25s ease;
}
.app-card::before {
  content: ""; position: absolute; width: 180px; height: 180px; top: -100px; right: -80px;
  border-radius: 50%; background: rgba(99, 102, 241, 0.08); filter: blur(25px); pointer-events: none; transition: 0.3s ease;
}
.app-card:hover { transform: translateY(-5px); background: var(--bg-card-hover); border-color: var(--border-hover); box-shadow: var(--shadow-hover); }
.app-card:hover::before { background: rgba(99, 102, 241, 0.16); }

.fav-btn-card {
  position: absolute; top: 16px; right: 16px; z-index: 3; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05); border: 1px solid transparent; border-radius: 50%;
  cursor: pointer; transition: var(--transition);
}
.fav-btn-card:hover, .fav-btn-card.active {
  color: var(--accent-rose); background: rgba(244, 63, 94, 0.15); border-color: rgba(244, 63, 94, 0.18);
}
.fav-btn-card:hover { transform: scale(1.08); }

.app-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding-right: 42px; }
.app-icon {
  width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: #a5b4fc; font-size: 1.4rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 13px; transition: var(--transition);
}
.app-card:hover .app-icon { transform: scale(1.05); box-shadow: 0 8px 22px rgba(99, 102, 241, 0.18); }

.app-title-group h3 {
  margin-bottom: 4px; overflow: hidden; color: var(--text-main); font-size: 1rem; font-weight: 700;
  white-space: nowrap; text-overflow: ellipsis;
}

.badges { display: flex; gap: 5px; flex-wrap: wrap; }
.badge { display: inline-flex; padding: 3px 7px; border-radius: 5px; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; }
.badge-cat { color: #818cf8; background: rgba(99, 102, 241, 0.15); }
.badge-featured { color: var(--accent-amber); background: rgba(245, 158, 11, 0.15); }
.badge-trending { color: var(--accent-green); background: rgba(16, 185, 129, 0.15); }
.badge-new { color: var(--accent-cyan); background: rgba(34, 211, 238, 0.12); }

.app-desc {
  min-height: 2.55em; margin-bottom: 9px; overflow: hidden; color: var(--text-muted); font-size: 0.85rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.app-rating { display: flex; align-items: center; gap: 5px; margin-bottom: 9px; color: var(--accent-amber); font-size: 0.78rem; }
.app-rating span { color: var(--text-muted); font-size: 0.72rem; font-weight: 600; }

.app-meta {
  display: flex; justify-content: space-between; align-items: center; margin-top: auto; margin-bottom: 11px;
  padding-top: 10px; color: var(--text-muted); border-top: 1px dashed var(--border-color); font-size: 0.75rem;
}

.btn-download {
  width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px;
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 10px; text-decoration: none; font: inherit; font-size: 0.85rem; font-weight: 600;
  transition: var(--transition);
}
.btn-download:hover { background: linear-gradient(135deg, #7174f7, #554ce8); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(99, 102, 241, 0.28); }
.btn-download:active { transform: scale(0.99); }

/* DASHBOARD & TABLES */
.dashboard-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
  position: relative; overflow: hidden; padding: 17px;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.76), rgba(15, 23, 42, 0.62));
  border: 1px solid var(--border-color); border-radius: 15px; box-shadow: var(--shadow-card); transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); border-color: rgba(129, 140, 248, 0.22); }
.stat-card h4 { margin-bottom: 5px; color: var(--text-muted); font-size: 0.72rem; font-weight: 600; }
.stat-card .val { color: var(--text-main); font-size: 1.55rem; font-weight: 800; letter-spacing: -0.04em; }

.admin-table-wrapper {
  width: 100%; overflow-x: auto; padding: 5px; background: rgba(30, 41, 59, 0.60);
  border: 1px solid var(--border-color); border-radius: 15px; box-shadow: var(--shadow-card);
}
table { width: 100%; min-width: 650px; border-collapse: collapse; text-align: left; font-size: 0.82rem; white-space: nowrap; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--border-color); }
th { color: var(--text-muted); background: rgba(255, 255, 255, 0.025); font-size: 0.72rem; font-weight: 600; }
td { color: var(--text-soft); }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tbody tr:last-child td { border-bottom: none; }

.action-btns { display: flex; gap: 6px; }
.btn-icon-action {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  color: var(--text-main); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color);
  border-radius: 7px; font: inherit; cursor: pointer; transition: var(--transition);
}
.btn-icon-action:hover { color: #a5b4fc; background: rgba(99, 102, 241, 0.14); border-color: rgba(99, 102, 241, 0.25); }
.btn-icon-action.danger:hover { color: var(--accent-rose); background: rgba(244, 63, 94, 0.15); border-color: rgba(244, 63, 94, 0.2); }

/* MODALS & FORMS */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 12px; background: rgba(0, 0, 0, 0.76); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-container {
  position: relative; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; padding: 20px;
  color: var(--text-main); background: linear-gradient(145deg, #1e293b, #111827);
  border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 20px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  transform: scale(0.94) translateY(8px); opacity: 0; transition: transform 0.3s cubic-bezier(.1, .9, .2, 1), opacity 0.25s ease;
}
.modal-overlay.active .modal-container { transform: scale(1) translateY(0); opacity: 1; }

.modal-close {
  position: absolute; top: 15px; right: 15px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%; font: inherit; cursor: pointer; transition: var(--transition);
}
.modal-close:hover { color: #fff; background: rgba(244, 63, 94, 0.12); border-color: rgba(244, 63, 94, 0.15); transform: rotate(5deg); }

.form-group { margin-bottom: 13px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.78rem; font-weight: 600; }

.form-control { width: 100%; min-height: 42px; padding: 10px 12px; background: rgba(15, 23, 42, 0.65); border-radius: 9px; font-size: 0.85rem; }
textarea.form-control { min-height: 90px; resize: vertical; }

input[type="file"].form-control { padding: 8px; }
input[type="file"]::file-selector-button {
  margin-right: 8px; padding: 7px 10px; color: #a5b4fc; background: rgba(99, 102, 241, 0.14);
  border: none; border-radius: 7px; cursor: pointer; transition: background var(--transition);
}
input[type="file"]::file-selector-button:hover { background: rgba(99, 102, 241, 0.22); }

/* QR, SCREENSHOTS, EMPTY STATE, TOAST, FOOTER */
#qrcodeContainer {
  display: flex; align-items: center; justify-content: center; width: fit-content; margin: 0 auto;
  padding: 10px; background: #fff; border-radius: 10px; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.screenshots-slider { display: flex; gap: 8px; overflow-x: auto; margin: 10px 0; padding-bottom: 6px; }
.screenshot-thumb {
  width: 100px; height: 160px; flex-shrink: 0; object-fit: cover; background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color); border-radius: 99px; transition: var(--transition);
}
.screenshot-thumb:hover { transform: translateY(-2px); border-color: var(--border-hover); }

.empty-state { padding: 35px 15px; text-align: center; animation: viewFade 0.25s ease; }
.empty-state i { color: var(--primary-light); }

.toast {
  position: fixed; left: 20px; right: 20px; bottom: 20px; z-index: 2000;
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px;
  color: #fff; background: linear-gradient(135deg, #10b981, #059669); border-radius: 12px;
  font-size: 0.82rem; font-weight: 700; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  transform: translateY(100px); opacity: 0; pointer-events: none; transition: 0.3s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }

footer {
  padding: 22px 20px; color: var(--text-muted); background: rgba(9, 13, 22, 0.95);
  border-top: 1px solid var(--border-color); text-align: center; font-size: 0.78rem;
}
footer strong { color: var(--primary-light); }

/* ACCESSIBILITY & RESPONSIVE */
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary-light); outline-offset: 2px;
}

@media (max-width: 850px) {
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 639px) {
  .app-grid { grid-template-columns: 1fr; }
  .search-sort-row { flex-direction: column; }
  .sort-select { width: 100%; }
}

@media (min-width: 640px) {
  nav { padding: 15px 5%; }
  header { padding-top: 40px; }
  .toast { left: auto; right: 20px; width: max-content; }
}


/* =========================================================
   MOBILE FIX — BRAND SAYUTIHUB TETAP TERLIHAT
   ========================================================= */
@media (max-width: 639px) {
  nav {
    padding: 10px 12px;
    gap: 8px;
    align-items: center;
  }

  .brand {
    flex: 0 0 auto;
    min-width: 0;
    gap: 7px;
  }

  .brand > i {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  /* Jangan sembunyikan nama SayutiHub di HP. */
  .brand-text {
    display: flex !important;
    min-width: 0;
  }

  .brand-name {
    font-size: .86rem;
    white-space: nowrap;
  }

  .brand-sub {
    display: none;
  }

  .nav-actions {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    gap: 5px;
  }

  .nav-btn {
    min-width: 34px;
    padding: 7px 9px;
  }

  .nav-btn span {
    display: none;
  }

  .hero {
    padding-left: 0;
    padding-right: 0;
  }

  .container {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-width: 380px) {
  .brand > i {
    width: 32px;
    height: 32px;
  }

  .brand-name {
    font-size: .8rem;
  }

  .nav-actions {
    gap: 3px;
  }

  .nav-btn {
    padding: 7px;
  }
}
