/* ═══════════════════════════════════════
   TRENDS — Design System (neurounit.io colors)
   ═══════════════════════════════════════ */
:root {
  --bg:           #0A0B0F;
  --bg-card:      #12141A;
  --accent-purple: #7B2FFF;
  --accent-blue:   #00D4FF;
  --accent-pink:   #FF2D9B;
  --text:         #FFFFFF;
  --text-muted:   #8B8FA8;
  --border:       #1E2030;
  --gradient:     linear-gradient(135deg, #7B2FFF, #00D4FF);
  --gradient-pink: linear-gradient(135deg, #FF2D9B, #7B2FFF);
  --nav-h:        64px;
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  user-select: none;
}

/* ── SPLASH ── */
#splash {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  animation: fadeOut 0.5s ease 1.5s forwards;
}
.splash-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.logo-icon { font-size: 64px; animation: pulse 1s ease infinite alternate; }
.logo-text {
  font-size: 32px; font-weight: 800; letter-spacing: 2px;
  background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.1); } }
@keyframes fadeOut { to { opacity: 0; pointer-events: none; } }

/* ── APP LAYOUT ── */
#app { width: 100%; height: 100vh; display: flex; flex-direction: column; position: relative; }

.page {
  display: none; flex: 1; overflow-y: auto; overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
  height: 100vh;
}
.page.active { display: flex; flex-direction: column; }
#page-feed.active { display: block; padding: 0; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(18, 20, 26, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: var(--text-muted);
  font-size: 10px; cursor: pointer; padding: 6px 4px; flex: 1;
  transition: color 0.2s;
  -webkit-user-select: none;
}
.nav-btn.active { color: var(--accent-blue); }
.nav-btn.active .nav-icon { filter: drop-shadow(0 0 6px var(--accent-blue)); }
.nav-icon { font-size: 22px; transition: transform 0.2s; }
.nav-btn:active .nav-icon { transform: scale(0.9); }



/* ── VIDEO FEED ── */
#feed-container {
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}
.video-slide {
  height: 100vh;
  position: relative;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #000;
  overflow: hidden;
}
.video-slide video {
  width: 100%; height: 100%;
  object-fit: cover;
  position: absolute; inset: 0;
}

/* Overlay gradient */
.video-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 50%);
  pointer-events: none;
}

/* Video info */
.video-info {
  position: absolute; bottom: calc(var(--nav-h) + 16px); left: 0;
  width: calc(100% - 72px); padding: 0 16px;
  z-index: 10;
}
.video-author {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.author-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient); border: 2px solid var(--accent-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; overflow: hidden;
}
.author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-name { font-weight: 700; font-size: 14px; }
.follow-btn-inline {
  margin-left: 8px; padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--accent-blue); color: var(--accent-blue);
  background: none; font-size: 12px; cursor: pointer;
}
.video-title { font-size: 14px; line-height: 1.4; margin-bottom: 4px; font-weight: 600; }
.video-desc { font-size: 13px; color: rgba(255,255,255,0.8); line-height: 1.4; }
.video-hashtags { font-size: 12px; color: var(--accent-blue); margin-top: 4px; }
.video-views { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Action buttons */
.video-actions {
  position: absolute; right: 12px; bottom: calc(var(--nav-h) + 16px);
  display: flex; flex-direction: column; gap: 20px; align-items: center;
  z-index: 10;
}
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; color: #fff; background: none; border: none;
}
.action-btn .icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; transition: transform 0.15s, background 0.15s;
}
.action-btn:active .icon { transform: scale(0.85); }
.action-btn.liked .icon { background: rgba(255,45,155,0.3); }
.action-btn .count { font-size: 12px; font-weight: 600; }

/* Like animation */
.heart-fly {
  position: absolute; font-size: 28px; pointer-events: none;
  animation: heartFly 0.8s ease forwards;
  z-index: 50;
}
@keyframes heartFly {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-80px) scale(1.5); opacity: 0; }
}

/* Ad badge */
.ad-badge {
  position: absolute; top: 60px; left: 12px;
  background: rgba(255,255,255,0.2); backdrop-filter: blur(8px);
  border-radius: 6px; padding: 3px 8px; font-size: 11px; color: #fff;
}

/* ── TRENDING PAGE ── */
#page-trending { padding: 16px 16px calc(var(--nav-h) + 16px); }
.page-title {
  font-size: 24px; font-weight: 800; margin-bottom: 16px;
  background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.category-pills {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px;
  scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0; padding: 6px 14px; border-radius: 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.pill.active { background: var(--accent-purple); border-color: var(--accent-purple); color: #fff; }
.trending-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px;
}
.trending-card {
  background: var(--bg-card); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); cursor: pointer;
  transition: transform 0.2s;
}
.trending-card:active { transform: scale(0.97); }
.trending-thumb {
  width: 100%; aspect-ratio: 9/16; background: var(--border);
  position: relative; overflow: hidden;
}
.trending-thumb video { width: 100%; height: 100%; object-fit: cover; }
.trending-rank {
  position: absolute; top: 8px; left: 8px;
  background: var(--gradient); border-radius: 8px;
  padding: 2px 8px; font-size: 12px; font-weight: 700;
}
.trending-fire {
  position: absolute; top: 8px; right: 8px; font-size: 16px;
}
.trending-info { padding: 8px 10px; }
.trending-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.trending-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── UPLOAD PAGE ── */
#page-upload { padding: 20px 16px calc(var(--nav-h) + 20px); }
.upload-zone {
  border: 2px dashed var(--accent-purple);
  border-radius: 16px; padding: 40px 20px;
  text-align: center; cursor: pointer; margin-bottom: 20px;
  background: rgba(123,47,255,0.05);
  transition: all 0.2s;
}
.upload-zone.drag-over { background: rgba(123,47,255,0.15); border-color: var(--accent-blue); }
.upload-zone .upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-zone p { color: var(--text-muted); font-size: 14px; }
.upload-zone strong { color: var(--accent-blue); }
.upload-preview { margin-bottom: 20px; }
.upload-preview video { width: 100%; border-radius: 12px; max-height: 240px; object-fit: cover; }
.progress-bar {
  height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 20px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0; border-radius: 2px;
  background: var(--gradient); transition: width 0.3s;
}

.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; display: block; }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color 0.2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--accent-purple); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-select option { background: var(--bg-card); }

/* ── BUTTONS ── */
.btn {
  width: 100%; padding: 14px; border-radius: 14px;
  border: none; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all 0.2s; letter-spacing: 0.3px;
}
.btn-primary {
  background: var(--gradient); color: #fff;
  box-shadow: 0 4px 24px rgba(123,47,255,0.4);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
  background: none; border: 1px solid var(--accent-purple);
  color: var(--accent-purple);
}

/* ── PROFILE PAGE ── */
#page-profile { padding: 0 0 calc(var(--nav-h) + 16px); }
.profile-header {
  padding: 20px 16px;
  background: linear-gradient(180deg, rgba(123,47,255,0.15) 0%, transparent 100%);
  display: flex; align-items: flex-start; gap: 16px;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--gradient); border: 3px solid var(--accent-purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; flex-shrink: 0; overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; }
.profile-name { font-size: 20px; font-weight: 800; }
.profile-username { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.profile-bio { font-size: 13px; margin-top: 8px; line-height: 1.4; color: rgba(255,255,255,0.85); }
.profile-stats {
  display: flex; gap: 0; padding: 16px 16px; border-bottom: 1px solid var(--border);
}
.stat-item { flex: 1; text-align: center; }
.stat-num { font-size: 20px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.profile-videos { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2px; }
.profile-video-thumb {
  aspect-ratio: 9/16; background: var(--bg-card);
  overflow: hidden; position: relative; cursor: pointer;
}
.profile-video-thumb video { width: 100%; height: 100%; object-fit: cover; }
.profile-video-views {
  position: absolute; bottom: 4px; left: 4px;
  font-size: 11px; font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* ── TRND PAGE ── */
#page-trnd { padding: 20px 16px calc(var(--nav-h) + 20px); }
.trnd-balance-card {
  background: var(--bg-card); border-radius: 20px;
  padding: 24px; margin-bottom: 20px;
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.trnd-balance-card::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(123,47,255,0.3), transparent);
}
.trnd-label { font-size: 13px; color: var(--text-muted); }
.trnd-amount {
  font-size: 48px; font-weight: 900; margin: 8px 0;
  background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.trnd-streak {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05); border-radius: 10px; padding: 10px 14px;
  margin-top: 12px;
}
.trnd-streak-icon { font-size: 20px; }
.trnd-streak-text { font-size: 13px; }
.trnd-streak-mult {
  margin-left: auto; font-weight: 700;
  color: var(--accent-blue);
}
.trnd-section-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--text-muted); }
.trnd-boost-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.boost-card {
  background: var(--bg-card); border-radius: 14px; padding: 16px;
  border: 1px solid var(--border); cursor: pointer; transition: all 0.2s;
}
.boost-card:active { transform: scale(0.97); border-color: var(--accent-purple); }
.boost-icon { font-size: 28px; margin-bottom: 8px; }
.boost-name { font-size: 13px; font-weight: 700; }
.boost-cost { font-size: 12px; color: var(--accent-purple); margin-top: 4px; }
.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx-item {
  background: var(--bg-card); border-radius: 12px; padding: 12px 14px;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.tx-desc { font-size: 13px; }
.tx-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.tx-amount { font-size: 15px; font-weight: 700; }
.tx-amount.positive { color: var(--accent-blue); }
.tx-amount.negative { color: var(--accent-pink); }

/* ── COMMENTS DRAWER ── */
.drawer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--bg-card); border-radius: 20px 20px 0 0;
  padding: 12px 16px 24px; max-height: 70vh;
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateY(0); }
.drawer-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 16px;
}
.drawer-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
#comments-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.comment-item { display: flex; gap: 10px; }
.comment-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gradient); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.comment-body { flex: 1; }
.comment-username { font-size: 12px; font-weight: 700; color: var(--accent-blue); }
.comment-text { font-size: 14px; margin-top: 2px; line-height: 1.4; }
.comment-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.comment-input-row {
  display: flex; gap: 10px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
#comment-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 10px 14px; color: var(--text);
  font-size: 14px; outline: none;
}
#comment-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient); border: none; color: #fff;
  font-size: 16px; cursor: pointer;
}
.drawer-overlay {
  display: none; position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,0.5);
}
.drawer-overlay.visible { display: block; }

/* ── LOADING ── */
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent-purple);
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; line-height: 1.5; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 20px); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); padding: 10px 20px; border-radius: 24px;
  font-size: 14px; z-index: 500; opacity: 0;
  transition: all 0.3s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── TRND Earned Notification ── */
.trnd-notify {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, rgba(123,47,255,0.95), rgba(0,212,255,0.95));
  backdrop-filter: blur(12px);
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  box-shadow: 0 4px 24px rgba(123,47,255,0.5);
  animation: trndNotifyAnim 2.5s ease forwards;
}
@keyframes trndNotifyAnim {
  0%   { opacity:0; transform:translateX(-50%) translateY(20px) scale(0.8); }
  15%  { opacity:1; transform:translateX(-50%) translateY(0px) scale(1.05); }
  25%  { transform:translateX(-50%) translateY(0px) scale(1); }
  75%  { opacity:1; }
  100% { opacity:0; transform:translateX(-50%) translateY(-16px) scale(0.9); }
}

/* ── Live Streams ── */
@keyframes reactionFloat {
  0%   { transform:translateY(0) scale(1); opacity:1; }
  100% { transform:translateY(-120px) scale(1.5); opacity:0; }
}
@keyframes donationPop {
  0%   { transform:translate(-50%,-50%) scale(0.5); opacity:0; }
  20%  { transform:translate(-50%,-50%) scale(1.2); opacity:1; }
  80%  { transform:translate(-50%,-50%) scale(1); opacity:1; }
  100% { transform:translate(-50%,-50%) scale(0.8); opacity:0; }
}

/* ── Upload button ── */
.nav-upload {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--gradient); color: #fff !important;
  box-shadow: 0 0 24px rgba(123,47,255,0.7);
  flex-direction: row; padding: 0;
  margin-top: -14px; position: relative;
  animation: uploadPulse 2.5s ease-in-out infinite;
}
.nav-upload .nav-icon { font-size: 24px; position: relative; z-index: 1; }
@keyframes uploadPulse {
  0%,100% { box-shadow: 0 0 24px rgba(123,47,255,0.7); transform: scale(1); }
  50%      { box-shadow: 0 0 36px rgba(123,47,255,0.9); transform: scale(1.07); }
}

/* ── Mute button ── */
.mute-btn {
  position: absolute;
  top: 12px; right: 12px; z-index: 20;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  border: none; border-radius: 50%;
  width: 42px; height: 42px;
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
