/* === CSS CHO QUẢNG CÁO POP-UP GIỮA TRANG === */

#master-ads-middle-popup {
    display: none; /* Ẩn mặc định */
    position: fixed; /* Cố định vị trí */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Màu nền mờ - Giữ nguyên */
    z-index: 9999; /* Hiển thị trên cùng */
    display: flex; /* Sử dụng flexbox để căn giữa */
    align-items: center;
    justify-content: center;
    padding: 20px; /* Thêm padding cho vùng overlay để ảnh không chạm cạnh màn hình */
    box-sizing: border-box;
}

.master-ads-popup-content {
    position: relative; /* Quan trọng để định vị nút đóng */
    background-color: transparent; /* QUAN TRỌNG: Đặt lại nền trong suốt */
    padding: 0; /* Xóa padding nếu không muốn có khoảng trống quanh ảnh */
    border-radius: 0; /* Xóa bo góc nếu container trong suốt */
    text-align: center;
    max-width: 100%; /* Cho phép ảnh chiếm tối đa vùng padding của overlay */
    max-height: 100%;
    overflow: visible; /* Cho phép nút đóng tràn ra ngoài */
    /* Xóa box-shadow */
}

.master-ads-close-button {
    position: absolute;
    top: -15px; /* Vị trí nút so với ảnh */
    right: -15px; /* Vị trí nút so với ảnh */
    width: 30px;
    height: 30px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background-color: red;
    border-radius: 50%;
    border: 2px solid white;
    line-height: 27px;
    text-align: center;
    cursor: pointer;
    opacity: 1;
    z-index: 10000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

.master-ads-close-button:hover {
    background-color: darkred;
    opacity: 1;
}

.master-ads-popup-content img {
    max-width: 100%;
    max-height: 100%; /* Đảm bảo ảnh không vượt quá chiều cao vùng chứa */
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Các style cho quảng cáo giữa trang khác (nếu có) */
.master-ads-middle-container {
    text-align: center;
    margin-top: 20px;
}
.master-ads-middle-item {
    display: inline-block;
    margin: 0 10px;
}
.master-ads-middle-item img {
    max-width: 100%;
    height: auto;
    display: block;
}


/* === CSS CHO QUẢNG CÁO CHÂN TRANG (CATFISH) === */

.master-ads-footer {
    padding: 0;
    background-color: transparent;
    width: 100%;
    box-sizing: border-box;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 9998;
    /* Chứa .master-ads-footer-content để căn giữa */
    display: flex;
    justify-content: center;
}

.master-ads-footer-content {
    position: relative; /* Để định vị nút đóng bên trong */
    background-color: transparent; /* QUAN TRỌNG: Đặt lại nền trong suốt */
    padding: 0; /* Xóa padding nếu không cần khoảng cách quanh ảnh */
    max-width: 728px; /* Giữ lại giới hạn chiều rộng nếu muốn */
    width: auto; /* Để chiều rộng tự động theo ảnh */
    /* Xóa box-shadow */
    /* Xóa border-radius */
    margin-bottom: 5px; /* Tạo khoảng cách nhỏ với đáy màn hình nếu cần */
}

.master-ads-close-button-footer {
    position: absolute;
    top: -12px; /* Vị trí nút so với ảnh */
    right: -5px; /* Vị trí nút so với ảnh */
    width: 24px;
    height: 24px;
    font-size: 14px;
    font-weight: bold;
    color: white;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    opacity: 0.8;
    z-index: 9999;
    border: 1px solid white;
}

.master-ads-close-button-footer:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.9);
}

.master-ads-footer img {
    max-width: 100%;
    height: auto;
    display: block;
    /* margin: 0 auto; không cần thiết nếu .master-ads-footer-content đã căn giữa */
    position: relative;
    z-index: 9998;
}

/* Các style cho quảng cáo chân trang khác (nếu có) */
.master-ads-footer-container {
    text-align: center;
    padding: 10px 0;
    width: 100%;
    box-sizing: border-box;
}
.master-ads-footer-item {
    display: inline-block;
    margin: 0 10px;
}
.master-ads-footer-item img {
    max-width: 100%;
    height: auto;
    display: block;
}


/* === RESPONSIVE === */
@media (max-width: 768px) {
    .master-ads-middle-item, .master-ads-footer-item {
        display: block;
        margin: 10px auto;
    }

    /* Điều chỉnh lại nút đóng popup trên mobile nếu cần */
     .master-ads-close-button {
        top: -12px;
        right: -12px;
        width: 26px;
        height: 26px;
        font-size: 16px;
        line-height: 23px;
     }

     /* Điều chỉnh nút đóng footer trên mobile */
     .master-ads-footer-content {
        max-width: 95%; /* Cho phép rộng hơn trên mobile */
        margin-bottom: 3px;
     }
    .master-ads-close-button-footer {
        top: -10px;
        right: -8px; /* Điều chỉnh lại vị trí nút */
        width: 22px;
        height: 22px;
        font-size: 12px;
        line-height: 21px;
    }

    .master-ads-footer img {
       /* max-height: 60px; */ /* Giữ hoặc bỏ tùy theo thiết kế */
    }
}