/* ===== RETROPLAY UNIFIED THEME SYSTEM ===== */
/* Shared visual effects and page templates for consistent branding */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ===== THEME VARIABLES ===== */
:root {
  /* Retro/Pixel Colors */
  --pixel-green: #00ff41;
  --pixel-cyan: #00ffff;
  --pixel-magenta: #ff00ff;
  --pixel-yellow: #fbbf24;
  --pixel-purple: #8b5cf6;

  /* Page Backgrounds */
  --page-bg-dark: #0d0f18;
  --page-bg-gradient: linear-gradient(135deg, #0d0f18 0%, #13151f 50%, #1a1d2e 100%);

  /* Card Styles */
  --card-bg: rgba(26, 29, 46, 0.95);
  --card-border: rgba(139, 92, 246, 0.2);
  --card-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

/* ===== PIXEL FONT CLASS ===== */
.pixel-text,
.font-pixel {
  font-family: 'Press Start 2P', cursive;
}

/* ===== CENTERED PAGE LAYOUT ===== */
.page-centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.page-container {
  width: 100%;
  max-width: 500px;
  position: relative;
  z-index: 10;
}

/* ===== THEMED CARD STYLES ===== */
.themed-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.themed-card--pixel {
  border: 4px solid var(--accent-primary);
  border-radius: 0;
  box-shadow: 8px 8px 0 rgba(139, 92, 246, 0.3),
              inset 0 0 20px rgba(139, 92, 246, 0.1);
}

.themed-card--glow {
  box-shadow: var(--card-shadow),
              0 0 40px rgba(139, 92, 246, 0.2);
}

/* Animated top border */
.themed-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
  background-size: 200% 100%;
  animation: border-flow 3s linear infinite;
}

.themed-card--pixel::before {
  height: 4px;
  background: linear-gradient(45deg, var(--pixel-cyan), var(--pixel-magenta), var(--pixel-green), var(--pixel-cyan));
  background-size: 400% 400%;
  animation: gradient-border 3s ease infinite;
}

@keyframes border-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes gradient-border {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== NIGHT SKY BACKGROUND ===== */
.bg-night-sky {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    #060010 0%,
    #0a0121 30%,
    #0e0131 50%,
    #18023c 70%,
    #22034b 85%,
    #2e045a 100%
  );
}

.bg-night-sky .stars-container {
  position: absolute;
  width: 100%;
  height: 100%;
}

.bg-night-sky .star {
  position: absolute;
  border-radius: 50%;
  background: white;
}

.bg-night-sky .stars-glow {
  position: absolute;
  bottom: -50px;
  left: 10%;
  width: 80%;
  height: 80px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  box-shadow:
    0 0 60px 30px rgba(139, 92, 246, 0.2),
    0 0 100px 60px rgba(99, 43, 108, 0.15);
}

/* Moon */
.bg-night-sky .moon {
  position: absolute;
  top: 8%;
  right: 12%;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5f3ce 0%, #e8e4b8 50%, #d4cfaa 100%);
  box-shadow:
    0 0 20px 5px rgba(255, 250, 205, 0.3),
    0 0 40px 10px rgba(255, 250, 205, 0.2),
    0 0 80px 20px rgba(255, 250, 205, 0.1),
    inset -10px -5px 20px rgba(0, 0, 0, 0.15);
  animation: moon-float 8s ease-in-out infinite;
}

.moon-crater {
  position: absolute;
  border-radius: 50%;
  background: rgba(180, 175, 150, 0.4);
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.moon-crater-1 { width: 18px; height: 18px; top: 15px; left: 20px; }
.moon-crater-2 { width: 12px; height: 12px; top: 40px; left: 45px; }
.moon-crater-3 { width: 8px; height: 8px; top: 55px; left: 25px; }

@keyframes moon-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

/* Horizon glow */
.bg-night-sky .horizon-glow {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(
    to top,
    rgba(255, 100, 50, 0.15) 0%,
    rgba(255, 140, 80, 0.1) 15%,
    rgba(180, 100, 150, 0.08) 30%,
    rgba(100, 60, 120, 0.05) 50%,
    transparent 100%
  );
  pointer-events: none;
}

/* Shooting star */
.bg-night-sky::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  top: 20%;
  left: -100px;
  opacity: 0;
  animation: shooting-star 8s ease-in-out infinite;
  animation-delay: 3s;
  border-radius: 50%;
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.5);
}

@keyframes shooting-star {
  0% { left: -100px; top: 15%; opacity: 0; }
  2% { opacity: 1; }
  15% { left: 110%; top: 35%; opacity: 0; }
  100% { left: 110%; top: 35%; opacity: 0; }
}

/* ===== PIXEL RAIN BACKGROUND ===== */
.bg-pixel-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: var(--page-bg-dark);
}

.bg-pixel-rain canvas {
  width: 100%;
  height: 100%;
  opacity: 0.6;
}

/* ===== CRT EFFECTS ===== */
.effect-crt {
  position: relative;
}

/* Scanlines */
.effect-crt::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1000;
}

/* Flicker effect */
.effect-crt::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 16, 16, 0);
  opacity: 0;
  pointer-events: none;
  z-index: 1001;
  animation: crt-flicker 0.15s infinite;
}

@keyframes crt-flicker {
  0% { opacity: 0.02; }
  50% { opacity: 0.04; }
  100% { opacity: 0.02; }
}

/* ===== RETRO ANIMATIONS ===== */
@keyframes icon-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes logo-glitch {
  0%, 90%, 100% { transform: translate(0); filter: none; }
  92% { transform: translate(-2px, 1px); filter: hue-rotate(90deg); }
  94% { transform: translate(2px, -1px); filter: hue-rotate(-90deg); }
  96% { transform: translate(-1px, 2px); filter: none; }
}

@keyframes text-glitch {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.8; transform: skewX(2deg); }
  97% { opacity: 0.9; transform: skewX(-2deg); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* ===== BRAND LOGO ===== */
.brand-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.brand-logo img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
  border: 2px solid transparent;
  background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
              var(--gradient-primary) border-box;
}

.brand-logo--pixel img {
  border-radius: 8px;
  image-rendering: pixelated;
  animation: logo-glitch 3s infinite;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
}

.brand-logo--large img {
  width: 100px;
  height: 100px;
  border-radius: 16px;
}

.brand-logo span {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

/* ===== THEMED BUTTONS ===== */
.btn-pixel {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.1s;
  cursor: pointer;
  border: 3px solid;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 0;
}

.btn-pixel--primary {
  background: var(--accent-primary);
  border-color: #a78bfa;
  color: white;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.btn-pixel--primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.3);
}

.btn-pixel--primary:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.btn-pixel--secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--accent-secondary);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.btn-pixel--secondary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.3);
  background: rgba(251, 191, 36, 0.1);
}

/* ===== SOCIAL LINKS ===== */
.social-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.social-link {
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.social-link:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-3px);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.social-link--pixel {
  border-radius: 0;
  border-width: 3px;
  border-color: var(--accent-primary);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

.social-link--pixel:hover {
  color: var(--pixel-cyan);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.3);
  border-color: var(--pixel-cyan);
}

/* ===== LOADING BAR (PIXEL STYLE) ===== */
.loading-bar {
  width: 100%;
  height: 20px;
  background: var(--bg-primary);
  border: 3px solid var(--accent-primary);
  position: relative;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pixel-green), var(--pixel-cyan), var(--pixel-magenta));
  animation: loading-progress 2s ease-in-out infinite;
  box-shadow: 0 0 10px var(--pixel-green);
}

@keyframes loading-progress {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

.loading-text {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  color: var(--pixel-green);
  margin-top: 0.75rem;
  text-align: center;
  animation: blink 1s step-end infinite;
}

/* ===== PAGE TITLE STYLES ===== */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
}

.page-title--gradient {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-title--pixel {
  font-family: 'Press Start 2P', cursive;
  font-size: 1.2rem;
  line-height: 1.8;
  animation: text-glitch 2s infinite;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* ===== THEMED ICON ===== */
.page-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--accent-secondary);
}

.page-icon--bounce {
  animation: icon-bounce 1s infinite;
}

.page-icon--pixel {
  text-shadow:
    3px 3px 0 rgba(139, 92, 246, 0.5),
    -1px -1px 0 rgba(0, 255, 65, 0.3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 520px) {
  .page-centered {
    padding: 1rem;
  }

  .themed-card {
    padding: 1.5rem;
  }

  .page-title--pixel {
    font-size: 0.9rem;
  }

  .bg-night-sky .moon {
    width: 50px;
    height: 50px;
    top: 5%;
    right: 8%;
  }

  .moon-crater-1 { width: 12px; height: 12px; top: 10px; left: 12px; }
  .moon-crater-2 { width: 8px; height: 8px; top: 25px; left: 28px; }
  .moon-crater-3 { width: 5px; height: 5px; top: 35px; left: 15px; }

  .bg-night-sky .horizon-glow {
    height: 25%;
  }

  .brand-logo--large img {
    width: 80px;
    height: 80px;
  }
}
