/* Header styles for Retro Games Theme */

/* Header styles with scanline effect */
.top-header {
  background-color: #0b0033 !important; /* Forcing with !important to override any other styles */
  padding: 30px 0;
  border-bottom: 2px solid rgba(0, 255, 255, 0.5);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
  /* Added margin at top to create space for the neon line */
  margin-top: 8px;
}

/* Scanline effect for CRT monitor look */
.top-header:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  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: 1;
  opacity: 0.4;
}

/* CRT power-on animation for the header */
.top-header:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, 
    rgba(255, 255, 255, 0.1) 0%, 
    rgba(0, 0, 0, 0) 5%,
    rgba(0, 0, 0, 0) 95%, 
    rgba(255, 255, 255, 0.1) 100%
  );
  animation: crtOn 3s ease-out forwards;
  pointer-events: none;
  z-index: 1;
}

@keyframes crtOn {
  0% {
    opacity: 0;
    background: white;
    transform: scaleY(0.005);
  }
  3% {
    opacity: 1;
    transform: scaleY(0.005);
  }
  5% {
    transform: scaleY(1);
  }
  30% {
    background: rgba(255, 255, 255, 0.3);
  }
  100% {
    background: linear-gradient(to bottom, 
      rgba(255, 255, 255, 0.1) 0%, 
      rgba(0, 0, 0, 0) 5%,
      rgba(0, 0, 0, 0) 95%, 
      rgba(255, 255, 255, 0.1) 100%
    );
  }
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 15px;
  position: relative;
  z-index: 2;
}

/* Logo styles with enhanced glow effect */
.site-logo {
  flex: 0 0 auto;
  position: relative;
}

.site-logo img {
  height: 100px;
  width: auto;
  filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.8));
  image-rendering: pixelated;
}

/* Digital noise effect for the logo */
.site-logo:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" fill="rgba(0,255,255,0.2)" x="10" y="10" /><rect width="1" height="1" fill="rgba(0,255,255,0.2)" x="30" y="20" /><rect width="1" height="1" fill="rgba(0,255,255,0.2)" x="25" y="60" /><rect width="1" height="1" fill="rgba(0,255,255,0.2)" x="65" y="35" /><rect width="1" height="1" fill="rgba(0,255,255,0.2)" x="70" y="70" /><rect width="1" height="1" fill="rgba(255,0,255,0.2)" x="15" y="45" /><rect width="1" height="1" fill="rgba(255,0,255,0.2)" x="45" y="15" /><rect width="1" height="1" fill="rgba(255,0,255,0.2)" x="50" y="50" /><rect width="1" height="1" fill="rgba(255,0,255,0.2)" x="80" y="80" /></svg>');
  background-size: 100px 100px;
  opacity: 0.4;
  z-index: -1;
  animation: digitalNoise 10s linear infinite;
  pointer-events: none;
}

@keyframes digitalNoise {
  0% { background-position: 0 0; }
  25% { background-position: 100px 0; }
  50% { background-position: 100px 100px; }
  75% { background-position: 0 100px; }
  100% { background-position: 0 0; }
}

.site-logo:after {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 5px;
  background: radial-gradient(
    circle at center,
    rgba(0, 255, 255, 0.2) 0%,
    transparent 70%
  );
  z-index: -1;
  opacity: 0.8;
  animation: logoGlow 3s ease-in-out infinite alternate;
}

@keyframes logoGlow {
  0% {
    opacity: 0.6;
    background: radial-gradient(
      circle at center,
      rgba(0, 255, 255, 0.2) 0%,
      transparent 70%
    );
  }
  100% {
    opacity: 0.9;
    background: radial-gradient(
      circle at center,
      rgba(255, 0, 255, 0.2) 0%,
      transparent 70%
    );
  }
}

/* Header right section with enhanced styling */
.header-tools {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative; /* Added to create positioning context for #search-container */
}

.cart-button, 
.user-button,
.cart-icon,
.search-icon {
  color: #00ffff;
  font-size: 20px;
  display: flex;
  align-items: center;
  text-decoration: none;
  text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff;
  transition: all 0.3s ease;
  /* Pixel border around icons */
  padding: 5px;
  border: 1px dashed rgba(0, 255, 255, 0.4);
}

.cart-button:hover, 
.user-button:hover,
.cart-icon:hover,
.search-icon:hover {
  color: #ff00ff;
  text-shadow: 0 0 5px #ff00ff, 0 0 10px #ff00ff, 0 0 15px #ff00ff;
  transform: scale(1.1);
  border-color: rgba(255, 0, 255, 0.6);
}

/* Hide the original elements we're replacing */
.coins-display, 
#cart:not(#retro-cart) {
  display: none !important;
}

/* Ultra Retro Gaming Cart Styling */
#retro-cart {
  position: relative;
}

.retro-cart-button {
  text-decoration: none;
  display: block;
  transform: scale(1);
  transition: transform 0.2s ease;
  /* Pixel-perfect positioning */
  image-rendering: pixelated;
}

.retro-cart-button:hover {
  transform: scale(1.05);
}

/* Arcade cabinet style container */
.retro-cart-container {
  background-color: #1a0836;
  color: #ffffff;
  padding: 6px 14px;
  border: 2px solid #00ffff;
  box-shadow: 
    0 0 0 1px #1a0836,
    0 0 0 3px rgba(0, 255, 255, 0.3),
    0 0 10px rgba(255, 0, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  font-family: 'Press Start 2P', cursive;
  font-size: 10px;
  transition: all 0.3s ease;
  
  /* More pixelated shape */
  clip-path: polygon(
    0% 10%, 4% 10%, 4% 4%, 10% 4%, 10% 0%,
    90% 0%, 90% 4%, 96% 4%, 96% 10%, 100% 10%,
    100% 90%, 96% 90%, 96% 96%, 90% 96%, 90% 100%,
    10% 100%, 10% 96%, 4% 96%, 4% 90%, 0% 90%
  );
}

/* CRT scanlines effect */
.retro-cart-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  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: 2;
  opacity: 0.4;
}

/* Classic arcade cabinet buttons */
.retro-cart-container::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 3px;
  background: linear-gradient(to right,
    #ff0000 0%,
    #ff0000 30%,
    #ffff00 33%,
    #ffff00 63%,
    #00ff00 66%,
    #00ff00 100%
  );
  z-index: 0;
  opacity: 0.7;
}

/* Game cartridge or controller icon with pixelated style */
.retro-cart-container i {
  color: #00ffff;
  font-size: 14px;
  filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.7));
  transform: rotate(5deg);
  display: inline-block;
  image-rendering: pixelated;
  animation: retro-icon-float 2s infinite alternate;
}

@keyframes retro-icon-float {
  0% {
    transform: translateY(0px) rotate(0deg);
    filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.7));
  }
  100% {
    transform: translateY(-3px) rotate(5deg);
    filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.9));
  }
}

/* 8-bit style text */
.retro-cart-text {
  color: #ffffff;
  text-shadow: 
    2px 2px 0 #1a0836,
    -1px -1px 0 rgba(0, 255, 255, 0.5);
  letter-spacing: 1px;
  /* Pixel font rendering */
  image-rendering: pixelated;
  /* Text flicker effect */
  animation: text-glitch 8s infinite;
}

@keyframes text-glitch {
  0%, 100% { opacity: 1; }
  98.9% { opacity: 1; }
  99% { opacity: 0.8; }
  99.1% { opacity: 1; }
  99.2% { opacity: 0.6; }
  99.3% { opacity: 1; }
}

/* Ultra pixelated item counter */
#retro-cart #cart-count-display {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #ff00ff;
  color: #fff;
  font-size: 9px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  font-family: 'Press Start 2P', cursive;
  box-shadow: 
    0 0 0 1px #1a0836,
    0 0 0 2px rgba(255, 0, 255, 0.5),
    0 0 8px rgba(255, 0, 255, 0.7);
  image-rendering: pixelated;
  
  /* Even more pixelated corners for counter */
  clip-path: polygon(
    0% 25%, 25% 25%, 25% 0%,
    75% 0%, 75% 25%, 100% 25%,
    100% 75%, 75% 75%, 75% 100%,
    25% 100%, 25% 75%, 0% 75%
  );
}

/* Enhanced hover effects */
.retro-cart-container:hover {
  border-color: #ff00ff;
  background-color: #230d45;
  box-shadow: 
    0 0 0 1px #1a0836,
    0 0 0 3px rgba(255, 0, 255, 0.5),
    0 0 15px rgba(255, 0, 255, 0.6);
}

.retro-cart-container:hover .retro-cart-text {
  color: #00ffff;
  text-shadow: 
    0 0 5px #00ffff,
    0 0 10px rgba(0, 255, 255, 0.5);
}

.retro-cart-container:hover i {
  color: #ff00ff;
  animation: retro-icon-active 0.4s infinite alternate;
}

@keyframes retro-icon-active {
  0% {
    transform: rotate(-10deg) scale(1.2);
    filter: drop-shadow(0 0 8px rgba(255, 0, 255, 0.8));
  }
  100% {
    transform: rotate(10deg) scale(1.3);
    filter: drop-shadow(0 0 10px rgba(255, 0, 255, 1));
  }
}

/* Animation for cart count updates */
.pixel-bounce {
  animation: pixel-bounce-animation 0.4s steps(4);
}

@keyframes pixel-bounce-animation {
  0% { transform: scale(1); }
  25% { transform: scale(1.5); }
  50% { transform: scale(1.2); }
  75% { transform: scale(0.8); }
  100% { transform: scale(1); }
}

/* Add a classic arcade insert-coin prompt */
.retro-cart-container .insert-coin {
  position: absolute;
  bottom: -14px;
  right: 0;
  font-size: 6px;
  color: #ffff00;
  opacity: 0;
  text-shadow: 0 0 4px rgba(255, 255, 0, 0.8);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.retro-cart-container:hover .insert-coin {
  opacity: 1;
  animation: blink-text 1s steps(2) infinite;
}

@keyframes blink-text {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* Console Navigation Menu */
.console-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  margin: 0 20px;
}

.console-nav ul {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 25px;
}

.console-nav li {
  padding: 0;
  position: relative;
}

/* Header text - half size */
.console-nav a {
  color: white;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.45rem; /* Halved from 0.9rem */
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 1px;
  padding: 5px 8px;
  transition: all 0.2s ease;
  position: relative;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  display: inline-block;
  /* Added pixelated border */
  border: 1px solid transparent;
}

/* Add pixel corners to nav items */
.console-nav a:before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: 3px;
  height: 3px;
  background-color: transparent;
  transition: all 0.3s ease;
}

.console-nav a:hover:before,
.console-nav a.active:before {
  background-color: #00ffff;
  box-shadow: 3px 0 0 transparent, 0 3px 0 transparent, 3px 3px 0 #00ffff;
}

/* Pixelated underline effect for retro feel */
.console-nav a:after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: transparent;
  box-shadow: 
    1px 0 0 #00ffff,
    3px 0 0 #00ffff,
    5px 0 0 #00ffff,
    7px 0 0 #00ffff,
    9px 0 0 #00ffff,
    11px 0 0 #00ffff,
    13px 0 0 #00ffff;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.console-nav a:hover:after,
.console-nav a.active:after {
  opacity: 1;
}

/* Enhanced hover effect with improved flicker animation */
.console-nav a:hover,
.console-nav a.active {
  color: #00ffff;
  text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff, 0 0 15px #00ffff;
  transform: scale(1.05);
  animation: textFlicker 1.5s infinite alternate;
  border-color: rgba(0, 255, 255, 0.3);
}

/* More realistic CRT flicker animation */
@keyframes textFlicker {
  0% {
    text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff;
    opacity: 0.9;
  }
  90% {
    text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff, 0 0 15px #00ffff;
    opacity: 1;
  }
  91% {
    text-shadow: none;
    opacity: 0.8;
  }
  92% {
    text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff, 0 0 15px #00ffff, 0 0 20px #00ffff;
    opacity: 1;
  }
  100% {
    text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff, 0 0 15px #00ffff, 0 0 20px #00ffff;
    opacity: 1;
  }
}

/* Pixel dots between menu items - brighter */
.console-nav li:not(:last-child):after {
  content: "•";
  position: absolute;
  right: -15px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(0, 255, 255, 0.7);
  font-size: 12px;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

/* Search dropdown with arcade style - more pixelated */
#search-container {
  position: absolute;
  top: 100%;
  right: 0;
  background: #23104a;
  padding: 7px;
  border-radius: 0;
  border: 2px solid #ff00ff;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.5), 0 0 20px rgba(0, 255, 255, 0.3);
  z-index: 1000;
  width: 300px;
  display: none;
  /* Pixelated corners */
  clip-path: polygon(
    0% 2%, 2% 2%, 2% 0%,
    98% 0%, 98% 2%, 100% 2%,
    100% 98%, 98% 98%, 98% 100%,
    2% 100%, 2% 98%, 0% 98%
  );
}

#search-container:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 0, 255, 0.05) 0px,
    rgba(255, 0, 255, 0.05) 1px,
    transparent 1px,
    transparent 4px
  );
  pointer-events: none;
}

#search-container .search-inner {
  display: flex;
  width: 100%;
  position: relative;
}

#search-container input {
  flex: 1;
  padding: 8px 10px;
  background-color: #1a0c35;
  color: #fff;
  border: 1px solid #00ffff;
  border-right: none;
  border-radius: 0;
  font-family: 'VT323', monospace;
  font-size: 18px;
  box-shadow: 0 0 5px rgba(0, 255, 255, 0.5) inset;
}

#search-container button {
  background: #ff00ff;
  color: #fff;
  border: 1px solid #ff00ff;
  border-radius: 0;
  padding: 8px 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
}

#search-container button:hover {
  background: #00ffff;
  border-color: #00ffff;
  color: #0c0c1d;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Added glitching neon strip to header top - pink to blue with strong glow */
body:before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 8px; /* Increased height */
  background: linear-gradient(to right,
    #ff00ff 0%,
    #00ffff 100%
  );
  opacity: 0.9; /* Slightly higher opacity */
  z-index: 9999;
  animation: neonGlitch 4s infinite;
  /* Added strong glow effect */
  box-shadow: 
    0 0 10px 2px rgba(255, 0, 255, 0.7),
    0 0 20px 5px rgba(0, 255, 255, 0.5);
}

/* Glitching neon animation - pink to blue with enhanced effects */
@keyframes neonGlitch {
  0% {
    opacity: 0.9;
    background: linear-gradient(to right, #ff00ff 0%, #00ffff 100%);
    transform: scaleX(1);
    box-shadow: 
      0 0 10px 2px rgba(255, 0, 255, 0.7),
      0 0 20px 5px rgba(0, 255, 255, 0.5);
  }
  5% {
    opacity: 1;
    background: linear-gradient(to right, #00ffff 0%, #ff00ff 100%);
    transform: scaleX(1.02);
    box-shadow: 
      0 0 15px 3px rgba(0, 255, 255, 0.8),
      0 0 25px 7px rgba(255, 0, 255, 0.6);
  }
  10% {
    opacity: 0.9;
    background: linear-gradient(to right, #ff00ff 0%, #00ffff 100%);
    transform: scaleX(0.98);
    box-shadow: 
      0 0 10px 2px rgba(255, 0, 255, 0.7),
      0 0 20px 5px rgba(0, 255, 255, 0.5);
  }
  15% {
    opacity: 0.95;
    background: linear-gradient(to right, #00ffff 0%, #ff00ff 100%);
    transform: scaleX(1);
    box-shadow: 
      0 0 12px 3px rgba(0, 255, 255, 0.7),
      0 0 22px 6px rgba(255, 0, 255, 0.5);
  }
  20% {
    opacity: 1;
    background: linear-gradient(to right, #ff00ff 0%, #00ffff 100%);
    box-shadow: 
      0 0 15px 3px rgba(255, 0, 255, 0.8),
      0 0 25px 7px rgba(0, 255, 255, 0.6);
  }
  25% {
    opacity: 0.9;
    background: linear-gradient(to right, #00ffff 0%, #ff00ff 100%);
    box-shadow: 
      0 0 10px 2px rgba(0, 255, 255, 0.7),
      0 0 20px 5px rgba(255, 0, 255, 0.5);
  }
  30% {
    background: linear-gradient(to right, #ff00ff 0%, #00ffff 100%);
    box-shadow: 
      0 0 12px 3px rgba(255, 0, 255, 0.7),
      0 0 22px 6px rgba(0, 255, 255, 0.5);
  }
  80% {
    background: linear-gradient(to right, #ff00ff 0%, #00ffff 100%);
    opacity: 0.9;
    box-shadow: 
      0 0 10px 2px rgba(255, 0, 255, 0.7),
      0 0 20px 5px rgba(0, 255, 255, 0.5);
  }
  82% {
    opacity: 0.4;
    box-shadow: 
      0 0 5px 1px rgba(255, 0, 255, 0.3),
      0 0 10px 2px rgba(0, 255, 255, 0.2);
  }
  84% {
    opacity: 0.9;
    box-shadow: 
      0 0 15px 3px rgba(255, 0, 255, 0.8),
      0 0 25px 7px rgba(0, 255, 255, 0.6);
  }
  86% {
    opacity: 0.2;
    box-shadow: 
      0 0 3px 1px rgba(255, 0, 255, 0.2),
      0 0 5px 2px rgba(0, 255, 255, 0.1);
  }
  88% {
    opacity: 0.8;
    box-shadow: 
      0 0 12px 3px rgba(255, 0, 255, 0.7),
      0 0 22px 6px rgba(0, 255, 255, 0.5);
  }
  90% {
    background: linear-gradient(to right, #00ffff 0%, #ff00ff 100%);
    opacity: 1;
    box-shadow: 
      0 0 15px 3px rgba(0, 255, 255, 0.8),
      0 0 25px 7px rgba(255, 0, 255, 0.6);
  }
  100% {
    background: linear-gradient(to right, #ff00ff 0%, #00ffff 100%);
    opacity: 0.9;
    box-shadow: 
      0 0 10px 2px rgba(255, 0, 255, 0.7),
      0 0 20px 5px rgba(0, 255, 255, 0.5);
  }
}

/* IMPROVED MOBILE STYLES */

/* Large Desktop optimization */
@media (min-width: 1200px) {
  .header-content {
    padding: 0 20px;
  }
  
  .console-nav ul {
    gap: 30px;
  }
  
  .console-nav a {
    font-size: 0.5rem;
  }
}

/* Desktop optimization */
@media (min-width: 992px) and (max-width: 1199px) {
  .console-nav ul {
    gap: 20px;
  }
}

/* Tablet & Mobile Style Improvements */
@media (max-width: 991px) {
  .header-content {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }
  
  .site-logo {
    flex: 0 0 100%;
    text-align: center;
    margin-bottom: 15px;
  }
  
  .header-tools {
    flex: 0 0 auto;
    margin: 5px 0;
    order: 3;
  }
  
  .console-nav {
    flex: 0 0 100%;
    order: 2;
    margin: 10px 0;
    justify-content: center;
  }
  
  /* Keep logo size more substantial on tablets */
  .site-logo img {
    height: 90px;
    margin: 0 auto;
  }
  
  /* Improve menu center alignment */
  .console-nav ul {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  /* Make navigation more prominent */
  .console-nav a {
    font-size: 0.5rem;
    padding: 8px 10px;
    margin-bottom: 5px;
  }
  
  /* Ensure retro basket maintains style */
  .retro-cart-container {
    padding: 6px 14px;
    font-size: 10px;
  }
  
  .retro-cart-container i {
    font-size: 14px;
  }
  
  #retro-cart #cart-count-display {
    font-size: 9px;
    min-width: 16px;
    height: 16px;
  }
}