/* AstroGames Ad Slots - Early 2000s Web Styling */

/* Ad Container Base Styling - FORCE DISPLAY */
.ad-container {
  display: block !important;
  visibility: visible !important;
  width: 100% !important;
  text-align: center !important;
  padding: 16px !important;
  background: #E8E8E8 !important;
  border: 2px solid #FF0000 !important; /* Red border for debugging */
  margin: 20px 0 !important;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.1) !important;
  min-height: 50px !important;
  position: relative !important;
  z-index: 999 !important;
}

/* Ad Placeholder Styling - FORCE DISPLAY */
.ad-placeholder {
  background: #FFFFFF !important;
  border: 2px solid #00FF00 !important; /* Green border for debugging */
  display: inline-block !important;
  visibility: visible !important;
  text-align: center !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 14px !important;
  font-weight: bold !important;
  color: #FF0000 !important;
  margin: 0 auto !important;
  position: relative !important;
  overflow: visible !important;
  padding: 16px !important;
  min-width: 200px !important;
  min-height: 50px !important;
  z-index: 1000 !important;
}

.ad-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: none;
  pointer-events: none;
}

.ad-placeholder span {
  position: relative;
  z-index: 1;
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Header Banner Ad (728x90) */
.header-ad {
  background: var(--bg-secondary);
  border-bottom: var(--border-width) solid var(--border-color);
  margin: 0;
  padding: var(--space-2);
  border-radius: 0;
  box-shadow: 0 1px 2px var(--shadow-light);
}

.header-ad .ad-placeholder {
  width: 728px;
  height: 90px;
  max-width: 100%;
  border: var(--border-width) solid var(--border-dark);
  background: linear-gradient(180deg, #FFFFFF 0%, #F0F0F0 100%);
}

/* Sidebar Rectangle Ad (300x250) */
.sidebar-ad {
  background: var(--bg-secondary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-3);
  margin: var(--space-4) 0;
  box-shadow: var(--shadow-simple) var(--shadow-light);
}

.sidebar-ad .ad-placeholder {
  width: 300px;
  height: 250px;
  max-width: 100%;
  border: var(--border-width) solid var(--border-dark);
  background: linear-gradient(135deg, #FFFFFF 0%, #F5F5F5 100%);
}

/* Footer Banner Ad (728x90) */
.footer-ad {
  background: var(--bg-secondary);
  border-top: var(--border-width) solid var(--border-color);
  margin: 0;
  padding: var(--space-3);
  border-radius: 0;
  box-shadow: 0 -1px 2px var(--shadow-light);
}

.footer-ad .ad-placeholder {
  width: 728px;
  height: 90px;
  max-width: 100%;
  border: var(--border-width) solid var(--border-dark);
  background: linear-gradient(180deg, #F0F0F0 0%, #FFFFFF 100%);
}

/* In-Content Ad Styling */
.content-ad {
  background: var(--bg-tertiary);
  border: var(--border-width) solid var(--border-light);
  border-radius: var(--border-radius);
  padding: var(--space-3);
  margin: var(--space-5) 0;
  text-align: center;
  box-shadow: var(--shadow-simple) var(--shadow-light);
}

.content-ad .ad-placeholder {
  width: 300px;
  height: 250px;
  max-width: 100%;
  border: var(--border-width) solid var(--border-color);
  background: linear-gradient(135deg, #FFFFFF 0%, #F8F8F8 100%);
}

/* Game Page Ad Styling */
.game-page-ad {
  background: var(--bg-secondary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-3);
  margin: var(--space-4) 0;
  box-shadow: var(--shadow-simple) var(--shadow-light);
}

.game-page-ad .ad-placeholder {
  border: var(--border-width) solid var(--border-dark);
  background: linear-gradient(135deg, #FFFFFF 0%, #F5F5F5 100%);
}

/* Sticky Sidebar Ad */
.sticky-sidebar-ad {
  position: sticky;
  top: var(--space-4);
  z-index: var(--z-overlay);
}

/* Ad Loading States */
.ad-placeholder.loading {
  background: linear-gradient(90deg, #F0F0F0 25%, #E0E0E0 50%, #F0F0F0 75%);
  background-size: 200% 100%;
  animation: adLoading 1.5s infinite;
}

@keyframes adLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ad-placeholder.error {
  background: #FFE6E6;
  border-color: var(--color-error);
  color: var(--color-error);
}

.ad-placeholder.error span {
  font-size: var(--text-xs);
}

/* Ad Size Variants */
.ad-placeholder[data-ad-size="728x90"] {
  width: 728px;
  height: 90px;
}

.ad-placeholder[data-ad-size="300x250"] {
  width: 300px;
  height: 250px;
}

.ad-placeholder[data-ad-size="320x50"] {
  width: 320px;
  height: 50px;
}

.ad-placeholder[data-ad-size="300x600"] {
  width: 300px;
  height: 600px;
}

.ad-placeholder[data-ad-size="160x600"] {
  width: 160px;
  height: 600px;
}

/* Mobile-Specific Ad Sizes */
.ad-placeholder[data-ad-size="320x50"] {
  width: 320px;
  height: 50px;
}

.ad-placeholder[data-ad-size="300x100"] {
  width: 300px;
  height: 100px;
}

.ad-placeholder[data-ad-size="320x100"] {
  width: 320px;
  height: 100px;
}

.ad-placeholder[data-ad-size="250x250"] {
  width: 250px;
  height: 250px;
}

/* Responsive Ad Behavior */
@media (max-width: 768px) {
  /* Header and Footer Ads - Mobile Banner (320x50) */
  .header-ad .ad-placeholder[data-ad-size="728x90"],
  .footer-ad .ad-placeholder[data-ad-size="728x90"] {
    width: 100%;
    max-width: 320px;
    height: 50px;
  }
  
  /* Alternative mobile banner size */
  .header-ad .ad-placeholder[data-ad-size="320x50"],
  .footer-ad .ad-placeholder[data-ad-size="320x50"] {
    width: 100%;
    max-width: 320px;
    height: 50px;
  }
  
  /* Sidebar Ads - Mobile Rectangle (300x250 or smaller) */
  .sidebar-ad .ad-placeholder[data-ad-size="300x250"] {
    width: 100%;
    max-width: 300px;
    height: 200px;
  }
  
  /* Mobile-specific sidebar ad size */
  .sidebar-ad .ad-placeholder[data-ad-size="250x250"] {
    width: 100%;
    max-width: 250px;
    height: 200px;
  }
  
  /* Content Ads - Mobile */
  .content-ad .ad-placeholder {
    width: 100%;
    max-width: 300px;
    height: 200px;
  }
  
  /* In-game ads for mobile */
  .game-page-ad .ad-placeholder {
    width: 100%;
    max-width: 320px;
    height: 100px;
  }
  
  /* Between games ads - mobile banner */
  .between-games-ad .ad-placeholder {
    width: 100%;
    max-width: 320px;
    height: 50px;
  }
  
  /* Mobile sticky ads */
  .mobile-sticky-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #FFFFFF;
    border-top: 1px solid #CCCCCC;
    padding: var(--space-2);
    text-align: center;
  }
  
  .mobile-sticky-ad .ad-placeholder {
    width: 100%;
    max-width: 320px;
    height: 50px;
    margin: 0 auto;
  }
  
  /* Close button for sticky ads */
  .mobile-sticky-ad .close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #E0E0E0;
    border: 1px outset #CCCCCC;
    width: 20px;
    height: 20px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
  }
  
  .mobile-sticky-ad .close-btn:hover {
    background: #D0D0D0;
  }
  
  .mobile-sticky-ad .close-btn:active {
    border: 1px inset #CCCCCC;
  }
  
  /* Adjust container padding for mobile */
  .ad-container {
    padding: var(--space-2);
    margin: var(--space-3) 0;
  }
  
  .header-ad,
  .footer-ad {
    padding: var(--space-2);
  }
  
  /* Mobile ad loading optimization */
  .ad-placeholder.mobile-optimized {
    background: linear-gradient(135deg, #F8F8F8 0%, #F0F0F0 100%);
    border: 1px solid #E0E0E0;
  }
  
  /* Touch-friendly ad interaction */
  .ad-placeholder:active {
    background: #E8E8E8;
    border-color: #CCCCCC;
  }
}

@media (max-width: 480px) {
  /* Extra small mobile adjustments */
  .header-ad .ad-placeholder[data-ad-size="728x90"],
  .footer-ad .ad-placeholder[data-ad-size="728x90"] {
    max-width: 280px;
    height: 50px;
  }
  
  .sidebar-ad .ad-placeholder[data-ad-size="300x250"],
  .content-ad .ad-placeholder {
    max-width: 280px;
    height: 180px;
  }
  
  .ad-container {
    padding: var(--space-1);
    margin: var(--space-2) 0;
  }
}

/* Ad Integration with Game Grid */
.games-grid .ad-slot {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin: var(--space-4) 0;
}

.games-grid .ad-slot .ad-container {
  margin: 0;
  width: 100%;
  max-width: 728px;
}

/* Between Game Rows Ad */
.between-games-ad {
  background: var(--bg-tertiary);
  border: var(--border-width) solid var(--border-light);
  border-radius: var(--border-radius);
  padding: var(--space-2);
  margin: var(--space-4) 0;
  text-align: center;
}

.between-games-ad .ad-placeholder {
  width: 728px;
  height: 90px;
  max-width: 100%;
  border: var(--border-width) solid var(--border-color);
  background: linear-gradient(180deg, #FFFFFF 0%, #F8F8F8 100%);
}

/* Ad Hover Effects - Subtle Early 2000s Style */
.ad-placeholder:hover {
  border-color: var(--color-secondary);
  box-shadow: inset 0 1px 3px var(--shadow-medium);
  transition: all var(--transition-fast) ease;
}

/* Print Styles - Hide Ads */
@media print {
  .ad-container,
  .ad-placeholder,
  .header-ad,
  .sidebar-ad,
  .footer-ad,
  .content-ad,
  .game-page-ad,
  .between-games-ad {
    display: none !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .ad-placeholder {
    background: #FFFFFF;
    border-color: #000000;
    color: #000000;
  }
  
  .ad-container {
    background: #FFFFFF;
    border-color: #000000;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .ad-placeholder.loading {
    animation: none;
    background: #F0F0F0;
  }
  
  .ad-placeholder:hover {
    transition: none;
  }
}

/* Ad Accessibility */
.ad-placeholder[aria-label] {
  position: relative;
}

.ad-placeholder[aria-label]::after {
  content: attr(aria-label);
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Ad Performance Optimization */
.ad-placeholder[data-lazy="true"] {
  background: #F5F5F5;
  min-height: 50px;
}

.ad-placeholder[data-lazy="true"].loaded {
  background: linear-gradient(135deg, #FFFFFF 0%, #F8F8F8 100%);
}

/* Ad Viewability Tracking */
.ad-placeholder[data-viewable="true"] {
  border-color: var(--color-success);
}

.ad-placeholder[data-viewable="false"] {
  opacity: 0.8;
}

/* Ad Refresh Indicator */
.ad-placeholder.refreshing {
  opacity: 0.7;
  transition: opacity var(--transition-fast) ease;
}

.ad-placeholder.refreshing::before {
  animation: adLoading 1s infinite;
}

/* Ad Format Specific Sizing - CRITICAL FOR DISPLAY */
.ad-placeholder[data-ad-size="728x90"] {
  width: 728px !important;
  height: 90px !important;
  line-height: 90px !important;
}

.ad-placeholder[data-ad-size="300x250"] {
  width: 300px !important;
  height: 250px !important;
  line-height: 250px !important;
}

.ad-placeholder[data-ad-size="160x600"] {
  width: 160px !important;
  height: 600px !important;
  line-height: 600px !important;
}

/* Mobile responsive ad sizing */
@media (max-width: 768px) {
  .ad-placeholder[data-ad-size="728x90"] {
    width: 320px !important;
    height: 50px !important;
    line-height: 50px !important;
  }
}