/* ==========================================================================
   AD PLACEMENTS & MONETIZATION STYLES (Google AdSense & MGID)
   Optimized for maximum CTR, CPM, RPM, and Google Policy Compliance
   ========================================================================== */

/* Universal Ad Container Wrapper */
.ad-slot-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 24px auto;
  box-sizing: border-box;
  text-align: center;
  position: relative;
  clear: both;
}

/* Subtle, Policy-Compliant Label */
.ad-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  margin-bottom: 6px;
  font-weight: 600;
  display: inline-block;
  user-select: none;
}

/* Ad Box Frame with subtle glass styling */
.ad-slot-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 90px;
  background: rgba(18, 21, 33, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s ease;
}

.ad-slot-box:hover {
  border-color: rgba(245, 158, 11, 0.3);
}

/* Demo / Placeholder Badge (When no live ad is placed yet) */
.ad-placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 20px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.ad-placeholder-content .ad-brand-icon {
  font-size: 18px;
  color: var(--primary-gold, #f59e0b);
}

.ad-placeholder-content .ad-slot-name {
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
}

.ad-placeholder-content .ad-size-hint {
  font-size: 11px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 4px;
}

/* 1. Header Leaderboard Ad (Top Banner) */
.ad-slot-header {
  max-width: 970px;
  margin: 4px auto 16px;
}

.ad-slot-header .ad-slot-box {
  min-height: 90px;
  max-height: 250px;
}

/* 2. In-Article Paragraph Ads (High CTR) */
.ad-slot-inarticle {
  max-width: 100%;
  margin: 28px 0;
  padding: 12px 0;
}

.ad-slot-inarticle .ad-slot-box {
  min-height: 120px;
  background: rgba(18, 21, 33, 0.6);
  border: 1px dashed rgba(245, 158, 11, 0.2);
}

/* 2b. In-Feed Story List Ad (Between Story Articles) */
.ad-slot-infeed {
  max-width: 100%;
  margin: 20px 0;
  box-sizing: border-box;
}

.ad-slot-infeed .ad-slot-box {
  min-height: 110px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04) 0%, rgba(18, 21, 33, 0.75) 100%);
  border: 1px dashed rgba(245, 158, 11, 0.25);
  border-radius: 12px;
}

/* 3. Pre-Pagination / Next Chapter Ad (Goldmine CTR) */
.ad-slot-pre-pagination {
  max-width: 100%;
  margin: 24px 0 16px;
}

.ad-slot-pre-pagination .ad-slot-box {
  min-height: 140px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(18, 21, 33, 0.8) 100%);
  border: 1px dashed rgba(245, 158, 11, 0.3);
}

/* 4. MGID Native Multiplex Widget (Native Grid) */
.ad-slot-mgid-native {
  width: 100%;
  margin: 32px 0 20px;
}

.mgid-native-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 12px;
}

.mgid-native-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-accent, #fbbf24);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mgid-native-grid-placeholder {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.mgid-card-demo {
  background: rgba(18, 21, 33, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
  text-decoration: none;
}

.mgid-card-demo:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.4);
}

.mgid-card-thumb {
  width: 100%;
  aspect-ratio: 16/10;
  background: #1a1e2f;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 20px;
}

.mgid-card-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mgid-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mgid-card-source {
  font-size: 10.5px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 5. Sidebar Sticky Ad (300x250 / 300x600) */
.ad-slot-sidebar-sticky {
  width: 100%;
  margin-top: 20px;
  position: sticky;
  top: 90px;
  z-index: 10;
}

.ad-slot-sidebar-sticky .ad-slot-box {
  min-height: 250px;
  max-height: 600px;
}

/* 6. Sticky Bottom Anchor Bar (Mobile & Desktop) */
.ad-sticky-footer-anchor {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(15, 17, 26, 0.96);
  border-top: 1.5px solid var(--border-gold, rgba(245, 158, 11, 0.4));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.7);
  z-index: 99990;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ad-sticky-footer-anchor.hidden {
  transform: translateY(120%);
  pointer-events: none;
}

.ad-sticky-anchor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 728px;
  padding: 0 4px 4px;
}

.ad-sticky-anchor-label {
  font-size: 9.5px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.ad-sticky-close-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.ad-sticky-close-btn:hover {
  background: #ef4444;
  color: #ffffff;
  transform: scale(1.1);
}

.ad-sticky-anchor-content {
  width: 100%;
  max-width: 728px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Theme Adaptive Contrast Overrides (Sepia & Light) */
.reader-theme-sepia .ad-slot-box {
  background: #f3e5c8 !important;
  border-color: #d8c39e !important;
}

.reader-theme-sepia .ad-label,
.reader-theme-sepia .ad-size-hint {
  color: #854d0e !important;
}

.reader-theme-sepia .ad-placeholder-content .ad-slot-name {
  color: #292015 !important;
}

.reader-theme-sepia .mgid-card-demo {
  background: #fff8eb !important;
  border-color: #d8c39e !important;
}

.reader-theme-sepia .mgid-card-title {
  color: #292015 !important;
}

.reader-theme-sepia .ad-sticky-footer-anchor {
  background: rgba(251, 240, 217, 0.96) !important;
  border-top-color: #b45309 !important;
}

.reader-theme-light .ad-slot-box {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

.reader-theme-light .ad-label,
.reader-theme-light .ad-size-hint {
  color: #64748b !important;
}

.reader-theme-light .ad-placeholder-content .ad-slot-name {
  color: #0f172a !important;
}

.reader-theme-light .mgid-card-demo {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

.reader-theme-light .mgid-card-title {
  color: #0f172a !important;
}

.reader-theme-light .ad-sticky-footer-anchor {
  background: rgba(255, 255, 255, 0.96) !important;
  border-top-color: #f59e0b !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
}

/* Mobile Responsiveness for Ads */
@media (max-width: 768px) {
  .ad-slot-header {
    margin: 12px auto 16px !important;
  }

  .ad-slot-header .ad-slot-box {
    min-height: 60px !important;
  }

  .mgid-native-grid-placeholder {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .ad-sticky-anchor-content {
    min-height: 50px !important;
    max-height: 100px !important;
  }
}
