/* =============================================
   Gamer Zone — Popup Player Styles
   ============================================= */

/* ---------- Floating Action Button ---------- */
.gamer-zone-fab {
  position: fixed;
  right: 14px;
  top: 320px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #8B5CF6, #EC4899);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow:
    0 4px 18px rgba(139, 92, 246, 0.45),
    0 0 0 0 rgba(139, 92, 246, 0);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: gzFabPulse 3s ease-in-out infinite;
  letter-spacing: 0.3px;
  white-space: nowrap;
  user-select: none;
}

.gamer-zone-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 6px 24px rgba(139, 92, 246, 0.55),
    0 0 30px rgba(236, 72, 153, 0.25);
}

.gamer-zone-fab:active {
  transform: scale(0.96);
}

.gamer-zone-fab-icon {
  font-size: 1.2rem;
  line-height: 1;
}

@keyframes gzFabPulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(139, 92, 246, 0.45), 0 0 0 0 rgba(139, 92, 246, 0); }
  50%      { box-shadow: 0 4px 18px rgba(139, 92, 246, 0.45), 0 0 20px 4px rgba(139, 92, 246, 0.18); }
}

/* ---------- Game Selector Dropdown ---------- */
.gz-game-menu {
  position: fixed;
  right: 14px;
  top: 370px;
  z-index: 9001;
  min-width: 220px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(139, 92, 246, 0.12);
  padding: 8px;
  opacity: 0;
  transform: translateY(-12px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gz-game-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.gz-menu-title {
  display: block;
  padding: 8px 14px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #8B5CF6;
}

.gz-game-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
  font-family: inherit;
}

.gz-game-item:hover {
  background: rgba(139, 92, 246, 0.08);
}

.gz-game-item:active {
  background: rgba(139, 92, 246, 0.15);
}

.gz-game-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.gz-game-icon.pumpquest {
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  box-shadow: 0 2px 8px rgba(15, 52, 96, 0.3);
}

.gz-game-icon.shapequest {
  background: linear-gradient(135deg, #4c1d95, #7c3aed);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.gz-game-info {
  flex: 1;
  min-width: 0;
}

.gz-game-name {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1f2937;
  line-height: 1.3;
}

.gz-game-desc {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.3;
}

.gz-game-arrow {
  color: #d1d5db;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.gz-game-item:hover .gz-game-arrow {
  color: #8B5CF6;
  transform: translateX(2px);
}

/* ---------- Popup Overlay ---------- */
.pq-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.pq-popup-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Popup Window ---------- */
.pq-popup-window {
  position: fixed;
  z-index: 9501;
  display: flex;
  flex-direction: column;
  min-width: 480px;
  min-height: 380px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(139, 92, 246, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.pq-popup-window.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* ---------- Popup Header ---------- */
.pq-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.pq-popup-header:active {
  cursor: grabbing;
}

.pq-popup-title {
  flex: 1;
  font-weight: 700;
  font-size: 0.9rem;
  color: #ffd700;
  letter-spacing: 0.5px;
}

.pq-popup-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
  padding: 0;
}

.pq-popup-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.pq-popup-btn.close:hover {
  background: rgba(239, 68, 68, 0.6);
  color: #fff;
}

/* ---------- Popup Body (iframe container) ---------- */
.pq-popup-body {
  flex: 1;
  position: relative;
  background: #0a0a1a;
  overflow: hidden;
}

.pq-popup-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Loading spinner shown while iframe loads */
.pq-popup-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #0a0a1a;
  z-index: 2;
  transition: opacity 0.4s ease;
}

.pq-popup-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.pq-popup-loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(139, 92, 246, 0.2);
  border-top-color: #8B5CF6;
  border-radius: 50%;
  animation: pqSpin 0.8s linear infinite;
}

.pq-popup-loader-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@keyframes pqSpin {
  to { transform: rotate(360deg); }
}

/* Transparent cover placed over iframe during drag/resize
   so pointer events aren't swallowed by the iframe */
.pq-popup-drag-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: none;
}

.pq-popup-drag-cover.active {
  display: block;
}

/* ---------- Resize Handle ---------- */
.pq-popup-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 2;
  /* Three-dot resize grip */
  background:
    radial-gradient(circle, rgba(255,255,255,0.4) 1.5px, transparent 1.5px) no-repeat 6px 12px / 3px 3px,
    radial-gradient(circle, rgba(255,255,255,0.4) 1.5px, transparent 1.5px) no-repeat 10px 8px / 3px 3px,
    radial-gradient(circle, rgba(255,255,255,0.4) 1.5px, transparent 1.5px) no-repeat 14px 4px / 3px 3px,
    radial-gradient(circle, rgba(255,255,255,0.4) 1.5px, transparent 1.5px) no-repeat 10px 12px / 3px 3px,
    radial-gradient(circle, rgba(255,255,255,0.4) 1.5px, transparent 1.5px) no-repeat 14px 8px / 3px 3px,
    radial-gradient(circle, rgba(255,255,255,0.4) 1.5px, transparent 1.5px) no-repeat 14px 12px / 3px 3px;
}

/* ---------- Minimized State ---------- */
.pq-popup-window.minimized {
  width: 260px !important;
  height: auto !important;
  min-height: unset !important;
}

.pq-popup-window.minimized .pq-popup-body,
.pq-popup-window.minimized .pq-popup-resize {
  display: none;
}

/* ---------- Dark Mode ---------- */
.dark-mode .gz-game-menu {
  background: rgba(30, 30, 40, 0.97);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(139, 92, 246, 0.2);
}

.dark-mode .gz-menu-title {
  color: #a78bfa;
}

.dark-mode .gz-game-name {
  color: #f3f4f6;
}

.dark-mode .gz-game-desc {
  color: #9ca3af;
}

.dark-mode .gz-game-item:hover {
  background: rgba(139, 92, 246, 0.12);
}

.dark-mode .gz-game-arrow {
  color: #4b5563;
}

.dark-mode .gz-game-item:hover .gz-game-arrow {
  color: #a78bfa;
}

.dark-mode .pq-popup-window {
  background: rgba(20, 20, 30, 0.96);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(139, 92, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---------- Responsive: Mobile ---------- */
@media (max-width: 768px) {
  .gamer-zone-fab {
    top: auto;
    bottom: 88px;
    right: 20px;
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  .gz-game-menu {
    top: auto;
    bottom: 144px;
    right: 20px;
    min-width: 200px;
  }

  /* On mobile the popup is never shown — we redirect instead */
  .pq-popup-overlay,
  .pq-popup-window {
    display: none !important;
  }
}
