/* Upgrade Screen - Enhanced Design System */
/* SPACEJAY-148 Phase 4: Upgrade Screen - Ornate stone borders & rich textures */

/* ═══════════════════════════════════════════════════════════════
   UPGRADE SCREEN OVERLAY - Enhanced starfield with nebulae
   ═══════════════════════════════════════════════════════════════ */

#upgrade-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(139, 0, 0, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(75, 0, 130, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0, 100, 150, 0.15) 0%, transparent 60%),
    linear-gradient(135deg, #05070A 0%, #0a0a0a 50%, #05070A 100%);
  background-size: cover;
  background-position: center;
  z-index: 1000;
  font-family: 'Press Start 2P', monospace;
  color: white;
  overflow-y: auto;
  overflow-x: hidden;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  position: relative;
  box-sizing: border-box;
}

/* DENSE starfield - matching main menu */
#upgrade-screen-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1px 1px at 10% 20%, white, transparent),
    radial-gradient(1px 1px at 15% 35%, white, transparent),
    radial-gradient(1px 1px at 20% 50%, white, transparent),
    radial-gradient(1px 1px at 25% 65%, white, transparent),
    radial-gradient(1px 1px at 30% 80%, white, transparent),
    radial-gradient(1px 1px at 35% 15%, white, transparent),
    radial-gradient(1px 1px at 40% 30%, white, transparent),
    radial-gradient(1px 1px at 45% 45%, white, transparent),
    radial-gradient(1px 1px at 50% 60%, white, transparent),
    radial-gradient(1px 1px at 55% 75%, white, transparent),
    radial-gradient(1px 1px at 60% 10%, white, transparent),
    radial-gradient(1px 1px at 65% 25%, white, transparent),
    radial-gradient(1px 1px at 70% 40%, white, transparent),
    radial-gradient(1px 1px at 75% 55%, white, transparent),
    radial-gradient(1px 1px at 80% 70%, white, transparent),
    radial-gradient(1px 1px at 85% 85%, white, transparent),
    radial-gradient(1px 1px at 90% 5%, white, transparent),
    radial-gradient(1px 1px at 95% 95%, white, transparent),
    radial-gradient(2px 2px at 12% 42%, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 38% 68%, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 62% 22%, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 88% 78%, rgba(255,255,255,0.8), transparent);
  background-size: 
    200% 200%, 200% 200%, 200% 200%, 200% 200%, 200% 200%,
    200% 200%, 200% 200%, 200% 200%, 200% 200%, 200% 200%,
    200% 200%, 200% 200%, 200% 200%, 200% 200%, 200% 200%,
    200% 200%, 200% 200%, 200% 200%, 250% 250%, 250% 250%,
    250% 250%, 250% 250%;
  animation: stars-drift 180s linear infinite;
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

@keyframes stars-drift {
  from { background-position: 0% 0%; }
  to { background-position: 100% 100%; }
}

/* Ensure content is above starfield */
#upgrade-screen-overlay > * {
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════
   UPGRADE CONTAINER
   ═══════════════════════════════════════════════════════════════ */

.upgrade-container {
  max-width: min(900px, 95vw);
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   TITLE
   ═══════════════════════════════════════════════════════════════ */

.upgrade-title {
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #C0C5CC;
  text-shadow: 
    0 0 30px rgba(255, 179, 71, 0.6),
    0 0 60px rgba(255, 179, 71, 0.3),
    0 4px 0 #1A1C20,
    0 8px 0 #05070A,
    2px 2px 4px rgba(0, 0, 0, 0.9);
  text-align: center;
  margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   CURRENCY DISPLAY
   ═══════════════════════════════════════════════════════════════ */

#currency-display {
  font-size: 16px;
  text-align: center;
  margin-bottom: 30px;
  color: #FFB347;
  text-shadow: 
    0 0 15px rgba(255, 179, 71, 0.8),
    2px 2px 4px rgba(0, 0, 0, 0.9);
  letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   UPGRADES GRID
   ═══════════════════════════════════════════════════════════════ */

.upgrades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

/* ═══════════════════════════════════════════════════════════════
   UPGRADE CARD - Ornate Panel Design
   ═══════════════════════════════════════════════════════════════ */

.upgrade-card {
  position: relative;
  padding: 60px 30px 50px 30px;
  box-sizing: border-box;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}

/* Panel frame background */
.upgrade-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../../assets/menus/panel-frame2-clean.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  image-rendering: auto;
  z-index: -1;
  transition: filter 0.3s ease;
}

/* Ensure content is above the frame */
.upgrade-card > * {
  position: relative;
  z-index: 1;
}

/* Hover state */
.upgrade-card:hover::before {
  filter: brightness(1.1);
}

.upgrade-card:hover {
  transform: translateY(-3px);
}

/* Special card (AI Companion) */
.upgrade-card.special {
  animation: specialPulse 2s ease-in-out infinite;
}

.upgrade-card.special::before {
  filter: brightness(1.15);
}

@keyframes specialPulse {
  0%, 100% { 
    filter: brightness(1.15);
  }
  50% { 
    filter: brightness(1.25);
  }
}

/* Special badge */
.upgrade-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(68, 136, 255, 0.2);
  color: #4488ff;
  padding: 4px 12px;
  font-size: 8px;
  font-weight: bold;
  border-radius: 10px;
  border: 2px solid #4488ff;
  box-shadow: none;
  letter-spacing: 1px;
  z-index: 10;
  text-shadow: 0 0 10px rgba(68, 136, 255, 0.8);
}

/* ═══════════════════════════════════════════════════════════════
   UPGRADE CARD CONTENT
   ═══════════════════════════════════════════════════════════════ */

.upgrade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.upgrade-name {
  font-size: 12px;
  color: #8A8F96;
  text-shadow: 2px 2px 4px #000;
  letter-spacing: 1px;
}

.upgrade-name.special {
  font-size: 14px;
  color: #4488ff;
  text-shadow: 
    0 0 20px rgba(68, 136, 255, 0.8),
    2px 2px 4px #000;
  font-weight: bold;
}

.upgrade-name.maxed {
  color: #FFB347;
  text-shadow: 
    0 0 15px rgba(255, 179, 71, 0.8),
    2px 2px 4px #000;
}

.upgrade-level {
  font-size: 11px;
  color: #8A8F96;
  text-shadow: 2px 2px 4px #000;
}

.upgrade-level.special {
  color: #4488ff;
}

.upgrade-level.maxed {
  color: #FFB347;
}

.upgrade-description {
  font-size: 8px;
  margin-bottom: 15px;
  line-height: 1.5;
  color: #8A8F96;
  text-shadow: 2px 2px 4px #000;
}

.upgrade-description.special {
  color: #aaccff;
}

.upgrade-maxed {
  font-size: 9px;
  text-align: center;
  padding: 10px;
  color: #FFB347;
  text-shadow: 
    0 0 15px rgba(255, 179, 71, 0.8),
    2px 2px 4px #000;
  letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   UPGRADE BUTTONS - Unified Button System
   ═══════════════════════════════════════════════════════════════ */

.upgrade-buy-button {
  position: relative;
  padding: 10px 15px;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  width: 100%;
  min-height: 50px;
  image-rendering: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #8A8F96;
  text-shadow: 
    0 0 8px rgba(138, 143, 150, 0.4),
    2px 2px 4px rgba(0, 0, 0, 0.8);
  font-family: 'Press Start 2P', monospace;
}

/* Special button (AI Companion) */
.upgrade-buy-button.special {
  font-size: 10px;
  font-weight: bold;
}

/* Disabled state */
.upgrade-buy-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Default state - Neutral button background */
.upgrade-buy-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../../assets/menus/button-neutral-clean.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  z-index: -1;
  width: 100%;
  height: 100%;
  transition: opacity 0.3s ease;
}

/* Cyan button overlay (hidden by default) */
.upgrade-buy-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../../assets/menus/button-cyan-clean.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Hover state - Show cyan button and change text color */
.upgrade-buy-button:not(:disabled):hover {
  color: #00D4FF;
  text-shadow: 
    0 0 15px rgba(0, 212, 255, 1),
    0 0 30px rgba(0, 212, 255, 0.6),
    2px 2px 4px rgba(0, 0, 0, 0.8);
  transform: translateY(-2px);
}

.upgrade-buy-button:not(:disabled):hover::after {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   CONTINUE BUTTON
   ═══════════════════════════════════════════════════════════════ */

.upgrade-continue-button {
  position: relative;
  padding: 16px 50px;
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  min-width: 300px;
  min-height: 70px;
  image-rendering: auto;
  display: block;
  margin: 0 auto;
  background: transparent;
  color: #8A8F96;
  text-shadow: 
    0 0 8px rgba(138, 143, 150, 0.4),
    2px 2px 4px rgba(0, 0, 0, 0.8);
  font-family: 'Press Start 2P', monospace;
}

/* Default state - Neutral button background */
.upgrade-continue-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../../assets/menus/button-neutral-clean.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  z-index: -1;
  width: 100%;
  height: 100%;
  transition: opacity 0.3s ease;
}

/* Cyan button overlay (hidden by default) */
.upgrade-continue-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../../assets/menus/button-cyan-clean.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Hover state - Show cyan button and change text color */
.upgrade-continue-button:hover {
  color: #00D4FF;
  text-shadow: 
    0 0 15px rgba(0, 212, 255, 1),
    0 0 30px rgba(0, 212, 255, 0.6),
    2px 2px 4px rgba(0, 0, 0, 0.8);
  transform: translateY(-2px);
}

.upgrade-continue-button:hover::after {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .upgrades-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .upgrade-title {
    font-size: 1rem;
  }
  
  .upgrade-continue-button {
    min-width: 250px;
  }
  
  #upgrade-screen-overlay {
    padding: 30px 15px;
  }
}

@media (max-width: 480px) {
  .upgrade-card {
    padding: 50px 25px 45px 25px;
  }
  
  .upgrade-title {
    font-size: 0.9rem;
    letter-spacing: 2px;
  }
  
  #currency-display {
    font-size: 14px;
    margin-bottom: 20px;
  }
  
  .upgrade-continue-button {
    min-width: 200px;
    min-height: 60px;
    font-size: 0.8rem;
  }
  
  .upgrade-buy-button {
    min-height: 45px;
    font-size: 8px;
  }
}

@media (max-height: 700px) {
  #upgrade-screen-overlay {
    padding: 20px 15px;
  }
  
  .upgrade-title {
    font-size: 1rem;
    margin-bottom: 15px;
  }
  
  #currency-display {
    margin-bottom: 20px;
  }
  
  .upgrades-grid {
    gap: 15px;
    margin-bottom: 20px;
  }
  
  .upgrade-card {
    padding: 50px 25px 45px 25px;
  }
  
  .upgrade-continue-button {
    min-height: 60px;
  }
}
