/* ============================================
   Range Lab - Google AdSense Styles
   ============================================ */

/* ===== Ad Container Base ===== */
.ad-container {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ad-container::before {
    content: 'Advertisement';
    position: absolute;
    top: var(--space-2);
    left: var(--space-3);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* Placeholder for development */
.ad-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    padding: var(--space-4);
    text-align: center;
}

.ad-placeholder-icon {
    font-size: 2rem;
    margin-bottom: var(--space-2);
    opacity: 0.3;
}

.ad-placeholder-text {
    font-size: var(--text-sm);
}

.ad-placeholder-size {
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--color-text-disabled);
    margin-top: var(--space-1);
}

/* ===== Leaderboard (728x90) ===== */
.ad-leaderboard {
    width: 100%;
    max-width: 728px;
    height: 90px;
    margin: var(--space-6) auto;
}

/* ===== Large Rectangle (336x280) ===== */
.ad-rectangle-lg {
    width: 336px;
    height: 280px;
}

/* ===== Medium Rectangle (300x250) ===== */
.ad-rectangle-md {
    width: 300px;
    height: 250px;
}

/* ===== Wide Skyscraper (160x600) ===== */
.ad-skyscraper {
    width: 160px;
    height: 600px;
}

/* ===== In-Article (Responsive) ===== */
.ad-in-article {
    width: 100%;
    min-height: 250px;
    margin: var(--space-8) 0;
}

/* ===== Sidebar Ad ===== */
.ad-sidebar {
    width: 100%;
    max-width: 300px;
    height: 250px;
    margin-bottom: var(--space-6);
}

/* ===== Mobile Banner (320x50) ===== */
.ad-mobile-banner {
    width: 320px;
    height: 50px;
    margin: var(--space-4) auto;
}

/* ===== Native/In-Feed Ad ===== */
.ad-native {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    padding: var(--space-5);
    margin: var(--space-4) 0;
}

.ad-native-content {
    display: flex;
    gap: var(--space-4);
}

.ad-native-image {
    width: 120px;
    height: 80px;
    background: var(--color-bg-tertiary);
    flex-shrink: 0;
}

.ad-native-text {
    flex: 1;
}

.ad-native-headline {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
    color: var(--color-text-primary);
}

.ad-native-description {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.ad-native-sponsor {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-2);
}

/* ===== Sticky Sidebar Ad ===== */
.ad-sticky {
    position: sticky;
    top: calc(var(--nav-height) + var(--space-6));
}

/* ===== Ad Spacing Utilities ===== */
.ad-top-margin {
    margin-top: var(--space-8);
}

.ad-bottom-margin {
    margin-bottom: var(--space-8);
}

.ad-center {
    margin-left: auto;
    margin-right: auto;
}

/* ===== Responsive Ad Containers ===== */
.ad-responsive {
    width: 100%;
    min-height: 100px;
}

/* Auto-height for responsive units */
.ad-auto-height {
    height: auto;
    min-height: 90px;
}

/* ===== Ad Layout Containers ===== */
.ad-wrapper-top {
    padding: var(--space-4) 0;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
}

.ad-wrapper-bottom {
    padding: var(--space-4) 0;
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
}

.ad-wrapper-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Content + Ad Layout */
.content-with-ad {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-8);
}

.content-with-ad-main {
    min-width: 0;
}

.content-with-ad-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* ===== Hide Ads on Small Screens ===== */
@media (max-width: 1200px) {
    .ad-leaderboard {
        max-width: 100%;
    }
}

@media (max-width: 1024px) {
    .content-with-ad {
        grid-template-columns: 1fr;
    }

    .content-with-ad-sidebar {
        display: none;
    }

    .ad-skyscraper {
        display: none;
    }
}

@media (max-width: 768px) {
    .ad-leaderboard {
        display: none;
    }

    .ad-rectangle-lg,
    .ad-rectangle-md {
        width: 100%;
        max-width: 320px;
        height: auto;
        min-height: 250px;
    }
}

@media (max-width: 480px) {
    .ad-container::before {
        font-size: 9px;
    }
}

/* ===== AdSense Specific Classes ===== */
/* These classes help identify ad slots for AdSense integration */

.adsense-slot {
    display: block;
    width: 100%;
    height: 100%;
}

/* Ensure ins elements fill container */
.ad-container ins.adsbygoogle {
    display: block;
    width: 100%;
    height: 100%;
}

/* ===== Loading State ===== */
.ad-loading {
    background: linear-gradient(90deg, var(--color-bg-tertiary) 25%, var(--color-bg-elevated) 50%, var(--color-bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: adLoading 1.5s infinite;
}

@keyframes adLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Ad Blocker Detected ===== */
.ad-blocked {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    text-align: center;
}

.ad-blocked-icon {
    font-size: 2rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-3);
}

.ad-blocked-text {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    max-width: 200px;
}

/* ===== Premium/No Ads State ===== */
.ad-premium-hidden {
    display: none;
}

/* Show subtle message for premium users */
.ad-premium-placeholder {
    padding: var(--space-3);
    text-align: center;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    background: var(--color-bg-tertiary);
}
