/* ==========================================================================
   ADSTERRA & ADSENSE SMART ZERO-EMPTY-SLOT MONETIZATION ENGINE
   - Rule 1: NO AD CODE = NO DISPLAY (Container is 100% collapsed, 0 height)
   - Rule 2: ZERO CLS (Cumulative Layout Shift) when ads fill
   - Rule 3: High Viewability, User-Friendly & Non-Intrusive Layout
   ========================================================================== */

/* 1. All ad containers are completely HIDDEN by default */
.ad-container,
.ad-container-feed,
.ad-slot-header,
.ad-slot-content,
.ad-slot-native,
.ad-slot-article,
.ad-slot-multiplex,
.ad-slot-infeed {
  display: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

/* 2. ONLY when valid ad code is injected, ad-loader adds .ad-loaded */
.ad-container.ad-loaded {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1.5rem auto;
  width: 100%;
  text-align: center;
  position: relative;
  animation: adFadeIn 0.25s ease-in;
}

@keyframes adFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Minimalist, unobtrusive label */
.ad-container.ad-loaded .ad-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.35rem;
  user-select: none;
}

/* Header Slot (Responsive / 728x90 Desktop / 320x50 Mobile) */
.ad-container.ad-loaded .ad-slot-header {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  max-width: 728px;
  width: 100%;
}

@media (max-width: 768px) {
  .ad-container.ad-loaded .ad-slot-header {
    min-height: 50px;
    max-width: 320px;
  }
}

/* Pre-Download / In-Content Golden Slot (300x250 Medium Rectangle or Native) */
.ad-container.ad-loaded .ad-slot-content,
.ad-container.ad-loaded .ad-slot-native {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  max-width: 336px;
  width: 100%;
  margin: 1rem auto;
}

/* In-Feed Catalog Card Slot */
.ad-container-feed.ad-loaded {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  padding: 1.25rem;
  min-height: 180px;
  grid-column: 1 / -1;
  margin: 1rem 0;
}
.ad-container-feed.ad-loaded .ad-slot-infeed {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* In-Article & Multiplex Grid Recommendation Slot */
.ad-container.ad-loaded .ad-slot-article,
.ad-container.ad-loaded .ad-slot-multiplex {
  display: block;
  width: 100%;
  max-width: 800px;
  margin: 1.5rem auto;
  min-height: 120px;
}

/* Social Bar Container */
#ad-social-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  pointer-events: auto;
}

/* Admin Whitelist Protection - Hide all ads completely when admin is logged in */
body.admin-logged-in .ad-container,
body.admin-logged-in .ad-container-feed,
body.admin-logged-in #ad-social-bar {
  display: none !important;
}
