/* ============================================================
   Kost Dua Putra - Ad Styles
   ============================================================
   CSS untuk iklan yang:
   - Tidak mengganggu user experience
   - Mencegah CLS (Cumulative Layout Shift)
   - Responsive untuk semua ukuran layar
   - Terintegrasi dengan desain website
   ============================================================ */

/* ===== AD SLOT CONTAINER ===== */
.ad-slot {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== AD CONTAINER (setiap slot) ===== */
.ad-container {
    width: 100%;
    max-width: 728px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: #f9fafb;
    border: 1px solid #f0f0f0;
    transition: opacity 0.3s ease;
}

/* ===== AD LABEL "Iklan" ===== */
.ad-label {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 0.58rem;
    font-weight: 500;
    color: #bbb;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    z-index: 2;
    pointer-events: none;
    font-family: 'Poppins', sans-serif;
}

/* ===== AD INNER (tempat iklan di-render) ===== */
.ad-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== FORMAT: HORIZONTAL (728x90 / 320x100) ===== */
.ad-slot-horizontal .ad-container {
    /* Cadangkan tinggi untuk mencegah CLS */
    min-height: 90px;
}

.ad-slot-horizontal .ad-inner {
    min-height: 90px;
}

/* ===== FORMAT: NATIVE BANNER (Adsterra / MGID) ===== */
.ad-slot-native .ad-container {
    max-width: 728px;
    min-height: 120px;
}

.ad-slot-native .ad-inner {
    min-height: 120px;
}

/* ===== FORMAT: RECTANGLE (300x250 / 336x280) ===== */
.ad-slot-rectangle .ad-container {
    max-width: 336px;
    min-height: 250px;
}

.ad-slot-rectangle .ad-inner {
    min-height: 250px;
}

/* ===== STICKY ANCHOR AD ===== */
.ad-sticky-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9990;
    background: #fff;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.1);
    border-top: 1px solid #e5e7eb;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
}

.ad-sticky-wrapper.ad-sticky-visible {
    transform: translateY(0);
}

.ad-sticky-wrapper .ad-container {
    max-width: 728px;
    min-height: 50px;
    background: transparent;
    border: none;
    border-radius: 0;
}

.ad-sticky-wrapper .ad-inner {
    min-height: 50px;
}

/* Tombol tutup sticky ad */
.ad-sticky-close {
    position: absolute;
    top: -12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    color: #9ca3af;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    z-index: 2;
}

.ad-sticky-close:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* ===== LOADED STATE ===== */
.ad-container.ad-loaded {
    background: transparent;
    border-color: transparent;
}

/* ===== VISUAL SEPARATION ===== */
/* Garis halus antara konten dan iklan agar tidak mengganggu */
.ad-slot::before,
.ad-slot::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background: #e5e7eb;
}

.ad-slot::before {
    top: 0;
}

.ad-slot::after {
    bottom: 0;
}

/* ===== BACKGROUND WARNA PER SECTION ===== */
/* Sesuaikan background iklan dengan section sekitarnya */

/* After Hero - Background putih */
section.hero + .ad-slot {
    background: #fff;
}

/* Between sections - Background light */
.facilities + .ad-slot {
    background: var(--light, #F8F9FA);
}

/* After testimonials - Transition dari gelap ke terang */
.testimonials + .ad-slot {
    background: linear-gradient(180deg, #1E3A5F 0%, var(--light, #F8F9FA) 100%);
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.testimonials + .ad-slot .ad-container {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
}

.testimonials + .ad-slot .ad-label {
    color: rgba(255, 255, 255, 0.5);
}

.testimonials + .ad-slot::before,
.testimonials + .ad-slot::after {
    background: rgba(255, 255, 255, 0.15);
}

/* Before footer / after CTA */
.cta + .ad-slot {
    background: #fff;
    padding-top: 1.5rem;
}

/* ===== RESPONSIVE - TABLET ===== */
@media (max-width: 1024px) {
    .ad-slot {
        padding: 0.75rem 1.5rem;
    }

    .ad-slot-rectangle .ad-container {
        max-width: 300px;
        min-height: 250px;
    }
}

/* ===== RESPONSIVE - MOBILE ===== */
@media (max-width: 768px) {
    .ad-slot {
        padding: 0.5rem 1rem;
    }

    /* Horizontal ads menjadi mobile banner */
    .ad-slot-horizontal .ad-container {
        max-width: 100%;
        min-height: 100px;
    }

    .ad-slot-horizontal .ad-inner {
        min-height: 100px;
    }

    /* Rectangle tetap di tengah */
    .ad-slot-rectangle .ad-container {
        max-width: 300px;
        min-height: 250px;
    }

    /* Sticky ad mobile - di atas bottom nav */
    .ad-sticky-wrapper {
        padding: 4px 8px;
        bottom: 56px; /* Above bottom-nav */
    }

    .ad-sticky-wrapper .ad-container {
        min-height: 50px;
    }

    .ad-sticky-wrapper .ad-inner {
        min-height: 50px;
    }

    /* Visual separator lebih halus di mobile */
    .ad-slot::before,
    .ad-slot::after {
        width: 40px;
    }
}

@media (max-width: 480px) {
    .ad-slot {
        padding: 0.4rem 0.75rem;
    }

    .ad-slot-horizontal .ad-container {
        min-height: 60px;
        border-radius: 8px;
    }

    .ad-slot-horizontal .ad-inner {
        min-height: 60px;
    }

    .ad-slot-rectangle .ad-container {
        max-width: 100%;
    }
}

/* ===== PRINT - Sembunyikan iklan saat print ===== */
@media print {
    .ad-slot,
    .ad-sticky-wrapper {
        display: none !important;
    }
}

/* ===== ACCESSIBILITY ===== */
/* Pastikan iklan tidak mengganggu screen reader */
.ad-container[aria-hidden="true"] {
    visibility: hidden;
    height: 0;
    overflow: hidden;
}

/* ===== ANTI-ADBLOCK FALLBACK ===== */
/* Jika iklan diblokir, container tetap rapi */
.ad-container:empty,
.ad-inner:empty {
    min-height: 0 !important;
}

.ad-slot:has(.ad-inner:empty) {
    padding: 0;
    min-height: 0;
}

/* AdSense specific fixes */
.adsbygoogle {
    display: block;
    width: 100%;
}

ins.adsbygoogle {
    background: transparent;
}

/* ===== PADDING ADJUSTMENT ===== */
/* Tambah padding pada body untuk sticky ad */
body.has-sticky-ad {
    padding-bottom: 62px;
}
