/* ============================================================
 * EKP Calculators — Ad Zones
 * Styles for: right/left/below-title/in-content/after-content zones and the
 * popup (on the single calculator page), plus listing top/repeating/bottom
 * ad slots (in the calculators grid and category directory).
 * ============================================================ */

.ekp-single-ad-layout,
.ekp-ad-popup {
    --ekp-primary: #4F46E5;
    --ekp-ink: #0F172A;
    --ekp-muted: #94A3B8;
    --ekp-white: #FFFFFF;
    --ekp-border: #E4E9F2;
    --ekp-bg: #F6F7FB;
    --ekp-radius: 20px;
    --ekp-radius-sm: 14px;
    --ekp-shadow-sm: 0 2px 8px rgba(15,23,42,.06);
    --ekp-shadow-md: 0 10px 26px -6px rgba(15,23,42,.12);
    --ekp-shadow-lg: 0 26px 52px -16px rgba(79,70,229,.30);
    --ekp-ease: cubic-bezier(.16,1,.3,1);
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
    box-sizing: border-box;
}
.ekp-single-ad-layout *, .ekp-ad-popup * { box-sizing: border-box; }

/* ---------- Shared ad zone shell ---------- */
.ekp-ad-zone {
    position: relative;
    background: var(--ekp-white);
    border: 1px solid var(--ekp-border);
    border-radius: var(--ekp-radius-sm);
    box-shadow: var(--ekp-shadow-sm);
    padding: 10px;
    text-align: center;
    overflow: hidden;
}
.ekp-ad-zone img { max-width: 100%; height: auto; display: block; margin: 0 auto; border-radius: calc(var(--ekp-radius-sm) - 6px); }
.ekp-ad-label {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--ekp-muted);
    margin-bottom: 8px;
}

/* ---------- Single calculator page: left/right rails + below-title ---------- */
.ekp-single-ad-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}
.ekp-single-ad-main { flex: 1 1 0; min-width: 0; }
.ekp-ad-rail { flex: 0 0 160px; position: sticky; top: 90px; }
.ekp-ad-rail .ekp-ad-zone { width: 160px; }
@media (max-width: 1100px) {
    .ekp-ad-rail { display: none; }
}

.ekp-ad-zone--below_title { margin-bottom: 24px; }
.ekp-ad-zone--in_content { margin: 28px 0; }
.ekp-ad-zone--after_content { margin-top: 28px; }

/* ---------- Listing ad card (sits inside .ekp-calc-grid) ---------- */
.ekp-calc-card--ad {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: var(--ekp-bg);
}
.ekp-calc-card--ad .ekp-ad-zone { width: 100%; border: none; box-shadow: none; background: transparent; }

/* ---------- Listing ad box (sits inside the .ekp-directory masonry) ---------- */
.ekp-dir-box--ad {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}
.ekp-dir-box--ad .ekp-ad-zone { width: 100%; border: none; box-shadow: none; background: transparent; }

/* ---------- Top/bottom listing banners ---------- */
.ekp-ad-listing-banner { margin: 0 0 22px; }
.ekp-ad-listing-banner--listing_bottom { margin: 22px 0 0; }
.ekp-ad-listing-banner .ekp-ad-zone { max-width: 728px; margin: 0 auto; }

/* ---------- Popup ---------- */
.ekp-ad-popup { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.ekp-ad-popup[hidden] { display: none; }
.ekp-ad-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.ekp-ad-popup-box {
    position: relative;
    z-index: 1;
    background: var(--ekp-white);
    border-radius: var(--ekp-radius);
    box-shadow: var(--ekp-shadow-lg);
    padding: 22px;
    max-width: 420px;
    width: calc(100% - 40px);
}
@media (prefers-reduced-motion: no-preference) {
    .ekp-ad-popup-box { animation: ekpPopupIn .35s var(--ekp-ease) both; }
}
@keyframes ekpPopupIn {
    from { opacity: 0; transform: translateY(18px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ekp-ad-popup-close {
    position: absolute;
    top: -14px;
    inset-inline-end: -14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--ekp-ink);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--ekp-shadow-md);
    transition: transform .2s var(--ekp-ease), background .2s var(--ekp-ease);
}
.ekp-ad-popup-close:hover { background: var(--ekp-primary); transform: scale(1.08); }
