/* ============================================================
   dashboard.css — Global layout, sidebar, topbar, ticker, nav
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root{
  --bg:#040404;       /* Page background (near-black) */
  --sur:#121212;      /* Card / sidebar surface */
  --sur2:#1e1e1e;     /* Deeper surface (inputs, nested cards) */
  --bdr:rgba(246,48,144,0.15); /* Border colour */

  --acc:#f63090;      /* PRIMARY accent — buttons, active states, highlights */
  --acc2:#f95faa;     /* SECONDARY accent — gradient end colour */

  --gold:#f59e0b;     /* VIP / reward gold */
  --gold2:#fcd34d;    /* VIP gold highlight */
  --grn:#10b981;      /* Win / online / earn (green) */
  --red:#ef4444;      /* Lose / error (red) */

  --txt:#f8f8f8;      /* Main text */
  --mut:#8e8e8e;      /* Muted / secondary text */
  --vip:#c9940a;      /* VIP label colour */
}



html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--txt);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.ai-badge {
    display: none !important;
}
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
#sidebar {
  width: 250px;
  min-width: 250px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--sur);
  border-right: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  transition: transform .3s ease;
}

.logo {
  padding: 20px 48px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--bdr);
}
.logo-icon { font-size: 24px; }
.logo-text  { font-size: 21px; font-weight: 900; letter-spacing: -1px; }
.logo-text span {
  background: linear-gradient(135deg, #e01979, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nb-discover-row{ display: flex; align-items: center; gap: 2px; }
.nb-discover-row .nb{ flex: 1; }
.nb-locked-group{ display: flex; flex-direction: column; gap: 2px; }

.nb-locked-toggle{
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  flex-shrink: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--mut);
  cursor: pointer;
}
.nb-locked-toggle:hover{ background: rgba(255,255,255,0.06); color: var(--txt); }
.nb-chevron{ transition: transform .2s ease; }
.nb-locked-toggle.open .nb-chevron{ transform: rotate(180deg); }

/* Mobile: nest the locked categories under Discover, revealed by the
   chevron, instead of always taking up vertical space in the sidebar. */
@media (max-width: 768px) {
  .nb-locked-toggle{ display: flex; }
  .nb-locked-group{
    display: none;
    margin-left: 12px;
    padding-left: 10px;
    border-left: 2px solid rgba(246,48,144,0.25);
  }
  .nb-locked-group.open{ display: flex; }
}

.nb {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--mut);
  transition: all .15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nb:hover  { background: rgba(255,255,255,0.05); color: var(--txt); }
.nb.active { background: rgba(224,25,121,0.18); color: #f979b7; }
.nb .ni    { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }

/* Live Cams nav icon — pulsing red "recording" dot instead of an emoji */
.nb .ni.sc-live-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 17px;
  flex-shrink: 0;
}
.sc-live-dot::before {
  content: '';
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239,68,68,0.8);
  flex-shrink: 0;
}
.sc-live-dot::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(239,68,68,0.6);
  transform: translate(-50%, -50%);
  animation: scLivePulse 1.6s ease-out infinite;
}
@keyframes scLivePulse {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
}

.nbadge {
  margin-left: auto;
  background: linear-gradient(135deg,#f63090,#f862aa);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sparks-w {
  margin: 8px;
  padding: 13px 25px;
  border-radius: 13px;
 /* background: linear-gradient(135deg, rgba(224,25,121,.22), rgba(244,114,182,.12));*/
  border: 1px solid rgba(224,25,121,.28);
  cursor: pointer;
  transition: all .2s;
}
.sparks-w:hover { border-color: var(--acc2); }
.sw-row   { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.sw-num   { font-size: 26px; font-weight: 900; color: #f979b7; }
.sw-lbl   { font-size: 10px; color: var(--mut); letter-spacing: 1px; text-transform: uppercase; }
.sw-buy   { font-size: 11px; color: #f979b7; margin-top: 4px; }

/* ── SIDEBAR PROFILE ROW (bottom) ─────────────────────────── */
.sb-profile-row { margin-top: auto; display:flex; align-items:center; gap:10px; padding:11px 13px 13px; border-top:1px solid var(--bdr); text-decoration:none; transition:background .15s; }
.sb-profile-row:hover { background: rgba(255,255,255,0.04); }
.sb-profile-av { width:32px; height:32px; border-radius:8px; background:linear-gradient(135deg,#f63090,#f771b2); display:flex; align-items:center; justify-content:center; font-size:17px; flex-shrink:0; }
.sb-profile-name { font-size:13px; font-weight:700; color:#fa8bc1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.3; }
.sb-profile-tag { font-size:11px; color:var(--mut); margin-top:1px; }
.user-row { padding:11px 13px; border-top:1px solid var(--bdr); display:flex; align-items:center; gap:10px; }
.u-av { width:34px; height:34px; border-radius:9px; background:linear-gradient(135deg,#f63090,#f862aa); display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.u-name { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.u-tag  { font-size:11px; color:var(--mut); }
/* ── CORNER CLOSE BUTTON (attached to box top-right corner) ── */
.modal-corner-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: var(--sur);
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  z-index: 10;
  line-height: 1;
}
.modal-corner-close:hover { border-color: #fff; color: #fff; }
.mbox { position: relative; overflow: visible; }

/* keep old classes */
.modal-outer-wrap { position: relative; display: flex; flex-direction: column; align-items: flex-end; }
.modal-outer-close { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); background: transparent; color: rgba(255,255,255,0.6); font-size: 15px; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-bottom: 8px; transition: border-color .15s, color .15s; line-height: 1; flex-shrink: 0; }
.modal-outer-close:hover { border-color: #fff; color: #fff; }
.modal-circle-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); background: transparent; color: var(--mut); font-size: 15px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: border-color .15s, color .15s; z-index: 10; line-height: 1; }
.modal-circle-close:hover { border-color: rgba(255,255,255,0.6); color: var(--txt); }

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  margin-top: var(--banner-h, 0px);
  height: calc(100vh - var(--banner-h, 0px));
}

#topbar {
  height: 58px; min-height: 58px;
  background: var(--sur);
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  z-index: 40;
}
#topbar .tb-menu {
  display: none;
  background: transparent; border: none;
  color: var(--txt); font-size: 22px;
  cursor: pointer; padding: 4px; line-height: 1;
}
.tb-title  { font-size: 17px; font-weight: 800; flex: 1; letter-spacing: -.3px; }
.tb-notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 300px;
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 200;
  overflow: hidden;
  animation: notifFadeIn .15s ease;
}
@keyframes notifFadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.tnp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px 10px;
  border-bottom: 1px solid var(--bdr);
}
.tnp-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--txt); }
.tnp-clear {
  font-size: 11px; color: var(--acc); background: none; border: none;
  cursor: pointer; font-weight: 600; padding: 0;
}
.tnp-clear:hover { text-decoration: underline; }
.tnp-empty { padding: 20px 16px; font-size: 13px; color: var(--mut); text-align: center; }
.tnp-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background .12s;
}
.tnp-item:last-child { border-bottom: none; }
.tnp-item:hover { background: rgba(255,255,255,0.04); }
.tnp-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--bdr);
  background: rgba(255,255,255,0.08);
}
.tnp-avatar-fallback {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(224,25,121,.2);
  border: 1px solid rgba(224,25,121,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.tnp-body { flex: 1; min-width: 0; }
.tnp-name { font-size: 12px; font-weight: 700; color: var(--txt); margin-bottom: 2px; }
.tnp-msg { font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tnp-time { font-size: 10px; color: var(--mut); margin-top: 2px; opacity: .7; }
.tnp-dot { width: 7px; height: 7px; border-radius: 50%; background: #e61b7d; flex-shrink: 0; margin-top: 5px; }


/* ── TOPBAR PILLS ──────────────────────────────────────────── */
.tb-sparks-pill {
  display: flex; align-items: center; gap: 7px;
  background: rgba(224,25,121,0.13);
  border: 1.5px solid rgba(224,25,121,0.35);
  border-radius: 22px;
  padding: 7px 15px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.tb-sparks-pill:hover { background: rgba(224,25,121,0.22); border-color: rgba(224,25,121,0.55); }
.tb-tokens-pill {
  display: flex; align-items: center; gap: 7px;
  background: rgba(245,158,11,0.12);
  border: 1.5px solid rgba(245,158,11,0.35);
  border-radius: 22px;
  padding: 7px 15px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.tb-tokens-pill:hover { background: rgba(245,158,11,0.22); border-color: rgba(245,158,11,0.55); }
.tsp-icon { font-size: 15px; line-height: 1; }
.tsp-num {
  font-size: 13px; font-weight: 800;
  letter-spacing: -0.3px;
}
.tb-sparks-pill .tsp-num { color: #f979b7; }
.tb-tokens-pill .tsp-num { color: #fbbf24; }

/* ── TICKER ───────────────────────────────────────────────── */
#ticker {
  background: rgba(0,0,0,.45);
  border-bottom: 1px solid var(--bdr);
  overflow: hidden;
  height: 34px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
#ticker-inner {
  display: flex;
  align-items: center;
  white-space: nowrap;
  animation: ticker 38s linear infinite;
  gap: 0;
}
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

.ti      { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 0 22px; color: var(--mut); }
.ti .tb  { padding: 2px 7px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.ti-w .tb { background: rgba(16,185,129,.2);   color: #10b981; }
.ti-l .tb { background: rgba(239,68,68,.15);   color: #f87171; }
.ti-v .tb { background: rgba(201,148,10,.22);  color: var(--gold2); }

/* ── CONTENT WRAPPER ──────────────────────────────────────── */
#content { flex: 1; overflow-y: auto; overflow-x: hidden; }

.section        { display: none !important; padding: 18px; overflow: hidden; }
.section.active { display: block !important; }

/* Chat section needs flex column layout to fill properly */
#section-chat.active {
  display: flex !important;
  flex-direction: column;
  padding: 0;
  height: 100%;
}

@media (max-width: 768px) {
  /* Lock the container — cannot scroll between sections */
  #content {
    overflow-y: auto !important;
    overflow-x: hidden;
    height: calc(100vh - 58px - var(--banner-h, 0px));
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  /* Topbar full width */
  #topbar {
    padding: 0 12px;
    gap: 8px;
  }

  /* Each section scrolls only within itself */
  .section.active {
    height: auto;
    min-height: 100%;
    overflow-y: visible;
    padding: 14px 12px;
    box-sizing: border-box;
    width: 100%;
  }

  /* Chat completely isolated as a fixed layer */
  #section-chat.active {
    position: fixed !important;
    inset: 0;
    top: calc(58px + var(--banner-h, 0px));
    z-index: 50;
    height: calc(100dvh - 58px - var(--banner-h, 0px));
    min-height: 0 !important; /* beat .section.active{min-height:100%} */
    background: var(--bg);
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
    padding: 0;
  }

  /* Chat layout: wrap and main fill the section */
  #section-chat.active .chat-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }
  #section-chat.active .chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  /* Messages scroll within their area */
  #section-chat.active #chat-msgs {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
  }

  /* Input bar: in-flow at the bottom of the chat column, same as desktop
     (was position:fixed — floated over messages and covered the newest one) */
  #section-chat.active .cin-bar {
    position: relative !important;
    flex-shrink: 0;
    z-index: 5;
    background: var(--sur);
    border-top: 1px solid var(--bdr);
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    display: flex;
    gap: 9px;
  }

  /* Notification dropdown — full width on mobile, positioned relative
     to the viewport itself (not the bell button) so it's always
     reliably contained regardless of topbar padding math.
     !important: an unconditional (non-media-query) .notif-dropdown
     rule loads later in index.php's inline <style> block and would
     otherwise win the cascade at every screen size. */
  .notif-dropdown {
    position: fixed !important;
    top: 62px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: none !important;
  }
}

.sh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.sh h2 { font-size: 20px; font-weight: 900; letter-spacing: -.3px; }

/* ── LIVE FEED ────────────────────────────────────────────── */
.lf  { display: flex; flex-direction: column; gap: 7px; }
.lfi { padding: 9px 11px; background: var(--sur2); border-radius: 9px; font-size: 11.5px; line-height: 1.5; }
.lfw { border-left: 3px solid var(--grn); }
.lfl { border-left: 3px solid var(--red); }
.lfv { border-left: 3px solid var(--gold); }

/* ── MODALS (shared base) ─────────────────────────────────── */
.modal-bg        { position: fixed; inset: 0; z-index: 200; display: none; background: rgba(0,0,0,.8); backdrop-filter: blur(7px); align-items: center; justify-content: center; padding: 20px; }
.modal-bg.open   { display: flex; }
.mbox { background: var(--sur); border: 1px solid var(--bdr); border-radius: 22px; max-width: 430px; width: 100%; max-height: 92vh; overflow-y: auto; padding: 26px; }
.mbox h2 { font-size: 19px; font-weight: 900; margin-bottom: 3px; letter-spacing: -.2px; }
.msub { color: var(--mut); font-size: 12.5px; margin-bottom: 18px; }

/* ── UTILITIES ────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt     { margin-top: 14px; }

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 4px; height: 4px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: rgba(246,48,144,.2); border-radius: 4px; }

/* ── RESPONSIVE ───────────────────────────────────────────── */

/* Buy SparksCoins / Card Details modals — the 3-col coin tier grid and
   fixed padding looked cramped on narrow phones. Step down to 2 columns
   and trim padding/font sizes below ~480px. */
@media (max-width: 480px) {
  .modal-bg { padding: 14px; }
  #buy-coins-tiers { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  #buy-coins-modal .mbox,
  #card-details-modal .mbox,
  #vip-manage-modal .mbox,
  #vip-upgrade-modal .mbox {
    padding: 20px 16px !important;
    max-width: 100% !important;
    border-radius: 18px !important;
  }
  #buy-coins-modal h2 { font-size: 17px !important; }
  #card-details-modal input { font-size: 16px !important; } /* prevents iOS auto-zoom on focus */
  #card-details-modal .mbox > div[style*="display:flex"][style*="gap:10px"] { gap: 8px !important; }
}
@media (max-width: 360px) {
  #buy-coins-tiers { grid-template-columns: 1fr 1fr !important; }
  #buy-coins-modal .mbox button, #card-details-modal .mbox button { font-size: 12px !important; }
}

@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    min-width: 280px;
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #e61b7d transparent;
    transform: translateX(-100%);
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }
  #sidebar::-webkit-scrollbar { width: 3px; }
  #sidebar::-webkit-scrollbar-thumb { background: #e61b7d; border-radius: 4px; }
  #sidebar.open { transform: translateX(0); }
  #topbar .tb-menu { display: block; }
  #so { display: none; position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
  #so.show { display: block; }

  /* Main takes full viewport width on mobile */
  #main {
    width: 100vw;
    min-width: 0;
    max-width: 100vw;
  }

  /* App wrapper — no flex gap from sidebar on mobile */
  #app {
    display: block;
    height: 100vh;
  }

  /* Topbar stays below banner */
  #topbar {
    position: sticky;
    top: 0;
    z-index: 60;
  }
}
@media (max-width: 380px) {
  .mbox { padding: 18px; }
}