/* ===========================================
   DATAILEDVIEW TOOLS
   AdSense Integration Styles
   All ad units use .dv-ad-* prefix.
   Designed to blend with the site theme
   without breaking layout or dark mode.
=========================================== */

/* -------------------------------------------
   Base wrapper — shared by all ad placements
------------------------------------------- */
.dv-ad-wrap {
  display: block;
  width: 100%;
  overflow: hidden;
  /* Inherit background so it never contrasts oddly */
  background: transparent;
}

/* Hide the <ins> itself when unfilled */
.dv-ad-wrap ins[data-ad-status="unfilled"] {
  display: none !important;
}

/* Collapse the full wrapper when JS marks it hidden —
   handled by ads.js setting wrapper.style.display='none'.
   This rule is a CSS-only safety net for the inner box. */
.dv-ad-tool:empty,
.dv-ad-section:empty,
.dv-ad-inline:empty {
  display: none !important;
}

/* -------------------------------------------
   SECTION BANNER  (.dv-ad-section)
   Used between homepage sections.
   Sits inside the normal page flow as a
   light surface strip, matching .categories /
   .why-section aesthetic.
------------------------------------------- */
.dv-ad-section {
  padding: 12px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.dv-ad-section .dv-ad-inner {
  max-width: var(--container, 1320px);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* -------------------------------------------
   TOOL PAGE BANNER  (.dv-ad-tool)
   Sits below the stats bar on tool pages,
   inside a container, matching the stats-bar
   card aesthetic.
------------------------------------------- */
.dv-ad-tool {
  /* Match the container + margin rhythm of .jf-stats-bar */
  max-width: var(--container, 1320px);
  margin: 0 auto 32px;
  padding: 0 24px;
}

.dv-ad-tool .dv-ad-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

/* -------------------------------------------
   INLINE BANNER  (.dv-ad-inline)
   General-purpose slot used between sections
   on all-tools and legal/info pages.
   No outer background — blends into whatever
   section surrounds it.
------------------------------------------- */
.dv-ad-inline {
  width: 100%;
  padding: 8px 0;
}

.dv-ad-inline .dv-ad-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* -------------------------------------------
   "Ad" label — tiny, tasteful, required
   by Google policy and user transparency.
------------------------------------------- */
.dv-ad-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-light);
  align-self: flex-start;
  padding: 1px 6px;
  background: var(--surface-hover);
  border-radius: 4px;
  border: 1px solid var(--border);
  line-height: 1.6;
  user-select: none;
}

/* -------------------------------------------
   The actual AdSense <ins> unit
------------------------------------------- */
.dv-ad-wrap ins.adsbygoogle {
  display: block !important;
  width: 100%;
  /* Let AdSense control the height via auto format */
}

/* -------------------------------------------
   Dark mode — no extra work needed because
   AdSense auto-adapts, but we keep our
   wrapper surfaces consistent.
------------------------------------------- */
[data-theme="dark"] .dv-ad-tool .dv-ad-inner {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .dv-ad-section {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .dv-ad-label {
  background: var(--surface-hover);
  border-color: var(--border);
}

/* -------------------------------------------
   Responsive — make sure the ad never
   causes horizontal overflow on small screens
------------------------------------------- */
@media (max-width: 640px) {
  .dv-ad-tool,
  .dv-ad-tool .dv-ad-inner {
    padding-left: 12px;
    padding-right: 12px;
  }
  .dv-ad-section .dv-ad-inner {
    padding: 0 12px;
  }
}
