/* ────────────────────────────────────────────────────────────────────────
   v22 — Dark/Light Mode + Live Chat Widget
   Include this in all pages:  <link rel="stylesheet" href="css/v22.css">
   ──────────────────────────────────────────────────────────────────────── */

/* ── THEME SYSTEM ─────────────────────────────────────────────────────── */
:root {
  --theme-toggle-speed: 0.3s;
}

/* Light mode overrides — applied when body has class "light-mode" */
body.light-mode {
  --bg:       #f7f5f2;
  --bg2:      #eeecea;
  --card:     #ffffff;
  --text:     #0f0d0b;
  --muted:    #6b6560;
  --border:   rgba(0,0,0,0.1);
  --shadow:   rgba(0,0,0,0.08);
  background-color: var(--bg);
  color: var(--text);
}
body.light-mode .card,
body.light-mode .panel,
body.light-mode .glass-card {
  background: var(--card);
  border-color: rgba(212,175,55,0.25);
  color: var(--text);
  box-shadow: 0 2px 20px var(--shadow);
}
body.light-mode #hdr { background: rgba(247,245,242,0.92); border-bottom-color: rgba(212,175,55,0.2); }
body.light-mode .input { background: #fff; color: #0f0d0b; border-color: rgba(212,175,55,0.3); }
body.light-mode .btn.ghost { color: #0f0d0b; border-color: rgba(0,0,0,0.15); }
body.light-mode .btn.ghost:hover { background: rgba(0,0,0,0.06); }
body.light-mode #dust { opacity: 0.15 !important; }
body.light-mode .stat-card,
body.light-mode .stats-ticker { background: rgba(212,175,55,0.06); }
body.light-mode .rev { background: #f0ece5; }
body.light-mode .rev .feed { background: #fff; }
body.light-mode .order-skeleton,
body.light-mode .pc-skeleton,
body.light-mode .cc-skeleton,
body.light-mode .rev-skeleton { background: #e8e4df !important; }
body.light-mode .sk-pulse { background: linear-gradient(90deg,#ddd 25%,#e8e4df 50%,#ddd 75%) !important; }
body.light-mode .search-mega input { background: #fff; color: #0f0d0b; }
body.light-mode .news-card { background: #fff; }
body.light-mode .lb-item { background: rgba(0,0,0,0.03); border-color: rgba(212,175,55,0.15); }
body.light-mode .login-card { background: #fff; border-color: rgba(212,175,55,0.3); }
body.light-mode .portal-sidebar { background: #fff; }

/* ── THEME TOGGLE BUTTON ──────────────────────────────────────────────── */
.theme-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid rgba(212,175,55,0.3);
  background: rgba(255,255,255,0.06);
  cursor: pointer; transition: all 0.2s;
  font-size: 17px; flex-shrink: 0;
  position: relative; overflow: hidden;
}
.theme-toggle-btn:hover {
  border-color: var(--gold);
  background: rgba(212,175,55,0.12);
  transform: rotate(20deg);
}
body.light-mode .theme-toggle-btn {
  background: rgba(0,0,0,0.06);
  border-color: rgba(212,175,55,0.4);
}


/* ── MOBILE BOTTOM NAV ────────────────────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9000;
  background: rgba(13,11,24,0.96); backdrop-filter: blur(20px);
  border-top: 1px solid rgba(139,92,246,0.2);
  padding: env(safe-area-inset-bottom, 0);
}
body.light-mode .mobile-bottom-nav {
  background: rgba(247,245,242,0.97);
  border-top-color: rgba(212,175,55,0.25);
}
.mobile-nav-inner {
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 0 10px;
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-decoration: none; color: var(--muted);
  font-size: 10px; font-weight: 600; padding: 4px 12px;
  border-radius: 10px; transition: color 0.15s;
  border: none; background: none; cursor: pointer;
}
.mobile-nav-item.active, .mobile-nav-item:hover {
  color: var(--gold);
}
.mobile-nav-item .mn-icon { font-size: 20px; }
.mobile-nav-item .mn-label { font-size: 10px; }
.mobile-nav-cart-badge {
  position: relative; display: inline-block;
}
.mobile-nav-cart-badge .badge-num {
  position: absolute; top: -6px; right: -8px;
  background: var(--gold); color: #000;
  font-size: 9px; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1;
}

@media (max-width: 768px) {
  .mobile-bottom-nav { display: block; }
  main { padding-bottom: 72px !important; }
}


/* ── LIVE CHAT WIDGET (ROYALNEX LUXURY GOLD & MOCHA) ─────────────────── */
.chat-bubble-btn {
  position: fixed !important; bottom: 24px !important; right: 24px !important; z-index: 8500 !important;
  width: 56px !important; height: 56px !important; border-radius: 50% !important;
  background: linear-gradient(135deg, #F4D9A0 0%, #C8792C 100%) !important;
  color: #0A0A0A !important;
  border: 1.5px solid rgba(244, 217, 160, 0.7) !important; cursor: pointer !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  font-size: 26px !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.75), 0 0 20px rgba(244,217,160,0.35) !important;
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), box-shadow 0.25s ease !important;
  animation: chatBounce 3.5s ease-in-out infinite !important;
}
.chat-bubble-btn:hover {
  transform: scale(1.08) translateY(-3px) !important;
  box-shadow: 0 14px 40px rgba(0,0,0,0.85), 0 0 30px rgba(244,217,160,0.6) !important;
}
.chat-bubble-btn .chat-notif {
  position: absolute !important; top: -2px !important; right: -2px !important;
  width: 15px !important; height: 15px !important; border-radius: 50% !important;
  background: #ef4444 !important; border: 2.5px solid #0A0A0A !important;
  animation: pulse 2s infinite !important;
}
@keyframes chatBounce {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* On mobile: move above bottom nav */
@media (max-width: 768px) {
  .chat-bubble-btn { bottom: 80px !important; right: 18px !important; width: 50px !important; height: 50px !important; font-size: 22px !important; }
}

/* Chat Panel */
.chat-panel {
  position: fixed !important; bottom: 92px !important; right: 24px !important; z-index: 8600 !important;
  width: 370px !important; max-height: 540px !important;
  background: #181312 !important; border: 1.5px solid rgba(244, 217, 160, 0.35) !important;
  border-radius: 22px !important; overflow: hidden !important;
  box-shadow: 0 24px 80px rgba(0,0,0,0.85), 0 0 35px rgba(200, 121, 44, 0.2) !important;
  transform: scale(0.9) translateY(20px) !important; transform-origin: bottom right !important;
  opacity: 0 !important; visibility: hidden !important;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: flex !important; flex-direction: column !important;
}
.chat-panel.open {
  transform: scale(1) translateY(0) !important;
  opacity: 1 !important; visibility: visible !important;
}
body.light-mode .chat-panel {
  background: #fff !important; border-color: rgba(200, 121, 44, 0.35) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2) !important;
}

@media (max-width: 480px) {
  .chat-panel { width: calc(100vw - 32px) !important; right: 16px !important; bottom: 84px !important; }
}

.chat-header {
  background: linear-gradient(135deg, rgba(91, 70, 50, 0.45), rgba(33, 27, 26, 0.9)) !important;
  border-bottom: 1px solid rgba(244, 217, 160, 0.25) !important;
  padding: 16px 20px !important;
  display: flex !important; align-items: center !important; gap: 12px !important;
}
.chat-header-avatar {
  width: 40px !important; height: 40px !important; border-radius: 50% !important;
  background: rgba(244, 217, 160, 0.15) !important;
  display: flex !important; align-items: center !important; justify-content: center !important; font-size: 20px !important;
  border: 1.5px solid rgba(244, 217, 160, 0.5) !important;
  box-shadow: 0 0 15px rgba(244, 217, 160, 0.2) !important;
}
.chat-header-info { flex: 1 !important; }
.chat-header-name { font-weight: 800 !important; font-size: 14.5px !important; color: #F4D9A0 !important; letter-spacing: 0.5px !important; }
.chat-header-status { font-size: 11px !important; color: #22c55e !important; display: flex !important; align-items: center !important; gap: 5px !important; font-weight: 600 !important; }
.chat-header-status::before {
  content: '' !important; display: inline-block !important; width: 6px !important; height: 6px !important;
  border-radius: 50% !important; background: #22c55e !important; box-shadow: 0 0 8px #22c55e !important;
}
.chat-close-btn {
  background: none !important; border: none !important; color: rgba(244, 217, 160, 0.6) !important;
  font-size: 20px !important; cursor: pointer !important; padding: 4px !important;
  transition: color .15s, transform .15s !important;
}
.chat-close-btn:hover { color: #F4D9A0 !important; transform: scale(1.15) !important; }

.chat-body {
  flex: 1 !important; overflow-y: auto !important; padding: 16px !important;
  display: flex !important; flex-direction: column !important; gap: 12px !important;
}
.chat-msg {
  max-width: 86% !important; padding: 11px 15px !important; border-radius: 14px !important;
  font-size: 13px !important; line-height: 1.55 !important;
}
.chat-msg.bot {
  background: rgba(244, 217, 160, 0.08) !important;
  border: 1px solid rgba(244, 217, 160, 0.22) !important;
  color: #F5EFEB !important;
  border-bottom-left-radius: 4px !important; align-self: flex-start !important;
}
.chat-msg.user {
  background: linear-gradient(135deg, #F4D9A0, #C8792C) !important; color: #0A0A0A !important; font-weight: 700 !important;
  border-bottom-right-radius: 4px !important; align-self: flex-end !important;
  box-shadow: 0 4px 15px rgba(200, 121, 44, 0.3) !important;
}
body.light-mode .chat-msg.bot { background: #f4ede6 !important; border-color: rgba(200, 121, 44, 0.2) !important; color: #211B1A !important; }

/* Quick reply chips */
.chat-quick-replies {
  display: flex !important; flex-wrap: wrap !important; gap: 6px !important; padding: 0 16px 8px !important;
}
.chat-quick-reply {
  padding: 6px 12px !important; border-radius: 20px !important;
  border: 1px solid rgba(244, 217, 160, 0.3) !important;
  background: rgba(244, 217, 160, 0.08) !important;
  color: #F4D9A0 !important; font-size: 12px !important; font-weight: 600 !important; cursor: pointer !important;
  transition: all .2s !important; font-family: 'Inter', sans-serif !important;
  white-space: nowrap !important;
}
.chat-quick-reply:hover {
  background: linear-gradient(135deg, rgba(244, 217, 160, 0.25), rgba(200, 121, 44, 0.3)) !important;
  border-color: #F4D9A0 !important; color: #FFFFFF !important;
  transform: translateY(-1px) !important;
}

/* Discord CTA */
.chat-discord-cta {
  margin: 6px 16px 12px !important;
  background: linear-gradient(135deg, #5865F2, #4752C4) !important; border-radius: 12px !important;
  padding: 10px 16px !important;
  display: flex !important; align-items: center !important; justify-content: center !important; gap: 10px !important;
  text-decoration: none !important; color: #fff !important; font-weight: 700 !important; font-size: 12.5px !important;
  box-shadow: 0 4px 18px rgba(88, 101, 242, 0.4) !important;
  transition: opacity .2s, transform .2s !important;
}
.chat-discord-cta:hover { opacity: 0.95 !important; transform: translateY(-1px) !important; }
.chat-discord-cta svg { width: 18px !important; height: 18px !important; flex-shrink: 0 !important; }

/* Interactive AI Chat Input Box */
.chat-input-row {
  display: flex !important;
  align-items: center !important;
  padding: 8px 14px 12px !important;
  gap: 8px !important;
  border-top: 1px solid rgba(244, 217, 160, 0.15) !important;
  background: rgba(18, 13, 12, 0.95) !important;
}
.chat-text-input {
  flex: 1 !important;
  background: #0A0A0A !important;
  border: 1px solid rgba(244, 217, 160, 0.25) !important;
  border-radius: 999px !important;
  padding: 8px 14px !important;
  color: #F4D9A0 !important;
  font-size: 12.5px !important;
  outline: none !important;
  font-family: 'Inter', sans-serif !important;
}
.chat-text-input:focus {
  border-color: #F4D9A0 !important;
  box-shadow: 0 0 10px rgba(244, 217, 160, 0.25) !important;
}
.chat-send-btn {
  background: linear-gradient(135deg, #F4D9A0, #C8792C) !important;
  color: #0A0A0A !important;
  border: none !important;
  border-radius: 50% !important;
  width: 32px !important;
  height: 32px !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.15s ease !important;
  flex-shrink: 0 !important;
}
.chat-send-btn:hover {
  transform: scale(1.08) !important;
}
