/* =============================================================================
   ADS — ô quảng cáo (AdSense + quảng cáo nhà). Tiền tố .adx- riêng.
   - Giữ sẵn chiều cao tối thiểu -> trang không nhảy khi quảng cáo tải (CLS).
   - TUYỆT ĐỐI không in ra giấy, kể cả quảng cáo tự động (Auto ads) Google chèn vào.
   ============================================================================= */
.adx-slot {
    position: relative;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 6px 10px 8px;
    font-family: inherit;
    color: #0f172a;
}

.adx-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 4px;
}

.adx-house {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.adx-icon {
    flex: 0 0 auto;
    font-size: 30px;
    line-height: 1;
}

.adx-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.adx-title {
    font-size: 15px;
    font-weight: 800;
    color: #1d4ed8;
}

.adx-desc {
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
}

.adx-cta {
    flex: 0 0 auto;
    background: #f97316;
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
}

.adx-remove {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 10.5px;
    color: #64748b;
    text-decoration: underline;
}

/* --- Banner ngang: trên / dưới tờ giấy, trang QR, kho đề --- */
.adx-banner {
    width: 100%;
    max-width: 970px;
    min-height: 110px;
    margin: 0 auto;
}

/* Khoảng cách với khu nút bấm: chống nhấp nhầm (chính sách AdSense) */
.adx-wrap {
    width: 100%;
    padding: 28px 8px 0;
    box-sizing: border-box;
}

.adx-wrap.adx-after {
    padding: 4px 8px 24px;
}

/* Khung VIP/không có quảng cáo -> không chừa khoảng trắng */
.adx-wrap:empty,
.ad-banner-slot:empty {
    display: none !important;
}

/* Cột 2 bên: bỏ kiểu viền nét đứt "giữ chỗ" cũ trong print_core.css */
.ad-banner-slot {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    display: block;
}

/* --- Cột dọc 2 bên tờ giấy (chỉ màn hình >= 1220px, do .ad-banner-slot quản lý) --- */
.adx-side {
    min-height: 600px;
    border: none;
    padding: 0;
}

.adx-side .adx-house {
    flex-direction: column;
    text-align: center;
    gap: 8px;
}

.adx-side .adx-title {
    font-size: 14px;
}

/* Cột hẹp 160px: link "Tắt quảng cáo" xuống dòng riêng thay vì nằm góc phải */
.adx-side .adx-remove {
    position: static;
    display: block;
    margin-top: 10px;
    text-align: center;
}

/* Điện thoại: ô gọn ~100px để tổng diện tích quảng cáo < 30% trang (Better Ads Standards) */
@media (max-width: 680px) {
    .adx-house {
        gap: 10px;
    }

    .adx-icon {
        font-size: 24px;
    }

    .adx-title {
        font-size: 14px;
    }

    .adx-desc {
        font-size: 12px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .adx-cta {
        padding: 7px 10px;
        font-size: 12px;
    }

    .adx-banner {
        min-height: 92px;
    }
}

/* Quảng cáo tự động của Google không được phép chèn vào trong tờ giấy A4 */
[x-cloak] {
    display: none !important;
}

#a4-sheets-wrapper .ad-slot-container,
#a4-sheets-wrapper ins.adsbygoogle,
#a4-sheets-wrapper .google-auto-placed {
    display: none !important;
    height: 0 !important;
}

/* --- Smart Ad Slot (Tabler UI + Zero CLS) --- */
.ad-slot-container {
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

.edtech-sidebar .ad-slot-container {
    margin: 0 auto 14px auto;
}

.smart-ad-skeleton {
    border: 1px dashed #cbd5e1 !important;
    background: #f8fafc !important;
    border-radius: 12px !important;
}

.smart-house-card,
.smart-ad-live {
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.smart-house-card:hover {
    border-color: #93c5fd !important;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08) !important;
}

.smart-house-img-wrap {
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: #f1f5f9;
}

/* --- Modal Chuẩn bị Bản in A4 (#modal-print-interstitial) --- */
#modal-print-interstitial {
    z-index: 1065;
}

.smart-print-backdrop {
    z-index: 1060;
}

/* --- Cột Ghim Cố Định Bên Phải (Desktop >= 1440px: 0 đè A4, 0 trùng thanh đáy) --- */
.sticky-right-rail {
    position: fixed; right: 10px; top: 72px; width: 228px; z-index: 1020;
    max-height: calc(100vh - 86px); overflow-y: auto; scrollbar-width: thin;
    display: none; flex-direction: column; gap: 10px; padding-bottom: 10px;
}
@media (min-width: 1440px) {
    .sticky-right-rail { display: flex; }
    .sticky-promo-bar { display: none !important; }
    .edtech-canvas-area { padding-right: 248px !important; padding-bottom: 40px !important; }
}
@media (min-width: 1520px) {
    .sticky-right-rail { width: 256px; right: 16px; }
    .edtech-canvas-area { padding-right: 282px !important; }
}
.sticky-rail-card {
    background: #ffffff; border: 1.5px solid #cbd5e1; border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08); padding: 11px 12px;
}
.sticky-rail-donate { border-color: #f59e0b; background: linear-gradient(180deg, #fffbeb 0%, #ffffff 42%); }
.sticky-rail-qr { width: 148px; height: auto; max-height: 186px; object-fit: contain; background: #ffffff; border-radius: 10px; border: 1px solid #fde68a; padding: 3px; }

/* --- Thanh Ghim Đáy Màn Hình (chỉ hiện trên màn nhỏ < 1280px khi không có cột phải) --- */
.sticky-promo-bar {
    position: fixed; left: var(--ed-sidebar-w, 400px); right: 0; bottom: 0; z-index: 1025;
    background: linear-gradient(90deg, #fffbeb 0%, #ffffff 35%, #f0fdf4 100%);
    backdrop-filter: blur(10px); border-top: 2px solid #f59e0b;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.12);
    padding: 9px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.sticky-promo-bar.is-dismissed { display: none !important; }
.sticky-promo-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.sticky-promo-title { font-size: 0.9rem; font-weight: 800; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sticky-promo-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.edtech-canvas-area { padding-bottom: 84px !important; }
@media (max-width: 991.98px) {
    .sticky-promo-bar { left: 0; padding: 8px 10px; gap: 8px; }
    .sticky-promo-badge, .sticky-promo-extra { display: none !important; }
}

@media print {

    .sticky-right-rail,
    .sticky-promo-bar,
    .ad-slot-container,
    .adx-slot,
    .adx-wrap,
    .adsbygoogle,
    ins.adsbygoogle,
    .google-auto-placed,
    #modal-print-interstitial,
    .smart-print-backdrop,
    iframe[id^="aswift"],
    iframe[id^="google_ads"] {
        display: none !important;
        height: 0 !important;
    }
}
