/* Ad Slot Styling */
.ad-slot {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  /* Prevent ad slot rendering from affecting parent layout */
  contain: layout;
}

/* Ad content container for proper layout */
.ad-content {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* ADVERTISEMENT Chip */
.ad-chip {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 11px;
  opacity: 0.7;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 10;
}

/* Header Ad Slot */
.ig-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

#ad-header.ad-slot--header {
  flex: 0 0 auto;
  width: 728px;
  max-width: 40vw;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1024px) {
  #ad-header {
    display: none !important;
  }
}

/* Inline Ad Slots (match card sizing) */
.ad-slot--inline.shop-row {
  /* Inherit all shop-row styling to match Champion/Upgrade cards */
  cursor: default;
  /* Fixed height to prevent panel expansion when ads load or fallback messages appear.
     This matches approximately 3-4 normal shop rows to accommodate ad content while
     preventing layout shifts. */
  height: 250px;
  min-height: 250px;
  max-height: 250px;
  overflow: hidden;
  max-width: 100%;
  /* CSS containment to isolate ad rendering and prevent layout recalculation
     in parent containers. This ensures ad loading doesn't affect surrounding elements. */
  contain: layout style paint;
  /* Flexbox layout for proper centering of ad content */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-slot--inline.shop-row:hover {
  background: rgba(255, 255, 255, 0.03);
  transform: none;
}

/* Ad Fallback Message */
.ad-fallback {
  padding: 20px;
  text-align: center;
  background: rgba(139, 92, 246, 0.08);
  border: 1px dashed rgba(139, 92, 246, 0.25);
  border-radius: 12px;
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.6;
  width: 100%;
  max-width: 100%;
  /* Constrain height to prevent parent expansion */
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  /* Ensure content overflow is hidden if fallback message is too long */
  overflow: hidden;
}

.ad-fallback-title {
  font-weight: 600;
  color: #a78bfa;
  margin-bottom: 4px;
}

/* Neutral ad placeholder (when ad fails but blocker not detected) */
.ad-blank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 90px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-sizing: border-box;
}

/* Friendly Ad-Block Banner */
#adblock-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
  border-bottom: 2px solid rgba(139, 92, 246, 0.3);
  padding: 16px 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: slideDown 0.3s ease-out;
}

#adblock-banner .banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

#adblock-banner .banner-icon {
  font-size: 1.5rem;
}

#adblock-banner .banner-text {
  color: #f3efe2;
  line-height: 1.5;
}

#adblock-banner .banner-title {
  font-weight: 600;
  margin-bottom: 2px;
}

#adblock-banner .banner-message {
  font-size: 0.9rem;
  color: #b9b4a0;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-100%);
    opacity: 0;
  }
}
