/**
 * Dynamic Ad Banner System Styles
 * Unlimited Agency / Government Banner Placements
 */

/* DEVICE TARGETING UTILITIES */
@media (max-width: 768px) {
  .portal-ad-desktop-only {
    display: none !important;
  }
}
@media (min-width: 769px) {
  .portal-ad-mobile-only {
    display: none !important;
  }
}

/* GENERAL AD WRAPPER */
.ad-slot-wrapper {
  margin: 16px 0;
  text-align: center;
  position: relative;
  clear: both;
}
.ad-slot-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-light, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.ad-banner-link {
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  transition: opacity 0.2s ease;
}
.ad-banner-link:hover {
  opacity: 0.95;
}
.ad-banner-link img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm, 4px);
  margin: 0 auto;
}

/* 1. Header Leaderboard Slot */
.ad-slot-header-leaderboard {
  margin: 0;
}
.ad-slot-header-leaderboard .ad-banner-link img {
  max-height: 90px;
  width: auto;
}
@media (max-width: 768px) {
  .ad-slot-header-leaderboard {
    display: none; /* Hide on mobile header to keep header compact */
  }
}

/* 2. Below Navigation (Full Width) */
.ad-slot-below-nav {
  margin: 14px 0 20px;
}
.ad-slot-below-nav .ad-banner-link img {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
}

/* 3. Above & Below Headline */
.ad-slot-above-headline {
  margin-bottom: 20px;
}
.ad-slot-below-headline {
  margin: 20px 0 25px;
}

/* 4. In-Feed Ads */
.ad-slot-in-feed {
  background: var(--card-bg, #ffffff);
  border: 1px dashed var(--card-border, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  padding: 12px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.06));
}
.ad-slot-in-feed .ad-banner-link img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}

/* 5. Sidebar Slots */
.ad-slot-sidebar-top,
.ad-slot-sidebar-middle {
  margin-bottom: 22px;
}
.ad-slot-sidebar-bottom-sticky {
  position: -webkit-sticky;
  position: sticky;
  top: 70px;
  z-index: 100;
  margin-bottom: 22px;
}
.ad-slot-sidebar .ad-banner-link img {
  width: 100%;
  max-width: 336px;
  height: auto;
}

/* 6. In-Article Ads (Single Post) */
.ad-slot-article-top {
  margin-bottom: 20px;
}
.ad-slot-article-middle {
  margin: 25px 0;
  padding: 14px 0;
  border-top: 1px dashed var(--card-border, #e2e8f0);
  border-bottom: 1px dashed var(--card-border, #e2e8f0);
}
.ad-slot-article-bottom {
  margin-top: 25px;
}

/* DISPLAY MODES: Stacking, Grid 2-Kolom, Slider */

/* Mode: Tumpuk (Stacking - default vertical flow) */
.ad-display-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

/* Mode: Grid 2-Kolom */
.ad-display-grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  align-items: center;
}
@media (max-width: 640px) {
  .ad-display-grid2 {
    grid-template-columns: 1fr;
  }
}

/* Mode: Slider / Rotasi Otomatis */
.ad-display-slider {
  position: relative;
  overflow: hidden;
  width: 100%;
}
.ad-slider-container {
  position: relative;
  width: 100%;
}
.ad-slider-slide {
  display: none;
  width: 100%;
  transition: opacity 0.5s ease;
}
.ad-slider-slide.active {
  display: block;
}
.ad-slider-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}
.ad-slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-light, #cbd5e1);
  cursor: pointer;
  transition: background 0.2s ease;
}
.ad-slider-dot.active {
  background: var(--primary-red, #d82523);
  width: 18px;
  border-radius: 4px;
}

/* 7. FLOATING ADS */

/* Floating Sticky Bottom Bar (Mobile / Universal) */
.ad-floating-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
  z-index: 9990;
  text-align: center;
  padding: 6px 12px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.ad-floating-bottom.dismissed {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}
.ad-floating-bottom-inner {
  position: relative;
  max-width: 728px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-floating-bottom img {
  max-height: 70px;
  width: auto;
  max-width: 100%;
}
.ad-floating-close-btn {
  position: absolute;
  top: -12px;
  right: -10px;
  background: #d82523;
  color: #fff;
  border: 2px solid #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 10;
}
.ad-floating-close-btn:hover {
  background: #000;
}

/* Floating Left & Right Skyscraper (Desktop Gutter) */
.ad-floating-gutter {
  position: fixed;
  top: 140px;
  width: 120px;
  z-index: 900;
  transition: opacity 0.3s ease;
}
.ad-floating-left {
  left: 10px;
}
.ad-floating-right {
  right: 10px;
}
.ad-floating-gutter.dismissed {
  display: none;
}
.ad-floating-gutter img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.ad-gutter-close-btn {
  background: #1e293b;
  color: #fff;
  border: 1px solid #475569;
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  margin-bottom: 4px;
  display: block;
  width: 100%;
  text-align: center;
  border-radius: 3px;
}
.ad-gutter-close-btn:hover {
  background: #d82523;
}
@media (max-width: 1440px) {
  .ad-floating-gutter {
    display: none; /* Hide desktop gutters if screen width is not wide enough */
  }
}
