/* =========================================================
   QAENET — Design tokens
   Base: X-like layout, warna diganti aksen amber/emas
   (menghubungkan ke identitas token AENET & tier Gold)
   ========================================================= */
:root {
  --accent: #E8A33D;         /* amber/gold — identitas token AENET */
  --accent-dim: #E8A33D22;
  --danger: #F4526B;
  --success: #3FB97F;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --bg: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-hover: #F5F6F7;
  --border: #EFF3F4;
  --text: #0F1419;
  --text-secondary: #536471;
  --text-tertiary: #8B98A5;
}

:root[data-theme="dark"] {
  --bg: #0B0E11;
  --bg-elevated: #0F1419;
  --bg-hover: #16191C;
  --border: #1E2226;
  --text: #E7E9EA;
  --text-secondary: #8B98A5;
  --text-tertiary: #5B6771;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0E11;
    --bg-elevated: #0F1419;
    --bg-hover: #16191C;
    --border: #1E2226;
    --text: #E7E9EA;
    --text-secondary: #8B98A5;
    --text-tertiary: #5B6771;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font); cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
textarea { font-family: var(--font); }

/* ===== Layout shell ===== */
.app {
  display: grid;
  grid-template-columns: 88px minmax(0, 600px) 320px;
  justify-content: center;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ===== Left nav rail ===== */
.nav-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}
.nav-logo { color: var(--accent); padding: 10px; margin-bottom: 4px; }
.nav-list { width: 100%; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 14px; border-radius: 999px;
  color: var(--text); font-size: 15px; font-weight: 500;
  transition: background .15s ease;
}
.nav-item span { display: none; }
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { font-weight: 700; color: var(--accent); }

.btn-post {
  background: var(--accent); color: #14110A;
  border: none; border-radius: 999px;
  width: 52px; height: 52px; font-weight: 700; font-size: 0;
  margin: 10px 0;
  display: flex; align-items: center; justify-content: center;
  transition: filter .15s ease;
}
.btn-post::before { content: '+'; font-size: 26px; line-height: 1; }
.btn-post:hover { filter: brightness(1.08); }
.btn-post.small { width: auto; height: auto; padding: 8px 20px; font-size: 15px; font-weight: 700; }
.btn-post.small::before { content: none; }
.btn-post:disabled { opacity: .5; cursor: default; }

.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

/* ===== Feed ===== */
.feed { border-right: 1px solid var(--border); min-height: 100vh; }
.feed-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px); z-index: 5;
}
.feed-header h1 { font-size: 19px; font-weight: 800; margin: 0; }

.composer { display: flex; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.composer-body { flex: 1; display: flex; flex-direction: column; }
.composer textarea {
  border: none; background: none; color: var(--text); font-size: 18px;
  resize: none; outline: none; width: 100%; line-height: 1.4;
}
.composer textarea::placeholder { color: var(--text-tertiary); }
.composer-footer { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 8px; }
.char-count { font-size: 13px; color: var(--text-tertiary); }
.btn-attach { color: var(--accent); display: flex; align-items: center; cursor: pointer; margin-right: auto; }
.media-preview { margin-top: 10px; }
.media-preview .thumb { position: relative; display: inline-block; border-radius: 12px; overflow: hidden; max-width: 100%; }
.media-preview img, .media-preview video { max-width: 100%; max-height: 220px; display: block; border-radius: 12px; }
.sync-badge {
  position: absolute; bottom: 6px; right: 6px; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; color: #fff; background: rgba(0,0,0,.55);
}
.sync-badge.pending { color: #FFD37A; }
.sync-badge.synced { color: #7CE0A8; }
.post-media { margin: 4px 0 10px; border-radius: 12px; overflow: hidden; }
.post-media img, .post-media video { width: 100%; max-height: 320px; object-fit: cover; display: block; }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

.post-list { display: flex; flex-direction: column; }
.post {
  display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border);
  transition: background .15s ease;
}
.post:hover { background: var(--bg-hover); }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 6px; font-size: 15px; flex-wrap: wrap; }
.post-name { font-weight: 700; }
.post-handle, .post-time { color: var(--text-tertiary); }
.badge-check { width: 16px; height: 16px; flex-shrink: 0; }
.badge-blue path { fill: #5EA9E9; }
.badge-gold path { fill: #E8A33D; }
.post-text { margin: 2px 0 10px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; }
.post-actions { display: flex; gap: 28px; max-width: 320px; }
.post-actions button {
  background: none; border: none; color: var(--text-tertiary);
  display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px;
  border-radius: 8px; transition: color .15s ease;
}
.post-actions button:hover { color: var(--accent); }
.post-actions button.liked { color: var(--danger); }
.post-actions svg { width: 18px; height: 18px; }
.points-pill {
  font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-dim); border-radius: 999px; padding: 2px 9px;
  margin-left: auto;
}

/* ===== Sidebar ===== */
.sidebar { padding: 16px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.widget { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.widget h3 { margin: 0 0 10px; font-size: 17px; font-weight: 800; }
.points-value { font-size: 32px; font-weight: 800; color: var(--accent); line-height: 1; }
.tier-chip { display: inline-block; margin: 8px 0; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg-hover); }
.progress-bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width .3s ease; }
.hint { font-size: 13px; color: var(--text-secondary); margin: 8px 0 0; }
.muted { font-size: 13px; color: var(--text-secondary); margin: 0; }
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-list li { display: flex; justify-content: space-between; font-size: 14px; }
.task-list li.done { color: var(--text-tertiary); text-decoration: line-through; }
.task-points { color: var(--accent); font-weight: 700; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-elevated); border-radius: 16px; padding: 20px; width: 100%; max-width: 380px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-header h3 { margin: 0; font-size: 18px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text); }
.gift-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gift-option {
  background: var(--bg-hover); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; font-size: 26px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text);
}
.gift-option span { font-size: 13px; font-weight: 600; }
.gift-option:hover { border-color: var(--accent); }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; transition: all .25s ease; pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Bottom nav (mobile) ===== */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); padding: 8px 0; padding-bottom: max(8px, env(safe-area-inset-bottom));
  justify-content: space-around; z-index: 20;
}
.bottom-nav button { background: none; border: none; color: var(--text-secondary); padding: 8px 14px; border-radius: 10px; }
.bottom-nav button.active { color: var(--accent); }

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .app { grid-template-columns: 88px minmax(0, 1fr); }
  .sidebar { display: none; }
}
@media (max-width: 680px) {
  .app { grid-template-columns: 1fr; }
  .nav-rail { display: none; }
  .bottom-nav { display: flex; }
  .feed { border-right: none; padding-bottom: 64px; }
  .feed-header { padding: 12px 14px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===== Focus visibility ===== */
a:focus-visible, button:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
