/**
 * Estilos para o Slideshow GSAP de Publicidades (GML Ads)
 */

.gml-ad-slideshow-container {
  position: relative;
  width: 100%;
}

.gml-ad-slideshow {
  position: relative;
  overflow: hidden;
  margin-inline: auto;
  border-radius: 6px;
}

/* Reset absoluto de alturas forçadas do tema base em todos os dispositivos */
.ad-slot,
.ad-slot--leaderboard,
.ad-slot--inline,
.ad-slot--rectangle,
.lead-grid > .ad-slot,
.article-layout .article-ad,
.result-ad,
.search-sidebar .ad-slot--rectangle {
  min-height: 0 !important;
  background: transparent !important;
}

/* Container de anúncio individual: fluxo natural e adaptação exata */
.ad-slot:not(.gml-ad-slideshow) {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  margin-inline: auto !important;
  background: transparent !important;
}

.ad-slot--leaderboard:not(.gml-ad-slideshow),
.ad-slot--inline:not(.gml-ad-slideshow),
.ad-slot--rectangle:not(.gml-ad-slideshow) {
  max-width: 100% !important;
  width: 100% !important;
}

/* Imagem e Vídeo do anúncio individual: fluxo normal (relative) e altura automática para ditar a altura real */
.ad-slot:not(.gml-ad-slideshow) .gml-ad-media,
.ad-slot:not(.gml-ad-slideshow) img,
.ad-slot:not(.gml-ad-slideshow) video {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  inset: auto !important;
  object-fit: contain !important;
  margin-inline: auto !important;
  background: transparent !important;
  border-radius: 6px !important;
}

/* YouTube em anúncio individual mantém proporção 16/9 */
.ad-slot:not(.gml-ad-slideshow) .gml-ad-youtube {
  position: relative !important;
  width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  height: auto !important;
  inset: auto !important;
  background: transparent !important;
}

/* Texto sobreposto no anúncio individual (não empurra a altura da imagem) */
.ad-slot:not(.gml-ad-slideshow) .ad-copy {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 4 !important;
  max-width: 100% !important;
  padding: 16px 24px !important;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%) !important;
  pointer-events: none !important;
}

.ad-slot:not(.gml-ad-slideshow) .ad-copy a {
  pointer-events: auto !important;
}

.ad-slot:not(.gml-ad-slideshow).is-clean-banner .ad-copy,
.ad-slot.is-clean-banner:after {
  display: none !important;
}

/* Slideshow GSAP com proporção consistente sem cortes */
.ad-slot.gml-ad-slideshow {
  min-height: 0 !important;
  height: auto !important;
  background: transparent !important;
}

.ad-slot--leaderboard.gml-ad-slideshow,
.ad-slot--leaderboard .gml-ad-slides-wrapper,
.ad-slot--inline.gml-ad-slideshow,
.ad-slot--inline .gml-ad-slides-wrapper {
  max-width: 100% !important;
  width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  margin-inline: auto !important;
  height: auto !important;
  min-height: 0 !important;
}

.ad-slot--rectangle.gml-ad-slideshow,
.ad-slot--rectangle .gml-ad-slides-wrapper {
  max-width: 100% !important;
  width: 100% !important;
  aspect-ratio: 4 / 5 !important;
  margin-inline: auto !important;
  height: auto !important;
  min-height: 0 !important;
}

.gml-ad-slides-wrapper {
  position: relative;
  width: 100%;
}

/* Slide individual no slideshow */
.gml-ad-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 1;
}

.gml-ad-slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

/* Mídia do slide dentro do slideshow */
.gml-ad-slide .gml-ad-media {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  background: transparent !important;
  z-index: 1 !important;
}

.gml-ad-slide .ad-copy {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 4 !important;
  padding: 16px 24px !important;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%) !important;
}

/* Controles de Navegação (Dots e Pausa) */
.gml-ad-controls {
  position: absolute;
  bottom: 16px;
  right: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 10, 11, 0.75);
  backdrop-filter: blur(8px);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.gml-ad-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gml-ad-dot {
  width: 22px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.gml-ad-dot.is-active {
  width: 32px;
  background: rgba(255, 255, 255, 0.4);
}

.gml-dot-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--red, #ee2b3b);
  border-radius: 999px;
}

.gml-ad-pause-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 10px;
  padding: 0 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gml-ad-pause-btn:hover {
  opacity: 1;
}

@media (max-width: 640px) {
  .gml-ad-controls {
    bottom: 10px;
    right: 12px;
    padding: 3px 8px;
  }
  .gml-ad-dot {
    width: 14px;
    height: 4px;
  }
  .gml-ad-dot.is-active {
    width: 20px;
  }
}

/* Publicidade intercalada na lista de notícias da Homepage */
.news-row--ad {
  position: relative;
  border-radius: 8px;
  padding: 8px;
  background: rgba(238, 43, 59, 0.05);
  border: 1px dashed rgba(238, 43, 59, 0.35);
  transition: all 0.25s ease;
}

.news-row--ad:hover {
  background: rgba(238, 43, 59, 0.09);
  border-color: rgba(238, 43, 59, 0.6);
  transform: translateX(3px);
}

.news-row--ad .ad-badge-inline {
  background: var(--red, #ee2b3b) !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Link transparente de clique que cobre todo o banner */
.gml-ad-overlay-link {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  cursor: pointer;
  text-decoration: none;
}

/* Garante que o botão da campanha (se visível) fique clicável acima do overlay */
.ad-copy a {
  position: relative;
  z-index: 6;
}

/* Container do Vídeo do YouTube (Background limpo sem legendas nem barras) */
.gml-ad-youtube {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden !important;
  background: #000;
  pointer-events: none;
  z-index: 1;
}

.gml-ad-youtube iframe {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  transform: translate(-50%, -50%) scale(1.38) !important;
  transform-origin: center center !important;
  border: none !important;
  pointer-events: none !important;
}
