/* ============================================
   VIZORA - Master Layout & Design System
   Dark TikTok Theme (matches index.php)
   Target: 390x844 (iPhone 14 Pro)
   ============================================ */

/* === CSS Variables === */
:root {
  --bg: #08080a;
  --panel: #111115;
  --panel2: #1a1a20;
  --line: #27272e;
  --text: #f5f5f7;
  --muted: #9696a3;
  --pink: #fe2c55;
  --cyan: #25f4ee;
  --blue: #168cff;
  --purple: #a744f5;
  --orange: #ff6d00;
  --green: #2ed573;
  --yellow: #ffc800;
  --header-height: 58px;
  --nav-height: 88px;
  --status-height: 28px;
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button, input, select, textarea {
  font: inherit;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

a { text-decoration: none; color: inherit; }

img { max-width: 100%; height: auto; display: block; }

ul, ol { list-style: none; }

/* === App Container (Mobile Frame) === */
.phone-container,
.app-container {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.phone-container::-webkit-scrollbar,
.app-container::-webkit-scrollbar { display: none; }

@media (min-width: 500px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #0a0a0a;
    min-height: 100dvh;
  }
  .phone-container,
  .app-container {
    height: 844px;
    max-height: calc(100dvh - 40px);
    border-radius: 40px;
    border: 8px solid #1a1a1a;
    box-shadow: 0 0 0 2px #333, 0 20px 60px rgba(0,0,0,0.8);
  }
}

/* === Status Bar === */
.status-bar {
  flex-shrink: 0;
  height: var(--status-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  position: relative;
  z-index: 70;
}

.status-bar .time { margin-right: auto; }

.status-icons { display: flex; align-items: center; gap: 5px; }

.signal-bars { display: flex; gap: 2px; align-items: flex-end; height: 10px; }
.signal-bars span { width: 3px; background: var(--text); border-radius: 1px; }
.signal-bars span:nth-child(1) { height: 4px; }
.signal-bars span:nth-child(2) { height: 6px; }
.signal-bars span:nth-child(3) { height: 8px; }
.signal-bars span:nth-child(4) { height: 10px; }

.battery {
  width: 20px; height: 10px;
  border: 1.5px solid var(--text);
  border-radius: 3px;
  position: relative;
  display: flex;
  align-items: center;
}
.battery::after {
  content: '';
  position: absolute;
  right: 2px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text);
}
.bar { position: absolute; left: 2px; right: 2px; background: var(--text); border-radius: 2px; }
.bar-100 { height: 100%; top: 0; }
.bar-80 { height: 80%; top: 0; }
.bar-60 { height: 60%; top: 0; }
.bar-40 { height: 40%; top: 0; }
.bar-20 { height: 20%; top: 0; }

/* === Header / Topbar === */
.app-header,
.topbar {
  flex-shrink: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 60;
}

/* Header used on index/dashboard (title + actions) */
.header-title,
.topbar .center {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions { display: flex; align-items: center; gap: 6px; }

.header-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  background: transparent;
  transition: background 0.2s;
}
.header-btn:hover { background: var(--panel2); }

/* Icon button used on discover/inbox/profile topbar */
.topicon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}
.topicon:hover { background: var(--panel2); }
.topicon svg { width: 24px; height: 24px; }

.topbar .center { flex: 1; text-align: center; }

.online {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  margin-left: 4px;
  vertical-align: middle;
}

/* Discover topbar search */
.search-container { flex: 1; min-width: 0; display: flex; justify-content: center; }
.search {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 220px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 6px 12px;
  gap: 6px;
}
.search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
}
.search input::placeholder { color: var(--muted); }
.search button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.header-right { display: flex; align-items: center; gap: 8px; }
.avatar-small {
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-weight: 700;
}
.avatar-small img { width: 100%; height: 100%; object-fit: cover; }

/* === Main Content Areas === */
/* Feed pages: overflow hidden, nav overlays video */
.app-main {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Scrollable pages: clears the fixed bottom nav */
.app-scroll,
.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + 16px);
  scrollbar-width: none;
}
.app-scroll::-webkit-scrollbar,
.content::-webkit-scrollbar { display: none; }

.section-padding { padding: 16px; }

/* === Video Feed === */
.video-feed {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #000;
}
.video-feed::-webkit-scrollbar { display: none; }

.video-slide {
  height: 100%;
  position: relative;
  scroll-snap-align: start;
  /* Never skip a slide in one scroll gesture — always stop at each video */
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.video-wrap { width: 100%; height: 100%; position: relative; overflow: hidden; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; }

.video-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

/* Video Overlay */
.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px);
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
}

/* Right Actions */
.right-actions {
  position: absolute;
  right: 12px;
  bottom: calc(var(--nav-height) + 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 10;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
}
.action-btn:active { transform: scale(0.9); }
.action-btn svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
.action-btn span { font-size: 11px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.action-btn.liked svg { fill: var(--pink); color: var(--pink); }

.avatar-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid #fff;
  overflow: hidden;
  position: relative;
  background: #333;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.follow-badge {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--pink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

/* Video Info (over video) */
.video-info {
  position: absolute;
  left: 16px;
  right: 70px;
  bottom: calc(var(--nav-height) + 12px);
  max-width: 78%;
  z-index: 10;
  color: #fff;
  pointer-events: none;
}
.video-user { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.video-user strong { font-size: 15px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.video-caption { font-size: 13px; line-height: 1.4; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.video-caption .hashtag { color: var(--cyan); font-weight: 600; }

.music-info { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: #fff; }
.music-info svg { width: 14px; height: 14px; }

/* Top Bar on feed (For You / Following) */
.top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  pointer-events: none;
}
.top-tabs { display: flex; gap: 16px; font-size: 15px; font-weight: 600; pointer-events: auto; }
.top-tabs span { opacity: 0.6; cursor: pointer; }
.top-tabs span.active { opacity: 1; font-weight: 700; }
.top-right { display: flex; gap: 12px; font-size: 20px; pointer-events: auto; }

/* === Header Stats (dashboard) === */
.header-stats {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  pointer-events: none;
}
.logo { font-size: 20px; font-weight: 900; letter-spacing: -0.5px; }
.logo span { color: var(--pink); }
.balance {
  background: rgba(255,255,255,0.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: auto;
}

/* === Bottom Navigation (TikTok style) === */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--nav-height);
  background: #000;
  color: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 7px;
  gap: 2px;
  z-index: 50;
  border-top: 1px solid #161616;
}

.nav-item {
  flex: 1 1 0;
  min-width: 0;
  min-height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: inherit;
  text-decoration: none;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.nav-item.active { color: var(--pink); }
.nav-icon { width: 27px; height: 27px; display: block; overflow: visible; }
.nav-label { font-size: 11px; line-height: 1.1; font-weight: 400; white-space: nowrap; }

.create-button {
  width: 43px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  box-shadow: -4px 0 0 #25d5e5, 4px 0 0 #fe2c55;
  cursor: pointer;
}
.create-button svg { width: 48%; height: 48%; }

.nav-item:focus-visible,
.create-button:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
.nav-item:active,
.create-button:active { transform: scale(0.97); }

/* Bigger nav on wide screens */
@media (min-width: 500px) {
  .bottom-nav { height: 96px; padding: 14px 10px; }
  .nav-item { min-height: 74px; gap: 9px; }
  .nav-icon { width: 30px; height: 30px; }
  .nav-label { font-size: 12px; }
  .create-button { width: 50px; height: 36px; border-radius: 10px; box-shadow: -5px 0 0 #25d5e5, 5px 0 0 #fe2c55; }
}

.navbadge {
  position: absolute;
  top: 8px;
  right: 50%;
  transform: translateX(20px);
  background: var(--pink);
  color: #fff;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* === Toast === */
.toast {
  position: absolute;
  bottom: calc(var(--nav-height) + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: #f5f5f5;
  color: #151515;
  border-radius: 8px;
  padding: 10px 16px;
  display: none;
  max-width: 88%;
  text-align: center;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 200;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { display: block; }

/* === Empty State === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
  gap: 6px;
}
.empty-state svg { width: 60px; height: 60px; opacity: 0.5; margin-bottom: 8px; }
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--text); }
.empty-state p { font-size: 14px; color: var(--muted); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* === Stories === */
.stories {
  display: flex;
  gap: 16px;
  padding: 14px 14px 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.stories::-webkit-scrollbar { display: none; }

.story { flex: 0 0 76px; text-align: center; min-width: 0; cursor: pointer; }
.story-photo-wrap {
  width: 76px; height: 76px;
  border-radius: 50%;
  padding: 3px;
  margin: 0 auto 6px;
  position: relative;
  border: 3px solid var(--panel);
  background: linear-gradient(135deg, var(--pink), var(--purple));
}
.story-photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; border: 2px solid var(--bg); }

.story.create .story-photo-wrap { border: 3px solid #22c5e8; padding: 2px; }
.story.create .story-photo { border: 2px solid var(--orange); }

.add-story {
  position: absolute;
  right: -2px;
  bottom: -2px;
  background: #08b8df;
  border: 3px solid var(--bg);
  border-radius: 50%;
  width: 24px; height: 24px;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.story-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}

/* === Category Filters (discover) === */
.category-filters {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.category-filters::-webkit-scrollbar { display: none; }

.category {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--line);
  transition: all 0.2s;
}
.category.active { background: var(--pink); color: #fff; border-color: var(--pink); }

/* === Grid Video Cards === */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 12px 14px;
}

.video-card {
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.video-card:hover { transform: translateY(-2px); border-color: var(--pink); }

.video-cover { position: relative; height: 190px; background: #000; overflow: hidden; }
.video-cover video,
.video-cover img { width: 100%; height: 100%; object-fit: cover; }

.video-tag {
  position: absolute;
  z-index: 2;
  top: 6px; left: 6px;
  background: rgba(0,0,0,0.7);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: bold;
  color: #fff;
}

.video-like-grid {
  position: absolute;
  z-index: 2;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.video-like-grid:hover { background: var(--pink); }
.video-like-grid svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; }

.video-card .video-info { padding: 8px 10px; flex: 1; }
.video-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-stats { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.video-author { font-weight: 600; color: var(--text); }

/* When used as a grid card body (not feed overlay), reset positioning */
.video-card .video-info,
.video-card-body {
  position: static;
  inset: auto;
  max-width: none;
  right: auto;
  bottom: auto;
  left: auto;
  padding: 8px 10px;
  color: var(--text);
  pointer-events: auto;
}
.video-card .video-user { margin-bottom: 2px; }
.video-card .video-caption { color: var(--muted); text-shadow: none; font-size: 12px; }
.video-card-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-card-meta { font-size: 11px; color: var(--muted); }

/* === Suggested Creators === */
.creators-section { margin-top: 20px; padding: 0 14px 8px; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-title { font-size: 16px; font-weight: 700; }
.explore-link { font-size: 12px; color: var(--pink); font-weight: 600; cursor: pointer; }
.explore-link:hover { text-decoration: underline; }

.creators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}
.user-card {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 10px;
}
.user-avatar-wrap {
  width: 56px; height: 56px;
  border-radius: 50%;
  margin: 0 auto 8px;
  overflow: hidden;
  background: var(--panel2);
}
.user-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-followers { font-size: 11px; color: var(--muted); margin-bottom: 8px; }

.follow-btn {
  width: 100%;
  padding: 6px 12px;
  background: var(--pink);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.follow-btn.following { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.follow-btn:hover { opacity: 0.9; }

/* === Inbox / Messages === */
.messages-list { display: flex; flex-direction: column; }

.message {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
  text-decoration: none;
  color: inherit;
}
.message:active,
.message:hover { background: var(--panel); }

.message .avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--panel2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
}
.message .avatar img { width: 100%; height: 100%; object-fit: cover; }

.message-copy { flex: 1; min-width: 0; }
.message-copy .mainline { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.message-copy .preview {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.message-copy .time { font-size: 11px; color: var(--muted); }

.message .badge {
  background: var(--pink);
  color: #fff;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* alternate naming used by layout.css consumers */
.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s;
}
.conversation-item:active { background: var(--panel); }
.conversation-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--panel2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
}
.conversation-avatar img { width: 100%; height: 100%; object-fit: cover; }
.conversation-content { flex: 1; min-width: 0; }
.conversation-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.conversation-preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.unread-badge {
  background: var(--pink);
  color: #fff;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* === Chat === */
.chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.chat-header img {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel2);
}
.chat-header h3 { font-size: 16px; font-weight: 700; margin: 0; }
.chat-back { color: var(--text); font-size: 22px; line-height: 1; text-decoration: none; padding: 4px; }

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: none;
}
.chat-messages::-webkit-scrollbar { display: none; }

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
}
.msg.sent { align-self: flex-end; background: var(--pink); color: #fff; border-bottom-right-radius: 4px; }
.msg.received { align-self: flex-start; background: var(--panel2); color: var(--text); border-bottom-left-radius: 4px; }
.msg .time { font-size: 11px; opacity: 0.7; margin-top: 4px; display: block; }

.input-bar {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
  align-items: center;
}
.input-bar input {
  flex: 1;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 11px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.input-bar input::placeholder { color: var(--muted); }
.input-bar button {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--pink);
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}

/* === Tabs === */
.tab {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 20px;
  margin: 4px;
  font-size: 13px;
  font-weight: 600;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.tab.active { background: var(--pink); color: #fff; border-color: var(--pink); }
.tab:hover { background: var(--panel); }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 13px 16px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--muted); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--pink); }
.form-group select option { background: var(--panel2); color: var(--text); }

/* === Buttons === */
.btn,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px;
  background: var(--pink);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn:hover, .btn-primary:hover { opacity: 0.92; }
.btn:active, .btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  width: 100%;
  padding: 13px;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--panel); }

/* === Cards (money / info pages) === */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
}
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 14px; }

.page { padding: 16px; }
.page h2 { margin-bottom: 18px; font-size: 20px; }

/* balance / hero */
.balance-card,
.balance-row,
.hero-card {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-bottom: 18px;
}
.balance-row { display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 16px; }
.balance-card .amount,
.balance-row .amount { font-size: 30px; font-weight: 800; }
.balance-card .label,
.balance-row .label { opacity: 0.85; font-size: 14px; }

.hero-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.hero-card p { font-size: 14px; opacity: 0.9; }
.hero-card .bonus { font-size: 32px; font-weight: 800; margin: 8px 0; }
.hero-card .code-box {
  background: rgba(0,0,0,0.25);
  border: 1px dashed rgba(255,255,255,0.5);
  border-radius: 10px;
  padding: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 12px 0 6px;
  cursor: pointer;
}

/* method grid */
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.method-btn {
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  background: var(--panel2);
  color: var(--text);
  transition: all 0.2s;
}
.method-btn.active { border-color: var(--pink); background: rgba(254,44,85,0.12); color: var(--pink); }

/* stat boxes */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.stat-box {
  text-align: center;
  padding: 15px;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
}
.stat-box .num { font-size: 22px; font-weight: 800; }
.stat-box .label { font-size: 12px; color: var(--muted); }
.stat-box .req { font-size: 11px; margin-top: 5px; }
.stat-box .req.met { color: var(--green); }
.stat-box .req.not-met { color: var(--pink); }

/* badges */
.badge-status { display: inline-block; padding: 6px 16px; border-radius: 20px; font-size: 14px; font-weight: 600; }
.badge-approved { background: rgba(46,213,115,0.15); color: var(--green); }
.badge-pending { background: rgba(255,109,0,0.15); color: var(--orange); }
.badge-rejected { background: rgba(254,44,85,0.15); color: var(--pink); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-primary { background: rgba(254,44,85,0.15); color: var(--pink); }
.badge-secondary { background: var(--panel2); color: var(--muted); }
.badge-success { background: rgba(46,213,115,0.15); color: var(--green); }
.badge-warning { background: rgba(255,200,0,0.15); color: var(--yellow); }
.badge-danger { background: rgba(254,44,85,0.15); color: var(--pink); }
.badge-info { background: rgba(22,140,255,0.15); color: var(--blue); }

/* share buttons */
.share-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.share-btns a {
  flex: 1;
  min-width: 90px;
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn-whatsapp { background: #25D366; }
.btn-facebook { background: #1877F2; }
.btn-copy { background: var(--panel2); border: 1px solid var(--line); }

/* === Search page === */
.search-page { padding: 14px; }
.search-bar {
  display: flex;
  align-items: center;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 15px;
  margin-bottom: 15px;
}
.search-bar input { border: none; background: none; margin-left: 10px; width: 100%; outline: none; font-size: 15px; color: var(--text); }
.search-bar input::placeholder { color: var(--muted); }
.search-bar button { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--pink); font-weight: 600; }

.filter-tabs { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid var(--line);
  color: var(--muted);
  background: var(--panel2);
  text-decoration: none;
}
.filter-tab.active { background: var(--pink); color: #fff; border-color: var(--pink); }
.filter-tab:hover { border-color: var(--pink); }

.trending-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.trending-tag {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s;
  text-decoration: none;
}
.trending-tag:active { transform: scale(0.95); }

.result-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}
.result-user .avatar-wrap { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--panel2); }
.result-user .avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.result-user .user-info { flex: 1; min-width: 0; }
.result-user .user-info h4 { margin: 0; font-size: 15px; font-weight: 600; }
.result-user .user-info p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.result-user .follow-btn { width: auto; padding: 6px 16px; flex-shrink: 0; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.grid-item { aspect-ratio: 1; overflow: hidden; background: var(--panel2); position: relative; cursor: pointer; }
.grid-item video { width: 100%; height: 100%; object-fit: cover; }
.grid-item .grid-overlay {
  position: absolute;
  bottom: 6px; left: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.no-results { text-align: center; padding: 50px 20px; color: var(--muted); }
.no-results h3 { font-size: 18px; margin-bottom: 6px; color: var(--text); }

/* === Upload / Camera === */
.camera-container {
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  background: #000;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 500px) {
  .camera-container {
    height: 844px;
    max-height: calc(100dvh - 40px);
    border-radius: 40px;
    border: 8px solid #1a1a1a;
    box-shadow: 0 0 0 2px #333, 0 20px 60px rgba(0,0,0,0.8);
  }
}

/* === Watch (single video) === */
.watch-container {
  width: 100%;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: #000;
}
@media (min-width: 500px) {
  .watch-container {
    height: 844px;
    max-height: calc(100dvh - 40px);
    border-radius: 40px;
    border: 8px solid #1a1a1a;
    box-shadow: 0 0 0 2px #333, 0 20px 60px rgba(0,0,0,0.8);
  }
}

/* === Sidebar (legacy menu) === */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  max-width: 80vw;
  z-index: 100;
  background: linear-gradient(180deg, #1a0533, #0d0d0d);
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  border-right: 0.5px solid rgba(255,255,255,0.06);
}
.sidebar.open { transform: translateX(0); }
.sidebar-header { padding: 50px 22px 22px; border-bottom: 0.5px solid rgba(255,255,255,0.06); }
.sidebar-logo { font-size: 24px; font-weight: 900; color: #fff; letter-spacing: -0.5px; }
.sidebar-logo span { color: var(--pink); }
.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 18px 22px; cursor: pointer; }
.sidebar-user:active { background: rgba(255,255,255,0.05); }
.sidebar-avatar { width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.15); overflow: hidden; background: #333; }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info { flex: 1; }
.sidebar-user-name { color: #fff; font-size: 15px; font-weight: 700; }
.sidebar-user-handle { color: rgba(255,255,255,0.4); font-size: 12px; margin-top: 1px; }
.sidebar-menu { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  color: rgba(255,255,255,0.7);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}
.sidebar-menu-item:active { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar-menu-item svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.sidebar-divider { height: 0.5px; background: rgba(255,255,255,0.06); margin: 8px 22px; }
.sidebar-footer { padding: 14px 22px; border-top: 0.5px solid rgba(255,255,255,0.06); }
.sidebar-footer span { font-size: 12px; color: rgba(255,255,255,0.2); }

/* menu button (header) */
.menu-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--panel2);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
}
.menu-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes popIn { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.fade-in { animation: fadeIn 0.5s ease; }
.slide-up { animation: slideUp 0.3s ease; }

/* === Utilities === */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-pink { color: var(--pink); }
.text-green { color: var(--green); }
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* === Responsive (small phones) === */
@media (max-width: 360px) {
  .nav-label { font-size: 10px; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
