.edumall-ad-runner,
.edumall-ad-banner {
    width: 100%;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 200ms ease, transform 200ms ease;
}

.edumall-ad-runner[hidden],
.edumall-ad-banner[hidden] {
    display: none;
}

.edumall-ad-runner.is-visible,
.edumall-ad-banner.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.edumall-ad-runner {
    position: relative;
    z-index: 80;
    padding: 14px 20px;
    background: #ffffff;
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.edumall-ad-runner-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(260px, 420px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
    max-width: 1180px;
    min-height: 142px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(220, 53, 69, 0.2);
    box-shadow: 0 16px 44px rgba(15, 23, 42, 0.12);
}

.edumall-ad-runner-inner::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(220, 53, 69, 0.08), transparent 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent);
}

.edumall-ad-runner-inner.no-media {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-left: 22px;
}

.edumall-ad-runner-image {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 142px;
    object-fit: cover;
    background: #f3f4f6;
}

.edumall-ad-runner-content {
    position: relative;
    z-index: 1;
    min-width: 0;
    padding: 18px 0;
}

.edumall-ad-runner-content h2,
.edumall-ad-banner-content h2 {
    margin: 0;
    color: #9f1d2f;
    font-weight: 850;
    letter-spacing: 0;
}

.edumall-ad-runner-content h2 {
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.12;
}

.edumall-ad-runner-content p,
.edumall-ad-banner-content p {
    color: #475569;
    line-height: 1.55;
}

.edumall-ad-runner-content p {
    max-width: 640px;
    margin: 8px 0 0;
    font-size: 15px;
}

.edumall-ad-runner-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    height: 4px;
    background: rgba(220, 53, 69, 0.12);
}

.edumall-ad-runner-track span {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: left;
    background: linear-gradient(90deg, #dc3545, #16a34a);
    animation: edumallAdProgress 6500ms linear forwards;
}

.edumall-ad-runner.is-visible .edumall-ad-runner-inner {
    animation: edumallAdSlideIn 260ms ease both;
}

.edumall-ad-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    padding: 11px 20px;
    border-radius: 999px;
    background: #dc3545;
    color: #ffffff !important;
    text-decoration: none;
    font-weight: 800;
    box-shadow: 0 14px 28px rgba(220, 53, 69, 0.22);
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.edumall-ad-cta:hover {
    transform: translateY(-1px);
    background: #b82435;
    box-shadow: 0 18px 34px rgba(220, 53, 69, 0.28);
}

.edumall-ad-banner {
    padding: 16px 20px;
}

.edumall-ad-banner-inner {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 18px;
    align-items: center;
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 18px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(220, 53, 69, 0.16);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.edumall-ad-banner-inner.no-media {
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.edumall-ad-middle-banner {
    padding-top: 26px;
    padding-bottom: 26px;
}

.edumall-ad-banner-image {
    width: 118px;
    height: 76px;
    border-radius: 12px;
    object-fit: cover;
    background: #f3f4f6;
}

.edumall-ad-banner-content {
    min-width: 0;
}

.edumall-ad-banner-content h2 {
    font-size: 22px;
    line-height: 1.2;
}

.edumall-ad-banner-content p {
    margin: 6px 0 0;
    font-size: 14px;
}

.edumall-ad-banner .edumall-ad-cta {
    margin-top: 0;
    white-space: nowrap;
}

.edumall-ad-banner-close {
    position: relative;
    z-index: 3;
    border: 0;
    cursor: pointer;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #111827;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.edumall-ad-banner-close:hover {
    background: #dc3545;
}

@keyframes edumallAdProgress {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

@keyframes edumallAdSlideIn {
    from {
        transform: translateX(18px);
    }

    to {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .edumall-ad-runner {
        padding: 12px;
    }

    .edumall-ad-runner-inner {
        grid-template-columns: 112px minmax(0, 1fr) auto;
        gap: 12px;
        min-height: 118px;
        border-radius: 14px;
    }

    .edumall-ad-runner-image {
        height: 118px;
    }

    .edumall-ad-runner-content {
        padding: 12px 0;
    }

    .edumall-ad-runner-content h2 {
        font-size: 20px;
    }

    .edumall-ad-runner-content p {
        display: -webkit-box;
        margin-top: 5px;
        overflow: hidden;
        font-size: 13px;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .edumall-ad-runner .edumall-ad-cta {
        margin-top: 8px;
        padding: 9px 14px;
        font-size: 13px;
    }

    .edumall-ad-banner {
        padding-left: 12px;
        padding-right: 12px;
    }

    .edumall-ad-banner-inner {
        grid-template-columns: 82px minmax(0, 1fr) auto;
        gap: 12px;
        padding: 14px;
        border-radius: 14px;
    }

    .edumall-ad-banner-image {
        width: 82px;
        height: 64px;
        border-radius: 10px;
    }

    .edumall-ad-banner .edumall-ad-cta {
        grid-column: 1 / -1;
        width: 100%;
    }
}

@media (max-width: 520px) {
    .edumall-ad-runner-inner {
        grid-template-columns: 1fr auto;
    }

    .edumall-ad-runner-image {
        grid-column: 1 / -1;
        height: auto;
        max-height: 190px;
        aspect-ratio: 16 / 9;
    }

    .edumall-ad-runner-content {
        padding: 12px 0 18px 14px;
    }

    .edumall-ad-runner .edumall-ad-banner-close {
        margin-right: 12px;
    }

    .edumall-ad-banner-inner {
        grid-template-columns: 1fr auto;
    }

    .edumall-ad-banner-image {
        grid-column: 1 / -1;
        width: 100%;
        height: auto;
        max-height: 180px;
        aspect-ratio: 16 / 9;
    }
}
