/**
 * TruyenFull - Affiliate Banner Styles
 * Frontend CSS cho hệ thống banner affiliate
 */

/* =========================================================
   BASE BANNER WRAPPER
   ========================================================= */
.tf-banner-wrap {
    display: block;
    text-align: center;
    line-height: 0;
    margin: 0 auto;
}

.tf-banner-wrap a {
    display: inline-block;
    line-height: 0;
    text-decoration: none;
}

.tf-banner-wrap img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.tf-banner-wrap a:hover img {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* =========================================================
   BANNER POSITIONS
   ========================================================= */

/* Header Top — leaderboard full width */
.banner-pos-header_top {
    width: 100%;
    background: rgba(0,0,0,.08);
    padding: 6px 0;
}

.banner-pos-header_top .tf-banner-wrap {
    max-width: 728px;
}

/* Header Bottom */
.banner-pos-header_bottom {
    width: 100%;
    padding: 8px 0;
    text-align: center;
}

.banner-pos-header_bottom .tf-banner-wrap {
    max-width: 970px;
}

/* Sidebar — rectangle 300×250 */
.banner-pos-sidebar_top,
.banner-pos-sidebar_bottom {
    margin: 12px 0;
}

.banner-pos-sidebar_top .tf-banner-wrap,
.banner-pos-sidebar_bottom .tf-banner-wrap {
    max-width: 300px;
}

/* Before / After Chapter */
.banner-pos-before_chapter,
.banner-pos-after_chapter,
.banner-pos-between_chapters {
    margin: 20px auto;
    text-align: center;
}

.banner-pos-before_chapter .tf-banner-wrap,
.banner-pos-after_chapter .tf-banner-wrap,
.banner-pos-between_chapters .tf-banner-wrap {
    max-width: 728px;
}

/* Novel Detail — dưới action buttons */
.banner-pos-novel_detail {
    margin: 16px 0;
    text-align: center;
}

/* Footer */
.banner-pos-footer {
    padding: 12px 0;
    text-align: center;
    background: rgba(0,0,0,.05);
}

/* =========================================================
   FLOATING BANNERS
   ========================================================= */
.banner-pos-floating_left,
.banner-pos-floating_right {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
    line-height: 0;
}

.banner-pos-floating_left  { left:  0; }
.banner-pos-floating_right { right: 0; }

.banner-pos-floating_left  .tf-banner-wrap,
.banner-pos-floating_right .tf-banner-wrap {
    position: relative;
}

/* Close button for floating */
.tf-banner-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    border: none;
    display: none;
}

.banner-pos-floating_left:hover  .tf-banner-close,
.banner-pos-floating_right:hover .tf-banner-close {
    display: block;
}

.tf-banner-close:hover {
    background: rgba(0,0,0,.85);
}

/* =========================================================
   POPUP BANNER
   ========================================================= */
.tf-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: tfFadeIn .25s ease;
}

.tf-popup-box {
    position: relative;
    max-width: 600px;
    width: 92%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    animation: tfSlideUp .3s ease;
}

.tf-popup-box img {
    display: block;
    width: 100%;
    height: auto;
}

.tf-popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,.7);
    color: #fff;
    font-size: 18px;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,.3);
    z-index: 10;
    transition: background .2s;
}

.tf-popup-close:hover {
    background: rgba(0,0,0,.9);
}

/* Countdown timer inside popup */
.tf-popup-timer {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    pointer-events: none;
}

/* =========================================================
   HTML BANNER (custom code)
   ========================================================= */
.tf-banner-html {
    overflow: hidden;
    border-radius: 4px;
}

/* =========================================================
   BADGE — "Quảng cáo" label
   ========================================================= */
.tf-ad-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted, #999);
    text-align: center;
    margin-top: 2px;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
    .banner-pos-header_top .tf-banner-wrap,
    .banner-pos-header_bottom .tf-banner-wrap,
    .banner-pos-before_chapter .tf-banner-wrap,
    .banner-pos-after_chapter .tf-banner-wrap,
    .banner-pos-between_chapters .tf-banner-wrap {
        max-width: 320px;
    }

    .banner-pos-floating_left,
    .banner-pos-floating_right {
        display: none; /* Ẩn floating trên mobile nhỏ */
    }

    .tf-popup-box {
        max-width: 94%;
    }
}

/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes tfFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes tfSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* =========================================================
   DARK MODE ADJUSTMENTS
   ========================================================= */
[data-theme="dark"] .banner-pos-header_top {
    background: rgba(255,255,255,.04);
}

[data-theme="dark"] .banner-pos-footer {
    background: rgba(255,255,255,.03);
}

[data-theme="dark"] .tf-ad-label {
    color: var(--text-muted-dark, #666);
}

/* ── Popup overlay chuẩn ── */
#tf-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: tfFadeIn .25s ease;
}
#tf-popup-box {
    position: relative;
    max-width: 600px;
    width: 92%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    animation: tfSlideUp .3s ease;
    background: #fff;
}
#tf-popup-box img { display: block; width: 100%; height: auto; }
#tf-popup-close {
    position: absolute;
    top: 8px; right: 10px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,.7);
    color: #fff;
    font-size: 18px;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,.3);
    z-index: 10;
    transition: background .2s;
}
#tf-popup-close:hover { background: rgba(0,0,0,.9); }
#tf-popup-timer {
    position: absolute;
    bottom: 10px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    pointer-events: none;
}
