/**
 * EcrioniX Ad Styles
 * Centralized, CLS-safe, policy-compliant advertisement styles.
 * Fully supports Light and Dark themes with zero layout shifts.
 */

:root {
  --ecx-ad-bg: rgba(15, 23, 42, 0.4);
  --ecx-ad-border: rgba(148, 163, 184, 0.15);
  --ecx-ad-label: #94a3b8;
  --ecx-ad-accent: #38bdf8;
}

[data-theme="light"], :root[data-theme="light"] {
  --ecx-ad-bg: rgba(241, 245, 249, 0.6);
  --ecx-ad-border: rgba(15, 23, 42, 0.12);
  --ecx-ad-label: #64748b;
  --ecx-ad-accent: #0284c7;
}

/* Base Ad Wrapper - Eliminates Cumulative Layout Shift (CLS) */
.ecx-ad-wrapper {
  margin: 2.25rem auto;
  max-width: 100%;
  width: 100%;
  text-align: center;
  position: relative;
  clear: both;
  box-sizing: border-box;
}

/* Dedicated Inner Ad Container with Safe Reserve Height */
.ecx-ad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 0.6rem 0.5rem;
  background: var(--ecx-ad-bg);
  border: 1px dashed var(--ecx-ad-border);
  border-radius: 10px;
  min-height: 110px; /* Reserves layout space to prevent CLS */
  overflow: hidden;
  transition: min-height 0.25s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Mid-content in-article unit: reserves standard 250px-280px rectangular space */
.ecx-ad-wrapper.ecx-ad-mid .ecx-ad-container {
  min-height: 260px;
}

/* Horizontal leaderboard unit: reserves 90px-110px banner space */
.ecx-ad-wrapper.ecx-ad-top .ecx-ad-container {
  min-height: 110px;
}

/* Bottom / pre-footer unit */
.ecx-ad-wrapper.ecx-ad-bottom .ecx-ad-container {
  min-height: 110px;
}

/* Official Google Policy Compliant Ad Label */
.ecx-ad-label {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ecx-ad-label);
  margin-bottom: 0.4rem;
  user-select: none;
  opacity: 0.85;
}

/* AdSense ins tag responsive rules */
.ecx-ad-container ins.adsbygoogle {
  display: block;
  width: 100%;
  margin: 0 auto;
}

/* Collapse empty containers if adblock is active or no fill */
.ecx-ad-container[data-ad-status="unfilled"],
.ecx-ad-container.is-empty {
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  display: none;
}

/* Safe Utility Separation (for Tool Pages) */
.ecx-ad-safe-utility {
  margin: 3rem auto 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ecx-ad-border);
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .ecx-ad-wrapper {
    margin: 1.75rem auto;
  }
  .ecx-ad-wrapper.ecx-ad-mid .ecx-ad-container {
    min-height: 260px;
  }
  .ecx-ad-wrapper.ecx-ad-top .ecx-ad-container {
    min-height: 100px;
  }
  .ecx-ad-container {
    padding: 0.4rem 0.25rem;
  }
}
