/* ═══ xBCS Topbar — [bell][avatar] ═══ */

.xtopbar {
  position: fixed; top: 18px; right: 18px; z-index: 9000;
  display: flex; align-items: center; gap: 10px;
}

/* ─── Bell button ─── */
.xtb-bell {
  background: none; border: none; cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.xtb-bell:hover { transform: scale(1.1); }
.xtb-bell:active { transform: scale(0.95); }

/* Snake bell pulse animation */
.xtb-bell-snake-pulse { animation: snakeBellPulse 2s ease-in-out infinite; }
@keyframes snakeBellPulse {
  0%, 100% { --sbell: #306230; }
  50% { --sbell: #9b2020; }
}
/* Fallback for browsers that don't animate CSS vars */
.xtb-bell-snake-pulse svg rect {
  animation: snakeBellRectPulse 2s ease-in-out infinite;
}
@keyframes snakeBellRectPulse {
  0%, 100% { fill: #306230; }
  50% { fill: #9b2020; }
}

/* ─── Avatar button ─── */
.xtb-avatar { position: relative;
  width: 36px; height: 36px; padding: 0; border: none;
  background: none; cursor: pointer; overflow: visible;
  transition: transform 0.15s;
}
.xtb-avatar:hover { transform: scale(1.08); }
.xtb-avatar img { display: block; }
.xtb-avatar-init {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; font-family: inherit;
}

/* Theme-specific avatar sizing */
.xtopbar-lobby .xtb-avatar { width: 38px; height: 38px; }
.xtopbar-statki .xtb-avatar { width: 34px; height: 34px; }
.xtopbar-kik .xtb-avatar { width: 34px; height: 34px; }
.xtopbar-snake .xtb-avatar { width: 32px; height: 32px; }

/* ─── Notification Popup ─── */
.xtb-notif-popup, .xtb-menu-popup {
  display: none; position: absolute; top: 48px; right: 0;
  width: 300px; max-height: 400px; overflow-y: auto;
  border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.xtb-notif-popup.open, .xtb-menu-popup.open { display: block; }

/* Base popup theme (lobby) */
.xtb-notif-popup, .xtb-menu-popup {
  background: #161625; border: 1px solid rgba(255,255,255,0.1);
}

/* ─── Notification items ─── */
.xtb-np-header {
  padding: 12px 16px; font-size: 14px; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: space-between;
  color: #e8e8f0;
}
.xtb-np-readall {
  font-size: 11px; background: none; border: none; color: #00f0ff;
  cursor: pointer; font-family: inherit;
}
.xtb-np-item {
  padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; transition: background 0.15s;
}
.xtb-np-item:hover { background: rgba(255,255,255,0.04); }
.xtb-np-unread { background: rgba(0,240,255,0.04); border-left: 3px solid #00f0ff; }
.xtb-np-title { font-size: 13px; font-weight: 600; color: #e8e8f0; }
.xtb-np-body { font-size: 12px; color: #888; margin-top: 3px; }
.xtb-np-time { font-size: 10px; color: #555; margin-top: 4px; }
.xtb-np-empty, .xtb-np-loading {
  padding: 30px 16px; text-align: center; color: #666; font-size: 13px;
}

/* ─── Menu Popup ─── */
.xtb-menu-popup { width: 220px; }
.xtb-mp-header {
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.xtb-mp-name { font-size: 15px; font-weight: 700; color: #e8e8f0; }
.xtb-mp-rank { font-size: 11px; color: #888; margin-top: 2px; }
.xtb-mp-item {
  display: block; padding: 10px 16px; font-size: 13px; color: #ccc;
  text-decoration: none; transition: background 0.15s; cursor: pointer;
}
.xtb-mp-item:hover { background: rgba(255,255,255,0.04); color: #fff; }
.xtb-mp-divider { border-top: 1px solid rgba(255,255,255,0.06); margin: 2px 0; }
.xtb-mp-logout { color: #ff3366; }

/* ═══ Theme overrides ═══ */

/* STATKI */
.xtopbar-statki .xtb-notif-popup,
.xtopbar-statki .xtb-menu-popup {
  background: #f5f0e8; border: 2px solid #bbb; border-radius: 8px;
  font-family: 'Patrick Hand', cursive;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}
.xtopbar-statki .xtb-np-header { color: #333; border-color: #ccc; }
.xtopbar-statki .xtb-np-title { color: #333; }
.xtopbar-statki .xtb-np-body { color: #666; }
.xtopbar-statki .xtb-np-unread { background: rgba(74,158,255,0.08); border-left-color: #4a9eff; }
.xtopbar-statki .xtb-np-readall { color: #4a9eff; }
.xtopbar-statki .xtb-mp-name { color: #333; }
.xtopbar-statki .xtb-mp-rank { color: #888; }
.xtopbar-statki .xtb-mp-item { color: #555; }
.xtopbar-statki .xtb-mp-item:hover { background: rgba(0,0,0,0.04); color: #222; }
.xtopbar-statki .xtb-mp-logout { color: #c0392b; }

/* KIK */
.xtopbar-kik .xtb-notif-popup,
.xtopbar-kik .xtb-menu-popup {
  background: #161625; border: 2px solid #33aaff; border-radius: 8px;
  font-family: 'Righteous', sans-serif;
}
.xtopbar-kik .xtb-np-unread { border-left-color: #ff3366; background: rgba(255,51,102,0.06); }
.xtopbar-kik .xtb-np-readall { color: #33aaff; }
.xtopbar-kik .xtb-mp-logout { color: #ff3366; }

/* SNAKE */
.xtopbar-snake .xtb-notif-popup,
.xtopbar-snake .xtb-menu-popup {
  background: #8b9b0f; border: 2px solid #306230; border-radius: 4px;
  font-family: 'Press Start 2P', monospace; font-size: 10px;
  box-shadow: inset 0 0 20px rgba(15,56,15,0.3), 0 8px 30px rgba(0,0,0,0.4);
}
.xtopbar-snake .xtb-np-header { color: #0f380f; border-color: #306230; font-size: 10px; }
.xtopbar-snake .xtb-np-title { color: #0f380f; font-size: 9px; }
.xtopbar-snake .xtb-np-body { color: #306230; font-size: 8px; }
.xtopbar-snake .xtb-np-time { color: #306230; font-size: 7px; }
.xtopbar-snake .xtb-np-unread { background: rgba(15,56,15,0.12); border-left-color: #0f380f; }
.xtopbar-snake .xtb-np-readall { color: #0f380f; }
.xtopbar-snake .xtb-np-empty { color: #306230; }
.xtopbar-snake .xtb-mp-name { color: #0f380f; font-size: 10px; }
.xtopbar-snake .xtb-mp-rank { color: #306230; font-size: 8px; }
.xtopbar-snake .xtb-mp-item { color: #0f380f; font-size: 9px; padding: 8px 12px; }
.xtopbar-snake .xtb-mp-item:hover { background: rgba(15,56,15,0.1); }
.xtopbar-snake .xtb-mp-divider { border-color: #306230; }
.xtopbar-snake .xtb-mp-logout { color: #9b2020; }

/* LOBBY */
.xtopbar-lobby .xtb-bell svg { filter: drop-shadow(0 0 6px rgba(0,240,255,0.3)); }
.xtopbar-lobby .xtb-avatar { box-shadow: 0 0 0 2px rgba(0,240,255,0.2); border-radius: 50%; }

@media (max-width: 600px) {
  .xtopbar { top: 12px; right: 10px; gap: 6px; }
  .xtb-avatar { width: 30px !important; height: 30px !important; }
  .xtb-notif-popup, .xtb-menu-popup { width: calc(100vw - 24px); right: -8px; }
}

/* ═══ LOBBY — fame, blichtr i przepych ═══ */

@keyframes lobbyGlow {
  0%   { filter: drop-shadow(0 0 6px rgba(0,240,255,0.5)) drop-shadow(0 0 14px rgba(0,240,255,0.15)); }
  33%  { filter: drop-shadow(0 0 8px rgba(170,102,255,0.5)) drop-shadow(0 0 16px rgba(170,102,255,0.15)); }
  66%  { filter: drop-shadow(0 0 8px rgba(255,51,102,0.4)) drop-shadow(0 0 16px rgba(255,51,102,0.12)); }
  100% { filter: drop-shadow(0 0 6px rgba(0,240,255,0.5)) drop-shadow(0 0 14px rgba(0,240,255,0.15)); }
}

@keyframes avatarRing {
  0%   { box-shadow: 0 0 0 2px rgba(0,240,255,0.4), 0 0 10px rgba(0,240,255,0.2); }
  33%  { box-shadow: 0 0 0 2px rgba(170,102,255,0.4), 0 0 12px rgba(170,102,255,0.2); }
  66%  { box-shadow: 0 0 0 2px rgba(255,51,102,0.35), 0 0 12px rgba(255,51,102,0.15); }
  100% { box-shadow: 0 0 0 2px rgba(0,240,255,0.4), 0 0 10px rgba(0,240,255,0.2); }
}

.xtopbar-lobby {
  gap: 14px;
}
.xtopbar-lobby .xtb-bell {
  position: relative; padding: 6px;
}
.xtopbar-lobby .xtb-bell svg {
  animation: lobbyGlow 6s ease-in-out infinite;
  transition: transform 0.2s;
}
.xtopbar-lobby .xtb-bell:hover svg {
  transform: scale(1.15);
  filter: drop-shadow(0 0 14px rgba(0,240,255,0.7)) drop-shadow(0 0 30px rgba(170,102,255,0.3)) !important;
}
.xtopbar-lobby .xtb-avatar {
  width: 40px !important; height: 40px !important;
  border-radius: 50%;
  animation: avatarRing 8s ease-in-out infinite;
  transition: transform 0.2s;
}
.xtopbar-lobby .xtb-avatar:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px rgba(0,240,255,0.7), 0 0 20px rgba(0,240,255,0.4), 0 0 40px rgba(170,102,255,0.2) !important;
}
.xtopbar-lobby .xtb-avatar img {
  border-radius: 50%;
}
.xtopbar-lobby .xtb-notif-popup,
.xtopbar-lobby .xtb-menu-popup {
  background: linear-gradient(135deg, #0d0d1a 0%, #161625 100%);
  border: 1px solid rgba(0,240,255,0.12);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(0,240,255,0.06), inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
}
.xtopbar-lobby .xtb-np-header {
  background: linear-gradient(90deg, transparent, rgba(0,240,255,0.04), transparent);
  font-size: 15px; letter-spacing: 0.5px;
}
.xtopbar-lobby .xtb-np-unread {
  background: linear-gradient(90deg, rgba(0,240,255,0.06), transparent);
  border-left: 3px solid #00f0ff;
}
.xtopbar-lobby .xtb-np-item:hover {
  background: rgba(0,240,255,0.04);
}
.xtopbar-lobby .xtb-mp-header {
  background: linear-gradient(135deg, rgba(0,240,255,0.04), transparent);
  padding: 16px 18px;
}
.xtopbar-lobby .xtb-mp-name {
  font-size: 16px; letter-spacing: 0.5px;
  background: linear-gradient(90deg, #e8e8f0, #00f0ff);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.xtopbar-lobby .xtb-mp-item:hover {
  background: rgba(0,240,255,0.06);
  color: #00f0ff;
}
.xtopbar-lobby .xtb-mp-logout:hover {
  color: #ff3366;
  background: rgba(255,51,102,0.06);
}


/* ═══ VIP Badge ═══ */
.xtb-vip-badge {
  position: absolute; bottom: -2px; right: -2px;
  width: 16px; height: 16px;
  background: linear-gradient(135deg, #ffd700, #ffaa00, #ffd700);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #7a5800; font-weight: 700;
  box-shadow: 0 0 6px rgba(255,215,0,0.5), 0 0 12px rgba(255,170,0,0.2);
  animation: vipPulse 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 10;
}
@keyframes vipPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255,215,0,0.5), 0 0 12px rgba(255,170,0,0.2); }
  50% { box-shadow: 0 0 10px rgba(255,215,0,0.7), 0 0 20px rgba(255,170,0,0.35); }
}

/* Theme-specific VIP badge */
.xtopbar-lobby .xtb-vip-badge {
  background: linear-gradient(135deg, #ffd700, #ff6b00, #ffd700);
  box-shadow: 0 0 8px rgba(255,215,0,0.6), 0 0 16px rgba(255,107,0,0.3);
}
.xtopbar-statki .xtb-vip-badge {
  background: linear-gradient(135deg, #c8a84e, #e8c84e);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
  animation: none;
}
.xtopbar-kik .xtb-vip-badge {
  background: linear-gradient(135deg, #ffd700, #ff3366);
  color: #fff;
}
.xtopbar-snake .xtb-vip-badge {
  background: #306230;
  color: #9bbc0f;
  border-radius: 2px;
  font-size: 7px;
  font-family: 'Press Start 2P', monospace;
  box-shadow: none;
  animation: none;
}

/* ═══ Role Badge (right edge, raised) ═══ */
.xtb-role-badge {
  position: absolute; top: 0px; right: -6px;
  padding: 0px 3px; border-radius: 3px;
  font-size: 6px; font-weight: 800; letter-spacing: 0.2px;
  border: 2px solid var(--bg, rgba(12,12,24,0.95));
  line-height: 1.2; z-index: 2; pointer-events: none;
}
.xtb-role-vip {
  background: linear-gradient(90deg, #ffd700, #fff8dc, #ffd700, #daa520, #ffd700);
  background-size: 400% 100%;
  color: #4a2800;
  animation: xtbVIPShimmer 2.5s linear infinite;
  box-shadow: 0 0 6px rgba(255,215,0,0.5), 0 0 2px rgba(255,215,0,0.3);
  text-shadow: 0 0 2px rgba(218,165,32,0.4);
}
@keyframes xtbVIPShimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 400% 50%; }
}
.xtb-role-mod { background: linear-gradient(135deg, #3b82f6, #60a5fa); color: #fff; }
.xtb-role-adm { background: #e24b4a; color: #fff; }

/* ═══ Status Dot (right edge, lowered) ═══ */
.xtb-status-dot {
  position: absolute; bottom: -2px; right: -3px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--bg, rgba(12,12,24,0.95));
  z-index: 2; pointer-events: none;
  transition: background 0.3s;
}
.xtb-status-available { background: #22cc66; box-shadow: 0 0 6px rgba(34,204,102,0.5); }
.xtb-status-in-game { background: #EF9F27; box-shadow: 0 0 6px rgba(239,159,39,0.5); }
.xtb-status-unavailable { background: #444441; }
.xtb-status-invisible { background: #444441; }
.xtb-status-offline { background: #2c2c2a; }

/* Theme-specific border colors */
.xtb-statki .xtb-role-badge, .xtb-statki .xtb-status-dot { border-color: rgba(245,240,232,0.95); }
.xtb-snake .xtb-role-badge, .xtb-snake .xtb-status-dot { border-color: rgba(48,62,48,0.95); }

/* Avatar image clips inside, badges overflow outside */
.xtb-avatar img { border-radius: 50%; overflow: hidden; }
.xtb-avatar-init { overflow: hidden; }

/* ═══ Mobile menu ═══ */
@media (max-width: 600px) {
  .xtb-menu-popup {
    width: calc(100vw - 16px) !important;
    right: -8px !important;
    max-height: 70vh;
    overflow-y: auto;
  }
  .xtb-mp-item { 
    padding: 14px 18px !important; 
    font-size: 14px !important;
    min-height: 44px;
    display: flex; align-items: center;
  }
  .xtb-notif-popup {
    width: calc(100vw - 16px) !important;
    right: -8px !important;
    max-height: 60vh;
    overflow-y: auto;
  }
}
