/* Ads Management System — scoped styles */
.ads-system {
    --ads-accent: var(--gold, #5786c7);
    --ads-navy: var(--navy, #0F2044);
    --ads-cream: var(--cream, #FAF7F2);
    position: relative;
    z-index: 2;
}

/* Survive global .reveal-up { opacity: 0 } (admin preview + inner pages) */
.ads-system,
.ads-system.reveal-up,
.ads-system.reveal-up:not(.active),
section.ads-system.reveal-up {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}

.ads-system--course {
    padding-top: 0;
    padding-bottom: 0;
}

.ads-system--course .ads-slot__inner,
.ads-system--course .ads-button-wrap,
.ads-system--course .ads-section-banner {
    margin-bottom: 0;
}

.ads-slot {
    margin: 0 auto;
}

.ads-slot__inner {
    width: 100%;
}

/* Banner */
.ads-banner {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.ads-banner__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ads-banner__picture,
.ads-banner__img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: cover;
}

.ads-banner__overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(180deg, transparent 0%, rgba(15, 32, 68, 0.82) 100%);
    color: #fff;
}

.ads-banner__text {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
}

/* Section banner card — text + photo; photo frame crops any image */
.ads-section-banner__card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 0;
    align-items: stretch;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(15, 32, 68, 0.08);
    border: 1px solid rgba(15, 32, 68, 0.06);
}

.ads-section-banner:not(.ads-section-banner--has-image) .ads-section-banner__card {
    grid-template-columns: 1fr;
}

.ads-section-banner__link {
    display: contents;
    text-decoration: none;
    color: inherit;
}

/*
 * The image keeps its natural aspect ratio and the card grows to fit it.
 * If the text column is taller than the image, the leftover space is filled
 * with a blurred copy of the same image. !important beats home-page image rules
 * (leaderboard max-height:160px/contain).
 */
.ads-section-banner__media-frame {
    position: relative;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #e8eef8;
    overflow: hidden;
    isolation: isolate;
}

.ads-section-banner .ads-section-banner__backdrop {
    position: absolute !important;
    inset: -24px !important;
    width: calc(100% + 48px) !important;
    height: calc(100% + 48px) !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    filter: blur(18px) saturate(1.1);
    opacity: 0.85;
    transform: scale(1.05);
    z-index: 0;
    pointer-events: none;
}

.ads-section-banner .ads-section-banner__media {
    position: relative !important;
    display: block;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin: 0;
    z-index: 1;
}

.ads-section-banner .ads-section-banner__img {
    display: block;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    max-width: 100% !important;
    object-fit: contain !important;
    object-position: center center;
}

.ads-section-banner__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    padding: clamp(1.25rem, 3vw, 1.85rem) clamp(1.25rem, 3vw, 2rem);
    min-width: 0;
}

.ads-section-banner__title {
    margin: 0;
    font-family: var(--font-heading, 'Playfair Display', serif);
    color: var(--ads-title-color, var(--ads-navy, #0f2044));
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    line-height: 1.35;
    font-weight: 700;
}

.ads-section-banner__desc {
    margin: 0.35rem 0 0.85rem;
    color: var(--ads-desc-color, rgba(15, 32, 68, 0.75));
    line-height: 1.65;
    font-size: 0.95rem;
}

@media (min-width: 768px) {
    .ads-section-banner--has-image .ads-section-banner__card {
        grid-template-columns: minmax(280px, 1.1fr) minmax(0, 1fr);
        align-items: stretch;
    }

    /* Very wide images (set by the image onload): full-width image on top, text below */
    .ads-section-banner--wide .ads-section-banner__card {
        grid-template-columns: 1fr !important;
    }

    .ads-section-banner--wide .ads-section-banner__content {
        grid-row: 2;
    }

    /* Tall / portrait images: keep the image column narrower so the card isn't huge */
    .ads-section-banner--tall .ads-section-banner__card {
        grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1fr);
    }

    .ads-section-banner--tall .ads-section-banner__img {
        max-height: 520px !important;
        width: auto !important;
        margin-inline: auto;
    }
}

/* Buttons */
.ads-button-wrap {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
}

.ads-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.ads-btn--primary {
    background: var(--ads-accent);
    color: #fff;
    box-shadow: 0 8px 24px rgba(87, 134, 199, 0.28);
}

.ads-btn--primary:hover {
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

.ads-btn--outline {
    background: transparent;
    color: var(--ads-navy);
    border-color: var(--ads-accent);
}

.ads-btn--outline:hover {
    background: rgba(87, 134, 199, 0.08);
    color: var(--ads-navy);
    text-decoration: none;
}

.ads-btn--floating {
    background: #25d366;
    color: #fff;
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.35);
}

/* Floating global button */
.ads-system--floating-global {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 900;
    pointer-events: none;
}

[dir="rtl"] .ads-system--floating-global {
    right: auto;
    left: 1.25rem;
}

.ads-floating-btn {
    pointer-events: auto;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    overflow: hidden;
}

.ads-floating-btn__icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ads-floating-btn__label {
    font-size: 0.75rem;
    padding: 0 0.5rem;
    text-align: center;
    line-height: 1.2;
}

/* Popup */
.ads-system--popup-global {
    position: static;
}

.ads-popup[hidden] {
    display: none !important;
}

.ads-popup {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ads-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 32, 68, 0.55);
}

.ads-popup__dialog {
    position: relative;
    width: min(100%, 520px);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 32, 68, 0.2);
}

.ads-popup__close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    z-index: 2;
    border: 0;
    background: rgba(255, 255, 255, 0.92);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ads-navy);
}

[dir="rtl"] .ads-popup__close {
    right: auto;
    left: 0.75rem;
}

.ads-popup__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ads-popup__img {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: cover;
}

.ads-popup__body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.ads-popup__title {
    margin: 0 0 0.5rem;
    font-family: var(--font-heading, 'Playfair Display', serif);
    color: var(--ads-navy);
}

.ads-popup__desc {
    margin: 0 0 1rem;
    color: rgba(15, 32, 68, 0.75);
    line-height: 1.6;
}

/* Sidebar compact */
.ads-slot--sidebar .ads-banner__picture,
.ads-slot--sidebar .ads-banner__img {
    max-height: 220px;
}

.ads-slot--sidebar .ads-section-banner__card,
.ads-slot--sidebar .ads-section-banner--has-image .ads-section-banner__card {
    grid-template-columns: 1fr;
}

.ads-slot--sidebar .ads-section-banner__media-frame {
    grid-row: 1;
}

.ads-slot--sidebar .ads-section-banner__content {
    padding: 1rem;
}

/* Footer */
.ads-slot--footer {
    background: transparent;
    box-shadow: none;
    padding-top: 0;
    padding-bottom: 0;
}

.ads-slot--footer .ads-banner {
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 767px) {
    .ads-section-banner__card,
    .ads-section-banner--has-image .ads-section-banner__card {
        grid-template-columns: 1fr;
    }

    /* Image first on mobile, at its natural size */
    .ads-section-banner__media-frame {
        order: -1;
        height: auto;
    }

    .ads-section-banner--tall .ads-section-banner__img {
        max-height: 70vh !important;
        width: auto !important;
        margin-inline: auto;
    }

    .ads-section-banner__content {
        order: 0;
        padding: 1rem 1rem 1.25rem;
    }

    .ads-banner__overlay {
        padding: 1rem;
    }

    .ads-system--floating-global {
        right: 1rem;
        bottom: 1rem;
    }

    [dir="rtl"] .ads-system--floating-global {
        left: 1rem;
    }
}

/* Fixed banner sizes (CSS vars from admin size_preset) */
.ads-slot__inner,
.ads-system .ads-banner,
.ads-system .ads-section-banner {
    max-width: var(--ads-banner-max-width, 100%);
    margin-inline: auto;
}

.ads-banner__picture,
.ads-banner__img {
    width: 100%;
    height: var(--ads-banner-height, auto);
    max-height: var(--ads-banner-height, 320px);
    object-fit: cover;
}

/* Section banner ignores size-preset height — the card follows the image size */
.ads-section-banner__media,
.ads-section-banner__img {
    width: 100%;
    height: auto;
    max-height: none;
    min-height: 0;
}

.ads-system--size-leaderboard .ads-banner__img,
.ads-system--size-medium_rectangle .ads-banner__img,
.ads-system--size-course_top_full .ads-banner__img {
    min-height: var(--ads-banner-height, 300px);
}

.ads-system--size-mobile_banner .ads-banner__img {
    min-height: var(--ads-banner-height, 200px);
}

/* Course page: banner at very top */
.ads-system--course-top {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0;
    z-index: 5;
    display: block !important;
    visibility: visible !important;
    background: #eef4fc;
}

.ads-system--course-top .ads-slot__inner {
    border-radius: 0;
    width: 100%;
    max-width: none;
}

.ads-system--course-top .ads-banner {
    border-radius: 0;
    min-height: 120px;
}

.ads-system--course-top .ads-banner__img {
    width: 100%;
    max-height: none;
    min-height: 140px;
    height: auto;
    object-fit: contain;
    background: #eef4fc;
}

.ads-system--course-top .ads-banner__overlay {
    background: linear-gradient(180deg, transparent 0%, rgba(15, 32, 68, 0.78) 100%);
}

/* Custom title / description colors & fonts */
.ads-section-banner__title,
.ads-banner__title {
    color: var(--ads-title-color, var(--ads-navy, #0f2044));
    font-family: var(--ads-title-font, var(--font-heading, 'Playfair Display', serif));
}

.ads-section-banner__desc,
.ads-banner__text {
    color: var(--ads-desc-color, rgba(15, 32, 68, 0.75));
}

.ads-banner__title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.15rem, 2vw, 1.65rem);
    font-weight: 700;
}

/*
 * Text sitting ON the photo must stay light. Admin --ads-title-color / --ads-desc-color
 * are for section-banner cards on light backgrounds; applying them on the overlay made
 * navy text unreadable on the image (looked like the ad "was not showing").
 */
.ads-banner__overlay .ads-banner__title {
    color: #fff !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

.ads-banner__overlay .ads-banner__text {
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.ads-banner__overlay {
    background: linear-gradient(180deg, transparent 0%, rgba(15, 32, 68, 0.88) 100%);
}

@media (max-width: 767px) {
    .ads-banner__overlay {
        background: linear-gradient(180deg, rgba(15, 32, 68, 0.2) 0%, rgba(15, 32, 68, 0.92) 55%, rgba(15, 32, 68, 0.95) 100%);
        inset: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        gap: 0.35rem;
        padding: 1.1rem 1rem 1.25rem;
    }

    .ads-banner__overlay .ads-banner__title {
        font-size: clamp(1rem, 4.2vw, 1.25rem);
        line-height: 1.35;
    }

    .ads-banner__overlay .ads-banner__text {
        font-size: 0.88rem;
        line-height: 1.45;
        margin-bottom: 0.65rem;
    }
}

/* Registration CTA */
.ads-btn--register {
    cursor: pointer;
    border: none;
    font: inherit;
}

.ads-register-modal__content {
    border-radius: 14px;
}

.ads-register-modal__intro {
    color: rgba(15, 32, 68, 0.75);
    font-size: 0.95rem;
}

#adsRegisterModal {
    z-index: 10060 !important;
}

#adsRegisterModal .modal-dialog {
    z-index: 10061;
    pointer-events: none;
}

#adsRegisterModal .modal-content,
#adsRegisterModal .form-control {
    pointer-events: auto;
}

body.ads-register-open .modal-backdrop {
    z-index: 10055 !important;
}

body.ads-register-open .cp-mobile-cta-bar,
body.ads-register-open .cp-sticky-enroll,
body.ads-register-open .cp-sticky-actions,
body.ads-register-open .cp-sticky-whatsapp,
body.ads-register-open .ads-system--floating-global {
    pointer-events: none !important;
}

