/* ============================================================
   ZonaKumpul — Stylesheet
   ============================================================ */
:root {
  --ink:        #1B1830;
  --ink-soft:   #3B3556;
  --muted:      #6D6A85;
  --line:       #E9E6F2;
  --bg:         #FBFAFF;
  --surface:    #FFFFFF;
  --primary:    #6D28D9;
  --primary-2:  #A855F7;
  --accent:     #F59E0B;
  --violet:     #A855F7;
  --pink:       #EC4899;
  --ok:         #12A150;
  --danger:     #E5484D;
  --radius:     14px;
  --radius-sm:  10px;
  --shadow:     0 1px 2px rgba(27,24,48,.04), 0 8px 24px rgba(27,24,48,.06);
  --shadow-lg:  0 14px 44px rgba(124,60,237,.16);
  --grad:       linear-gradient(115deg, #6366F1 0%, #A855F7 55%, #EC4899 100%);
  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

img, svg { display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  padding: 11px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; transition: .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-lg); }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: #cfd2e6; }
.btn-danger { background: #fff; color: var(--danger); border-color: #f3c9ca; }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ============================================================
   FRONTEND — Home
   ============================================================ */
.home {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px 110px;
  text-align: center;
  overflow: hidden;
}
/* Ambient gradient blobs background */
.home::before, .home::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: .5; z-index: 0; pointer-events: none;
}
.home::before {
  width: 460px; height: 460px; top: -140px; left: -120px;
  background: radial-gradient(circle at 30% 30%, #A5B4FC, #818CF8 60%, transparent 72%);
  animation: float1 18s ease-in-out infinite;
}
.home::after {
  width: 520px; height: 520px; bottom: -180px; right: -140px;
  background: radial-gradient(circle at 60% 40%, #F0ABFC, #EC4899 55%, transparent 70%);
  opacity: .38;
  animation: float2 22s ease-in-out infinite;
}
@keyframes float1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(30px,40px)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-40px,-30px)} }

.home > * { position: relative; z-index: 1; }

.home-logo { margin-bottom: 20px; }
.home-logo svg { height: 66px; width: auto; }
.home-tagline {
  color: var(--ink-soft); margin: 0 0 38px; font-size: 18px; font-weight: 500;
  letter-spacing: -.2px;
}

.searchbar {
  width: 100%; max-width: 640px;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 9px 9px 9px 22px;
  box-shadow: var(--shadow-lg);
  transition: .18s ease;
}
.searchbar:focus-within {
  border-color: transparent;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(168,85,247,.35), var(--shadow-lg);
}
.searchbar .lens { color: var(--primary-2); flex: none; }
.searchbar input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 17px; font-family: var(--font-body); color: var(--ink);
  padding: 11px 0;
}
.searchbar input::placeholder { color: #a7a3bf; }

/* Popular chips */
.chips {
  display: flex; flex-wrap: wrap; gap: 9px; justify-content: center;
  margin: 26px auto 0; max-width: 640px;
}
.chips .chip-label { width: 100%; color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: 999px;
  background: rgba(255,255,255,.7); backdrop-filter: blur(6px);
  border: 1px solid var(--line); color: var(--ink-soft);
  font-size: 14px; font-weight: 500; text-decoration: none; transition: .15s;
}
.chip:hover { border-color: #d6c6f7; color: var(--primary); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.chip svg { color: var(--pink); }

.home-foot {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1;
  padding: 18px; text-align: center; color: var(--muted); font-size: 13px;
}
.home-foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .home::before, .home::after { animation: none; }
}

/* ============================================================
   FRONTEND — Results
   ============================================================ */
.results-head {
  position: sticky; top: 0; z-index: 10;
  background: rgba(251,251,254,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.results-head .inner {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 20px; max-width: 1080px; margin: 0 auto;
}
.results-head .brand svg { height: 34px; }
.results-head .searchbar { max-width: 560px; margin: 0; box-shadow: none; }

.results-wrap { max-width: 680px; margin: 0; padding: 22px 20px 60px; }
.results-meta { color: var(--muted); font-size: 13px; margin: 6px 2px 20px; }

.result {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.result:last-child { border-bottom: 0; }
.result .rk {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px; margin-right: 8px;
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: #eef0ff; border-radius: 6px; vertical-align: middle;
}
.result .url { color: #158a4a; font-size: 13px; margin-bottom: 3px; word-break: break-all; }
.result .title {
  font-size: 20px; font-weight: 600; color: #6d28d9; margin: 2px 0 4px;
  line-height: 1.3; letter-spacing: -.2px;
}
.result .title:hover { text-decoration: underline; }
.result .desc { color: var(--ink-soft); font-size: 14.5px; margin: 0; }

.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty strong { color: var(--ink); display: block; font-size: 18px; margin-bottom: 6px; }

.pagination { display: flex; gap: 8px; justify-content: center; margin: 34px 0 0; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 9px; color: var(--ink); font-size: 14px; font-weight: 600;
}
.pagination a:hover { border-color: #c3caff; text-decoration: none; }
.pagination .current { background: var(--grad); color: #fff; border-color: transparent; }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-body { background: #F4F5FB; }

.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex: none; background: var(--ink); color: #cfd3e6;
  padding: 22px 16px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.sidebar .brand .mk { width: 30px; height: 30px; border-radius: 8px; background: var(--grad); }
.sidebar .brand b { color: #fff; font-family: var(--font-display); font-size: 19px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 9px; color: #b8bcd6; font-weight: 500; font-size: 14.5px;
  margin-bottom: 2px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: var(--grad); color: #fff; }
.sidebar .foot { position: absolute; bottom: 18px; left: 16px; right: 16px; }
.sidebar .foot a { color: #8b90b0; font-size: 13px; }

.admin-main { flex: 1; padding: 26px 30px 60px; min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px;
}
.admin-topbar h1 { font-family: var(--font-display); font-size: 25px; margin: 0; letter-spacing: -.4px; }
.admin-topbar .who { color: var(--muted); font-size: 14px; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { font-family: var(--font-display); font-size: 30px; font-weight: 700; margin-top: 4px; letter-spacing: -.5px; }
.stat .value.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* Cards / panels */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 16px; margin: 0; font-weight: 600; }
.panel-body { padding: 4px 0; }

/* Tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; padding: 12px 20px; border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 13px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: #fafaff; }
.pos-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 7px;
  background: #eef0ff; color: var(--primary); font-weight: 700; font-size: 13px;
}
.kw-chip {
  display: inline-block; background: #f3f0ff; color: #6d3ff0;
  padding: 3px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
}
/* Kelola per keyword — tombol pill */
.kw-manage {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 13.5px; font-weight: 600; text-decoration: none;
  transition: .14s;
}
.kw-manage:hover { border-color: #d6c6f7; color: var(--primary); text-decoration: none; }
.kw-manage.kw-active { background: var(--grad); color: #fff; border-color: transparent; }
.kw-manage .kw-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: #eef0ff; color: var(--primary); font-size: 11.5px; font-weight: 700;
}
.kw-manage.kw-active .kw-count { background: rgba(255,255,255,.25); color: #fff; }
.muted { color: var(--muted); }
.dim { color: var(--muted); font-size: 12.5px; }
.badge-off { background: #f1f2f7; color: var(--muted); padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge-on  { background: #e6f7ee; color: var(--ok); padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 18px; padding: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: 12px; color: var(--muted); }
.field input, .field textarea, .field select {
  font-family: var(--font-body); font-size: 14.5px; color: var(--ink);
  padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; outline: 0; transition: .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: #b9c0ff; box-shadow: 0 0 0 3px rgba(91,107,255,.12);
}
.field textarea { resize: vertical; min-height: 70px; }
.form-actions { display: flex; gap: 10px; padding: 0 20px 20px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 20px; }
.alert-ok { background: #e6f7ee; color: #0a7a3b; border: 1px solid #b7e6ca; }
.alert-err { background: #fdecec; color: #b42318; border: 1px solid #f5c6c3; }

/* Login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 34px 30px;
}
.login-card .lg { display: flex; justify-content: center; margin-bottom: 8px; }
.login-card .lg svg { height: 44px; }
.login-card h1 { text-align: center; font-family: var(--font-display); font-size: 21px; margin: 6px 0 24px; }
.login-card .field { margin-bottom: 15px; }
.login-card .btn { width: 100%; }

/* Bars for analytics */
.bar-row { display: flex; align-items: center; gap: 12px; padding: 9px 20px; border-bottom: 1px solid var(--line); }
.bar-row:last-child { border-bottom: 0; }
.bar-row .bl { flex: none; width: 200px; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bt { flex: 1; height: 10px; background: #eef0f6; border-radius: 999px; overflow: hidden; }
.bar-row .bt span { display: block; height: 100%; background: var(--grad); border-radius: 999px; }
.bar-row .bv { flex: none; width: 60px; text-align: right; font-weight: 700; font-size: 14px; }

/* Responsive */
@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .admin-main { padding: 20px 16px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex !important; }
  .results-head .brand span { display: none; }
}
.menu-toggle { display: none; }
