/* ═══════════════════════════════════════════════════════════════════════════════
   Ad System — Styles (AdSense Compliant)
   =============================================================================
   - Clearly distinguishable from content (AdSense requirement)
   - Responsive: adapts to mobile/tablet/desktop
   - Labeled "Advertisement" above each unit
   - No deceptive placement (distinct border, background, spacing)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Ad Unit Container ──────────────────────────────────────────────────── */
.ad-unit {
    position: relative;
    margin: 1.8rem auto;
    padding: 0;
    border: 1px dashed var(--bd, #2a2a2e);
    border-radius: 8px;
    background: var(--bgc2, #111118);
    overflow: hidden;
    text-align: center;
    transition: border-color 0.2s;
    max-width: 100%;
}

.ad-unit:hover {
    border-color: var(--tm, #666);
}

/* ── Ad Label ("Advertisement" / "إعلان") ───────────────────────────────── */
.ad-label {
    display: block;
    padding: 4px 10px 2px;
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tm, #888);
    text-align: center;
    user-select: none;
}

/* ── Ad Inner (where AdSense code or placeholder goes) ──────────────────── */
.ad-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    min-height: 90px;
}

/* ── Placeholder (shown before AdSense codes are configured) ────────────── */
.ad-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 2rem 1rem;
    color: var(--tm, #666);
    width: 100%;
    min-height: 90px;
}

.ad-placeholder-icon {
    font-size: 1.6rem;
    opacity: 0.5;
}

.ad-placeholder-text {
    font-size: 0.8rem;
    opacity: 0.6;
    letter-spacing: 0.04em;
}

/* ── Slot-Specific Sizing ───────────────────────────────────────────────── */

/* Header Banner: full width, 90-100px height */
.ad-header_banner .ad-inner {
    min-height: 90px;
    max-height: 120px;
}

/* Sidebar: 300x250 default, flexible */
.ad-sidebar_top .ad-inner,
.ad-sidebar_bottom .ad-inner {
    min-width: 250px;
    min-height: 250px;
    max-width: 336px;
    margin: 0 auto;
}

/* In-Content: medium rectangle or responsive horizontal */
.ad-content_middle .ad-inner,
.ad-content_bottom .ad-inner {
    min-height: 90px;
    max-height: 150px;
}

/* In-Feed: matches card height, native feel */
.ad-in_feed .ad-inner {
    min-height: 120px;
    max-height: 250px;
}

/* ── Sticky Sidebar Ad ──────────────────────────────────────────────────── */
.ad-sidebar_bottom {
    position: sticky;
    top: 1rem;
    z-index: 5;
}

/* ── In-Feed: card-like appearance ──────────────────────────────────────── */
.ad-in_feed {
    border-style: dashed;
    border-radius: 12px;
}

/* ── Responsive: Tablet (768px - 1024px) ────────────────────────────────── */
@media (max-width: 1024px) {
    .ad-header_banner .ad-inner {
        min-height: 60px;
        max-height: 90px;
    }
    
    .ad-sidebar_top .ad-inner,
    .ad-sidebar_bottom .ad-inner {
        min-width: 200px;
        min-height: 200px;
    }
    
    .ad-content_middle .ad-inner,
    .ad-content_bottom .ad-inner {
        min-height: 60px;
    }
}

/* ── Responsive: Mobile (< 768px) ───────────────────────────────────────── */
@media (max-width: 768px) {
    .ad-unit {
        margin: 1.2rem 0.5rem;
        border-radius: 6px;
    }
    
    /* Hide sidebar ads on mobile (no sidebar column) */
    .ad-mobile-hide {
        display: none !important;
    }
    
    .ad-header_banner .ad-inner {
        min-height: 50px;
        max-height: 100px;
    }
    
    .ad-in_feed .ad-inner {
        min-height: 100px;
    }
    
    .ad-content_middle .ad-inner,
    .ad-content_bottom .ad-inner {
        min-height: 60px;
        padding: 0.4rem;
    }
    
    .ad-label {
        font-size: 0.6rem;
    }
}

/* ── RTL Support ────────────────────────────────────────────────────────── */
[dir="rtl"] .ad-label {
    letter-spacing: 0;
    font-family: inherit;
}

/* ── Print: Hide all ads ────────────────────────────────────────────────── */
@media print {
    .ad-unit {
        display: none !important;
    }
}

/* ── Reduced Motion: no sticky ads ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ad-sidebar_bottom {
        position: static;
    }
}
