/* ══════════════════════════════════════════
   home_top / home_center — banner ngang trên
   ══════════════════════════════════════════ */
.section-brand-add {
    text-align: center;
    margin-bottom: 20px;
    overflow: hidden;
}

.section-brand-add--center {
    margin-top: 20px;
}

.section-brand-inner {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.item-section-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.item-section-brand img,
.item-section-brand iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ══════════════════════════════════════════
   cashfish — banner bottom sticky
   ══════════════════════════════════════════ */
.section-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 8px;
    padding: 0 10px;
    pointer-events: none;
}

.banner-wrapper {
    position: relative;
    display: inline-block;
    pointer-events: all;
    line-height: 0;
}

.banner-section-bottom {
    display: block;
    max-width: 100%;
}

.banner-section-bottom img {
    max-width: 100%;
    height: auto;
    display: block;
}

.close-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 22px;
    background-color: #c0291d;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-btn:hover {
    background-color: #ff0000;
}

.banner-hidden {
    display: none !important;
}

@media (max-width: 575px) {
    .section-bottom {
        display: grid;
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 0;
        align-items: start;
        justify-items: center;
        padding: 0;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .section-bottom .banner-wrapper {
        box-sizing: border-box;
        width: 100%;
    }

    .section-bottom .banner-section-bottom {
        box-sizing: border-box;
        width: 100%;
        margin: 3px 0 !important;
        display: block;
    }

    .section-bottom .banner-section-bottom img,
    .section-bottom .banner-section-bottom iframe {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
    }
}

/* ══════════════════════════════════════════
   slide — native ads overlay
   ══════════════════════════════════════════ */
.native-ads-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    border-radius: inherit;
}

.native-ads-overlay img,
.native-ads-overlay iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.native-ads-overlay .ads-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 6px 8px;
    font-size: 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.native-ads-overlay .ads-text a {
    color: inherit;
    text-decoration: none;
}

/* ══════════════════════════════════════════
   sidebar_bottom — 3 banner 336x280
   ══════════════════════════════════════════ */
.sidebar-bottom-ads {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.sidebar-bottom-item {
    width: 100%;
    aspect-ratio: 336 / 280;
    overflow: hidden;
    border-radius: 4px;
}

.sidebar-bottom-item img,
.sidebar-bottom-item iframe {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

@media (max-width: 575px) {
    .sidebar-bottom-ads {
        display: none;
    }
}

/* ══════════════════════════════════════════
   comic_sponsor — nhà tài trợ trong trang comic
   ══════════════════════════════════════════ */
.comic-sponsor-content img {
    max-width: 120px;
    object-fit: fill;
    display: block;
    border-radius: 6px;
    background-color: #1a6b2f;
}

/* ══════════════════════════════════════════
   top_movie — hot comics bottom ad bar
   ══════════════════════════════════════════ */
.hot-ad-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.65);
    padding: 5px 8px;
    gap: 6px;
    z-index: 3;
}

.hot-ad-chapter {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.hot-ad-chapter:hover {
    color: #ddd;
}

.hot-ad-logo {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hot-ad-logo img {
    max-height: 28px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block;
}

/* ══════════════════════════════════════════
   movie — watermark badge góc dưới trái
   ══════════════════════════════════════════ */
.grid-watermark {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 3;
    width: 100%;
    overflow: hidden;
    pointer-events: all;
}

.grid-watermark img {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    display: block;
}

.grid-watermark a {
    display: block;
}

/* ══════════════════════════════════════════
   actor — watermark
   ══════════════════════════════════════════ */
.actor-watermark {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 3;
    background: rgba(0, 0, 0, 0.62);
    padding: 5px 10px 8px;
    border-radius: 0 6px 0 0;
    max-width: 72%;
}

.actor-watermark img {
    max-width: 100%;
    max-height: 34px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ══════════════════════════════════════════
   sponsor — nhà tài trợ uy tín
   ══════════════════════════════════════════ */
.brand-container {
    margin-top: 24px;
    margin-bottom: 24px;
}

.brand-list {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.brand-item {
    background: #1a0d2e;
    border-radius: 6px;
    overflow: hidden;
    height: 60px;
}

.brand-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.brand-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ══════════════════════════════════════════
   content_left/right top/bottom — banner giữa ảnh chapter
   ══════════════════════════════════════════ */
.chapter-ads-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 12px auto;
}

.chapter-ads-row > .item-section-brand {
    min-width: 0;
    max-width: 395px;
    aspect-ratio: 480 / 150;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
}

.chapter-ads-row > .item-section-brand img,
.chapter-ads-row > .item-section-brand iframe {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

@media (max-width: 576px) {
    .chapter-ads-row > .item-section-brand {
        max-width: 100%;
    }
}

/* ══════════════════════════════════════════
   home_floating — banner cố định trái/phải
   ══════════════════════════════════════════ */
.floating-ad {
    position: fixed;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 11.04vw; /* ~212px @ 1920px */
    max-width: 212px;
}

.floating-ad-left  { left: 2.92vw; }
.floating-ad-right { right: 2.92vw; }

.floating-ad img,
.floating-ad iframe {
    width: 100%;
    max-width: 212px;
    height: auto;
    max-height: 424px;
    display: block;
}

.floating-ad .close-floating {
    display: none;
}

/* ══════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════ */

/* tablet */
@media (max-width: 992px) {
    .brand-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* mobile */
@media (max-width: 576px) {
    .brand-list {
        grid-template-columns: repeat(3, 1fr);
    }

    .brand-item {
        height: 48px;
    }

    .catfish-wrap {
        gap: 6px;
        padding: 0 8px;
    }

    .section-brand-inner {
        grid-template-columns: 1fr;
        padding: 0 12px;
    }
}

/* ẩn floating trên màn hình nhỏ */
@media (max-width: 1200px) {
    .floating-ad {
        display: none;
    }

    .section-brand-inner {
        padding: 0 12px;
    }
}

/* Popup ads */
#ads-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#ads-popup-box {
    position: relative;
    width: min(400px, 92vw);
    aspect-ratio: 600 / 800;
    overflow: hidden;
    border-radius: 4px;
}

#ads-popup-box > div {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ads-popup-link {
    display: block;
    width: 100%;
    height: 100%;
}

.ads-popup-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#ads-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Flex banner (góc dưới phải) */
@keyframes downloadPopupZoomRotate {
    0% {
        filter: drop-shadow(0 4px 6px rgba(0,0,0,.1));
        transform: scale(.9) rotate(0deg)
    }

    12% {
        filter: drop-shadow(0 12px 20px rgba(255,215,0,.3));
        transform: scale(1.15) rotate(0deg)
    }

    18% {
        filter: drop-shadow(0 12px 20px rgba(255,105,180,.4));
        transform: scale(1.15) rotate(-6deg)
    }

    24% {
        filter: drop-shadow(0 12px 20px rgba(135,206,250,.4));
        transform: scale(1.15) rotate(6deg)
    }

    30% {
        filter: drop-shadow(0 14px 24px rgba(255,215,0,.5));
        transform: scale(1.15) rotate(-7deg)
    }

    36% {
        filter: drop-shadow(0 14px 24px rgba(255,105,180,.5));
        transform: scale(1.15) rotate(7deg)
    }

    42% {
        filter: drop-shadow(0 12px 20px rgba(135,206,250,.4));
        transform: scale(1.15) rotate(-5deg)
    }

    48% {
        filter: drop-shadow(0 12px 20px rgba(255,215,0,.4));
        transform: scale(1.15) rotate(5deg)
    }

    55% {
        filter: drop-shadow(0 12px 20px rgba(255,215,0,.3));
        transform: scale(1.15) rotate(0deg)
    }

    65% {
        filter: drop-shadow(0 4px 6px rgba(0,0,0,.1));
        transform: scale(.9) rotate(0deg)
    }

    to {
        filter: drop-shadow(0 4px 6px rgba(0,0,0,.1));
        transform: scale(.9) rotate(0deg)
    }
}

#ads-flex-container {
    position: fixed;
    bottom: 100px;
    right: 40px;
    z-index: 9998;
    display: none;
}

.ads-flex-wrapper {
    position: relative;
    display: inline-block;
}

.ads-flex-link {
    display: block;
}

.ads-flex-img {
    display: block;
    width: 180px;
    height: auto;
    border-radius: 4px;
}

.ads-flex-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 26px;
    height: 26px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    font-size: 15px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

@media (max-width: 480px) {
    .ads-flex-img {
        width: 130px;
    }
}
