/* ============================================
   AD SYSTEM STYLING
   Placeholders, ad slots, responsive design
   ============================================ */

/* ===========================
   AD SLOTS (Containers)
   =========================== */

.ad-slot {
  width: 100%;
  margin: 2rem auto;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 10;
}

/* Header Ad Slot */
.ad-slot[data-ad-position="header"] {
  margin: 1.5rem auto;
  max-width: 728px;
}

/* Sidebar Ad Slots */
.ad-slot[data-ad-position^="sidebar"] {
  margin: 1rem 0;
  position: sticky;
  top: 100px; /* Sticky behavior */
}

/* In-Content Ad Slots */
.ad-slot[data-ad-position^="in-content"] {
  margin: 3rem auto;
  max-width: 300px;
}

/* Between Articles (Blog page) */
.ad-slot[data-ad-position="between-articles"] {
  margin: 2rem auto;
  max-width: 300px;
}

/* Mobile Sticky Ads */
.ad-slot[data-ad-position="mobile-sticky-top"] {
  position: fixed;
  top: 60px; /* Below nav */
  left: 0;
  right: 0;
  z-index: 999;
  margin: 0;
  background: rgba(11, 11, 15, 0.95);
  backdrop-filter: blur(10px);
  padding: 0.5rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.ad-slot[data-ad-position="mobile-sticky-bottom"] {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  margin: 0;
  background: rgba(11, 11, 15, 0.95);
  backdrop-filter: blur(10px);
  padding: 0.5rem 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

/* Footer Ad Slot */
.ad-slot[data-ad-position="footer"] {
  margin: 2rem auto;
  padding: 2rem 0;
}

/* ===========================
   AD UNIT (Actual ad content)
   =========================== */

.ad-unit {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  transition: all 0.3s ease;
}

/* Hover effect for clickable ads */
.ad-unit.clickable {
  cursor: pointer;
}

.ad-unit.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* ===========================
   PLACEHOLDER STYLING
   (For testing before real ads)
   =========================== */

.ad-placeholder {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 50px;
  position: relative;
  overflow: hidden;
}

/* Placeholder animation */
.ad-placeholder::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

/* Placeholder content */
.ad-placeholder-emoji {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  z-index: 1;
}

.ad-placeholder-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  opacity: 0.9;
  z-index: 1;
}

.ad-placeholder-size {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  z-index: 1;
}

.ad-placeholder-name {
  font-size: 0.625rem;
  opacity: 0.7;
  font-weight: 400;
  z-index: 1;
}

/* ===========================
   SPECIFIC AD SIZES
   =========================== */

/* Desktop Leaderboard 728x90 */
.ad-unit[data-size="728x90"],
.ad-placeholder[data-size="728x90"] {
  width: 728px;
  height: 90px;
  max-width: 100%;
}

/* Medium Rectangle 300x250 */
.ad-unit[data-size="300x250"],
.ad-placeholder[data-size="300x250"] {
  width: 300px;
  height: 250px;
  max-width: 100%;
}

/* Half Page 300x600 */
.ad-unit[data-size="300x600"],
.ad-placeholder[data-size="300x600"] {
  width: 300px;
  height: 600px;
  max-width: 100%;
}

/* Billboard 970x250 */
.ad-unit[data-size="970x250"],
.ad-placeholder[data-size="970x250"] {
  width: 970px;
  height: 250px;
  max-width: 100%;
}

/* Large Rectangle 336x280 */
.ad-unit[data-size="336x280"],
.ad-placeholder[data-size="336x280"] {
  width: 336px;
  height: 280px;
  max-width: 100%;
}

/* Mobile Leaderboard 320x50 */
.ad-unit[data-size="320x50"],
.ad-placeholder[data-size="320x50"] {
  width: 320px;
  height: 50px;
  max-width: 100%;
}

/* Large Mobile Banner 320x100 */
.ad-unit[data-size="320x100"],
.ad-placeholder[data-size="320x100"] {
  width: 320px;
  height: 100px;
  max-width: 100%;
}

/* Wide Skyscraper 160x600 */
.ad-unit[data-size="160x600"],
.ad-placeholder[data-size="160x600"] {
  width: 160px;
  height: 600px;
  max-width: 100%;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

/* Mobile (<= 768px) */
@media (max-width: 768px) {
  /* Hide desktop-only ads */
  .ad-slot[data-device="desktop-only"],
  .ad-slot[data-ad-position^="sidebar"] {
    display: none !important;
  }
  
  /* Smaller padding for mobile */
  .ad-slot {
    margin: 1.5rem auto;
  }
  
  .ad-slot[data-ad-position^="in-content"] {
    margin: 2rem auto;
  }
  
  /* Mobile ads scale down if needed */
  .ad-unit,
  .ad-placeholder {
    max-width: calc(100vw - 2rem);
  }
  
  /* Smaller placeholder text on mobile */
  .ad-placeholder-emoji {
    font-size: 1.5rem;
  }
  
  .ad-placeholder-size {
    font-size: 1rem;
  }
  
  .ad-placeholder-label {
    font-size: 0.625rem;
  }
}

/* Tablet (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Hide mobile-only ads */
  .ad-slot[data-device="mobile-only"],
  .ad-slot[data-ad-position^="mobile-sticky"] {
    display: none !important;
  }
  
  /* Sidebar ads smaller on tablet */
  .ad-slot[data-ad-position^="sidebar"] {
    max-width: 250px;
  }
}

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
  /* Hide mobile-only ads */
  .ad-slot[data-device="mobile-only"],
  .ad-slot[data-ad-position^="mobile-sticky"] {
    display: none !important;
  }
}

/* ===========================
   ADSENSE INTEGRATION
   (For future real ads)
   =========================== */

.ad-unit.adsense {
  background: transparent;
  border: none;
}

.ad-unit.adsense ins {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===========================
   LAZY LOADING
   =========================== */

.ad-slot[data-lazy="true"] {
  min-height: 50px; /* Prevent layout shift */
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

.ad-slot[data-lazy="true"].ad-loading {
  position: relative;
}

.ad-slot[data-lazy="true"].ad-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* ===========================
   ACCESSIBILITY
   =========================== */

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

/* Skip link for screen readers */
.ad-skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.ad-skip-link:focus {
  position: static;
  width: auto;
  height: auto;
}

/* ===========================
   PERFORMANCE
   =========================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .ad-placeholder::before {
    animation: none;
  }
  
  .ad-unit {
    transition: none;
  }
  
  .ad-slot[data-lazy="true"].ad-loading::after {
    animation: none;
  }
}

/* ===========================
   DARK MODE (Optional)
   =========================== */

@media (prefers-color-scheme: dark) {
  .ad-placeholder {
    /* Already dark by default */
  }
}

/* ===========================
   PRINT (Hide ads when printing)
   =========================== */

@media print {
  .ad-slot,
  .ad-unit,
  .ad-placeholder {
    display: none !important;
  }
}
