/* Channel — Ide Konten Game & Teknologi
   Dark, simple, mobile-first, compact. Aksen hijau/ungu gaming.
   PENTING: aturan [hidden] di bawah ini wajib ada — tanpa itu, display
   dari class (.login, .row, dsb.) akan mengalahkan atribut hidden dan
   konten bisa terlihat sebelum login (bug yang pernah terjadi). */

:root {
  --bg: #0e1116;
  --surface: #171b22;
  --surface-2: #1f242e;
  --border: #2a303c;
  --text: #e8eaed;
  --muted: #9aa3af;
  --accent: #22c55e;
  --accent-2: #a855f7;
  --danger: #ef4444;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

a { color: #7dd3fc; }
button { font-family: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Login (halaman penuh) ---------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(600px 400px at 50% 0%, rgba(168, 85, 247, .18), transparent),
              radial-gradient(500px 350px at 50% 100%, rgba(34, 197, 94, .12), transparent),
              var(--bg);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
}
.login-logo {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .28em;
  color: var(--accent);
}
.login-card h1 { margin: 8px 0 2px; font-size: 28px; }
.login-sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.login input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.login input:focus { border-color: var(--accent); }
.login-error { color: var(--danger); font-size: 14px; margin: 12px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04140a;
}
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.back-btn { margin-bottom: 14px; }

/* ---------- Header & tabs ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(14, 17, 22, .95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px 0;
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.brand { margin: 0; font-size: 24px; }
.brand-sub { margin: 0; color: var(--muted); font-size: 13px; }
.updated {
  max-width: 1080px;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 13px;
}
.tabs {
  max-width: 1080px;
  margin: 12px auto 0;
  display: flex;
  gap: 8px;
}
.tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
#app-view.detail-open .tabs { display: none; }
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 16px; }
.tab-desc { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* ---------- Section + divider ---------- */
.row-section { margin-bottom: 8px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 12px;
}
.section-head h2 { margin: 0; font-size: 19px; }
.section-sub { font-size: 14px; font-weight: 400; color: var(--muted); }
.section-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ---------- Horizontal row (1 baris, scroll-snap) ---------- */
.row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.row .card {
  flex: 0 0 78%;
  max-width: 300px;
  scroll-snap-align: start;
}
@media (min-width: 640px) { .row .card { flex-basis: 280px; } }

/* ---------- Saved grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Compact card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover, .card:focus-visible { border-color: var(--accent); transform: translateY(-2px); outline: none; }
.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #1e293b, #4c1d95 55%, #14532d);
  overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb .thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .28em;
  color: rgba(255, 255, 255, .45);
}
.card-save {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 17px;
  line-height: 1;
}
.card-save.saved { background: var(--accent); border-color: var(--accent); color: #04140a; }
.card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-cat {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent);
}
.type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.saved-note { color: var(--muted); font-size: 12px; margin: 0; }

.platform-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.platform-badge:hover { border-color: var(--accent); color: var(--accent); }
.platform-badge.reddit { border-color: #ff4500; color: #ff8a5c; }
.platform-badge.x { border-color: #666; }
.platform-badge.steam { border-color: #1b2838; background: #1b2838; color: #c7d5e0; }
.platform-badge.youtube { border-color: #c00; color: #ff6b6b; }
.platform-badge.threads { border-color: #888; }
.platform-badge.instagram { border-color: #e1306c; color: #f78fb3; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty p { margin: 0; }

/* ---------- Detail / full view (halaman penuh, bukan modal) ---------- */
.detail {
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.detail-cover {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #1e293b, #4c1d95 55%, #14532d);
  position: relative;
  overflow: hidden;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-cover .thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .28em;
  color: rgba(255, 255, 255, .45);
}
.detail-body { padding: 20px; }
.detail-meta { margin: 0 0 6px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.detail-body h2 { margin: 0 0 10px; font-size: 24px; line-height: 1.3; }
.detail-summary { margin: 0 0 20px; font-size: 16px; }
.detail-section { margin-bottom: 20px; }
.detail-section h3, .idea-section h3 { margin: 0 0 10px; font-size: 16px; }
.idea-section { margin-bottom: 20px; }
.detail-heat { margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.sources { margin: 0; padding-left: 22px; }
.sources li { margin-bottom: 10px; }
.sources a { word-break: break-word; }
.source-platform { font-weight: 700; color: var(--accent); }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Blok ide terstruktur ---------- */
.idea-block { margin-bottom: 14px; }
.idea-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}
.idea-text {
  margin: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  white-space: pre-wrap;
}
.idea-trio {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) { .idea-trio { grid-template-columns: repeat(3, 1fr); } }
.idea-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.idea-box p { margin: 0; font-size: 14px; white-space: pre-wrap; }
.idea-headline {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.idea-subheadline {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.slide-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.slide-list li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.slide-list .slide-title { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.slide-list .slide-text { margin: 0; font-size: 14px; color: var(--muted); white-space: pre-wrap; }
.idea-caption {
  margin: 0;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 10px 10px 0;
  padding: 14px;
  font-size: 15px;
  white-space: pre-wrap;
}
.hashtag-group { display: flex; flex-wrap: wrap; gap: 8px; }
.hashtag-chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent-2);
  background: rgba(168, 85, 247, .12);
  color: #d8b4fe;
  font-size: 13px;
  font-weight: 600;
}
