/* === CLOSE BUTTON (skyscraper) === */
.ads-close {
    position: absolute;
    top: 0;
    right: 5px;
    width: 20px;
    height: 20px;
    background-color: #c0291d;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ads-close:hover { background-color: #a02010; }

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

/* === LEADERBOARD — 2 banner ngang (ẩn trên mobile) === */
.ads-leaderboard-row {
    display: flex;
    gap: 8px;
    margin: 8px 0 14px;
    text-align: center;
}

.ads-leaderboard-item {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

.ads-leaderboard-item > * { max-width: 100%; }

@media (max-width: 767px) {
    .ads-leaderboard-row { display: none; }
}

/* === INLINE ROW — 2 banner ngang trong danh sách truyện / trang đọc (hiển thị trên mobile, item phụ ẩn) === */
.ads-inline-row {
    display: flex;
    gap: 8px;
    margin: 8px 0 14px;
    text-align: center;
}

/* === SKYSCRAPER — cố định 2 bên màn hình === */
.ads-skyscraper {
    position: fixed;
    top: 100px;
    width: 160px;
    z-index: 9999;
    transition: top 0.3s ease;
    display: none;
}

.ads-skyscraper-left  { left: 0; }
.ads-skyscraper-right { right: 0; }

.ads-skyscraper img {
    width: 100%;
    display: block;
}

/* Hiển thị skyscraper khi có đủ khoảng trống (xử lý bằng JS) */
@media screen and (max-width: 1366px) {
    .ads-skyscraper { display: none !important; }
}

/* === CONTENT RIGHT — banner dọc trong sidebar === */
.ads-block { position: relative; }

.ads-large-mobile {
    margin: 8px 0;
    text-align: center;
    overflow: hidden;
}

.ads-large-mobile > * {
    max-width: 100%;
    height: auto;
}

/* === CONTENT BOTTOM — banner lớn cuối khu vực nội dung === */
.ads-content-bottom {
    margin: 12px 0;
    text-align: center;
    overflow: hidden;
    position: relative;
}

.ads-content-bottom > * {
    max-width: 100%;
    height: auto;
}

/* === THUMBNAIL OVERLAY — banner góc trên-phải ảnh bìa === */
.ads-comic-cover {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    line-height: 0;
}

.ads-comic-cover img {
    height: auto;
    display: block;
}

/* === INLINE AD — banner xen giữa danh sách truyện / trang đọc === */
.ads-comic-list {
    position: relative;
    text-align: center;
}

.ads-comic-list > * { max-width: 100%; }

/* Ad wrap chiếm toàn hàng trong flexbox, đứng giữa comic */
.ads-comic-list-wrap {
    width: 100%;
    flex-basis: 100%;
    flex-shrink: 0;
}

/* 4-col (≥768px): hiện ads-col4, ẩn ads-col3 */
@media (min-width: 768px) {
    .ads-col3 { display: none; }
}

/* 3-col (480–767px): ẩn ads-col4, hiện ads-col3 */
@media (min-width: 480px) and (max-width: 767px) {
    .ads-col4 { display: none; }
}

/* 2-col (<480px): ẩn ads-col3, giữ ads-col4 (mỗi 8 = 4 hàng) */
@media (max-width: 479px) {
    .ads-col3 { display: none; }
}

/* Flexbox cho .items .row để inline ad tự xuống hàng đúng thứ tự */
.items .row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}
.items .row .item {
    float: none;
}

/* === HEADER CTA — nút sponsor trong thanh nav === */
.ads-header-cta {
    float: right;
    display: flex;
    align-items: center;
    height: 50px;
    margin-right: 8px;
}

.ads-header-cta a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

/* === NAV LINK — banner trong thanh điều hướng chính === */
.ads-nav-item {
    display: flex !important;
    align-items: center;
    margin-left: auto;
}

.ads-nav-item a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px !important;
    white-space: nowrap;
}

/* === RANK DROPDOWN BANNER === */
.ads-rank-menu {
    border-top: 1px solid rgba(0,0,0,0.08);
    margin-top: 4px;
    padding-top: 4px;
}

.ads-rank-menu a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 15px;
    white-space: nowrap;
    text-decoration: none;
}

/* === GENRE MEGAMENU BANNER === */
.ads-genre-menu {
    position: relative;
    display: inline-block;
    overflow: hidden;
    border-radius: 4px;
    margin-top: 4px;
}

.ads-genre-menu img {
    max-width: 100%;
    height: auto;
    max-height: 102px;
    display: block;
}

/* === CHAPTER SPONSOR — inline bên cạnh ngày cập nhật trang đọc === */
.ads-chapter-sponsor {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    vertical-align: middle;
}

.ads-chapter-sponsor img {
    max-height: 30px;
    width: auto;
    display: block;
}

.ads-chapter-sponsor a {
    display: flex;
    align-items: center;
}

/* === SPONSOR CARD LIST — khối NHÀ CÁI UY TÍN === */
.ads-card-list {
    background: linear-gradient(89.2deg, #FFEFE2 0.18%, #FFFCF1 49.42%, #E7EDF6 99.09%);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
}

.ads-card-heading {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0 0 10px;
    color: #222;
}

.ads-card-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.07);
}

.ads-card-item:last-child { border-bottom: none; }

.ads-card-logo {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
}

.ads-card-logo a { display: block; width: 100%; height: 100%; }

.ads-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ads-card-body {
    flex: 1;
    min-width: 0;
}

.ads-card-title {
    display: block;
    font-size: 18px;
    font-weight: 400;
    text-transform: uppercase;
    color: #111;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.ads-card-title:hover { color: #3b82f6; }

.ads-card-subtitle {
    font-size: 17px;
    color: #3478F6;
    margin-bottom: 6px;
}

.ads-card-btn {
    display: inline-block;
    font-size: 14px;
    padding: 3px 10px;
    border: 1px solid #3478F6;
    border-radius: 20px;
    color: #3478F6;
    cursor: pointer;
}

/* === POPUP — overlay toàn màn hình === */
#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-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: auto;
    max-width: 92vw;
    text-align: center;
}

#ads-popup-box {
    width: fit-content;
    max-width: 92vw;
    height: auto;
    aspect-ratio: auto;
    overflow: hidden;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#ads-popup-box > ins,
#ads-popup-box a {
    width: auto;
    max-width: 100%;
}

#ads-popup-box > ins {
    display: inline-block;
}

#ads-popup-box a,
.ads-popup-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: auto;
    margin: 0 auto;
    text-align: center;
}

#ads-popup-box img,
.ads-popup-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: calc(100vh - 120px);
    margin: 0 auto;
    object-fit: contain;
}

#ads-popup-close {
    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;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === FLEX — banner cố định 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; }
}

/* === NOTIFY TICKER — thông báo chạy ngang ===*/
.notify-ticker {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.notify-ticker-text {
    display: inline-block;
    white-space: nowrap;
}

.notify-ticker-text.is-overflow {
    animation: notify-marquee 23s linear infinite;
}

.notify-ticker:hover .notify-ticker-text {
    animation-play-state: paused;
}

@keyframes notify-marquee {
    0%   { transform: translateX(0); }
    13%  { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* === CATFISH / LEADERBOARD FOOTER — banner dính đáy màn hình === */
.ads-catfish {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1030px;
    z-index: 9997;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.ads-catfish .banner-wrapper {
    position: relative;
    pointer-events: all;
    line-height: 0;
}

.ads-catfish-item {
    display: block;
    max-width: 100%;
}

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

.ads-catfish .ads-close {
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    font-size: 12px;
}

@media (max-width: 575px) {
    .ads-catfish {
        padding: 0;
    }

    .ads-catfish .banner-wrapper:nth-child(n+2) {
        display: none;
    }

    .ads-catfish .banner-wrapper {
        box-sizing: border-box;
        width: 100%;
    }

    .ads-catfish-item {
        box-sizing: border-box;
        width: 100%;
    }

    .ads-catfish-item img,
    .ads-catfish-item iframe {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
    }
}

/* === FOOTER LAYOUT === */
.footer-logo-wrap {
    text-align: center;
    padding: 20px 0 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.footer-main-row {
    padding: 20px 0 8px;
}

.footer-copyright {
    text-align: center;
    padding: 14px 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    font-size: 13px;
    opacity: 0.65;
}

/* === FOOTER SPONSORS — danh sách logo nhà tài trợ === */
.ads-sponsors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.ads-sponsor-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    max-width: 130px;
}

.ads-sponsor-item:hover { opacity: 0.9; }

.ads-sponsor-item img {
    height: 36px;
    width: auto;
    display: block;
}

.ads-sponsor-item a {
    display: flex;
    align-items: center;
}
