/**
 * نظام الإعلانات المتقدم - Ads System
 * @package Lahzat_News
 * @version 1.0
 */

/* ===================================== */
/* منع الإعلانات فوق الهيدر             */
/* ===================================== */
body > ins.adsbygoogle:first-child,
body > .adsbygoogle:first-child,
body::before,
#page::before,
.site-header::before {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    overflow: hidden !important;
}

body > ins.adsbygoogle:first-child,
body > .adsbygoogle:first-child {
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* ===================================== */
/* حاويات الإعلانات الأساسية            */
/* ===================================== */
.kora-ad-after-header,
.kora-ad-top-post,
.kora-ad-bottom-post,
.kora-ad-between-para,
.kora-ad-in-loop {
    margin: 25px auto;
    padding: 15px;
    overflow: hidden;
    text-align: center;
}

.kora-ad-after-header {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 0;
    text-align: center;
}

/* حاوية الإعلان 300x320 - مكان محجوز */
.ad-container-300x320 {
    width: 300px;
    height: 320px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.ad-container-300x320 ins,
.ad-container-300x320 iframe,
.ad-container-300x320 > * {
    width: 300px !important;
    height: 320px !important;
    max-width: 300px !important;
    max-height: 320px !important;
    display: block;
    margin: 0 auto;
}

.kora-ad-after-header ins,
.kora-ad-top-post ins,
.kora-ad-bottom-post ins,
.kora-ad-between-para ins,
.kora-ad-in-loop ins {
    display: block !important;
    margin: 0 auto !important;
}

/* ===================================== */
/* إعلان الموبايل المعلق - Sticky Ad    */
/* ===================================== */
.nl7za-sticky-ad {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999999;
    background: #ffffff;
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.2);
    padding: 12px;
    text-align: center;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInAd 0.5s ease-out;
}

.nl7za-sticky-bottom {
    bottom: 0;
    transform: translateY(100%);
}

.nl7za-sticky-bottom.nl7za-visible {
    transform: translateY(0);
}

.nl7za-sticky-top {
    top: 0;
    transform: translateY(-100%);
}

.nl7za-sticky-top.nl7za-visible {
    transform: translateY(0);
}

/* زر الإغلاق المميز */
.nl7za-sticky-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #ff0000, #cc0000);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 3px 6px rgba(255, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.nl7za-sticky-close:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.5);
}

.nl7za-sticky-close:active {
    transform: scale(0.95);
}

.nl7za-sticky-close svg {
    transition: transform 0.3s ease;
}

.nl7za-sticky-close:hover svg {
    transform: rotate(180deg);
}

/* محتوى الإعلان المعلق */
.nl7za-sticky-ad-content {
    max-width: 320px;
    margin: 0 auto;
    min-height: 50px;
}

/* ===================================== */
/* Animation للإعلانات                  */
/* ===================================== */
@keyframes slideInAd {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInAd {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.kora-ad-fade-in {
    animation: fadeInAd 0.6s ease-in;
}

/* ===================================== */
/* إعلانات السايدبار                    */
/* ===================================== */
.kora-sidebar-ad {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.kora-sidebar-ad ins {
    display: block !important;
    margin: 0 auto !important;
}

/* ===================================== */
/* تسميات الإعلانات (Sponsored)         */
/* ===================================== */
.ad-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.ad-label::before {
    content: "📢 ";
}

/* ===================================== */
/* Responsive Design                     */
/* ===================================== */
@media (max-width: 768px) {
    .kora-ad-after-header,
    .kora-ad-top-post,
    .kora-ad-bottom-post,
    .kora-ad-between-para,
    .kora-ad-in-loop {
        max-width: 100% !important;
        padding: 10px 5px;
        margin: 15px auto;
    }
    
    /* إعلان 300x320 على الموبايل - مربع متجاوب */
    .ad-container-300x320 {
        width: 300px;
        height: 300px; /* مربع على الموبايل */
        max-width: calc(100% - 20px);
        max-height: 300px;
    }
    
    .ad-container-300x320 ins,
    .ad-container-300x320 iframe,
    .ad-container-300x320 > * {
        width: 100% !important;
        height: 300px !important;
        max-width: 300px !important;
        max-height: 300px !important;
    }
    
    .nl7za-sticky-ad {
        padding: 8px;
    }
    
    .nl7za-sticky-close {
        width: 28px;
        height: 28px;
        top: 5px;
        right: 5px;
    }
    
    .nl7za-sticky-close svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .kora-ad-after-header,
    .kora-ad-top-post,
    .kora-ad-bottom-post,
    .kora-ad-between-para,
    .kora-ad-in-loop {
        padding: 8px 3px;
        margin: 12px auto;
    }
}

/* ===================================== */
/* حماية من Ad Blockers                 */
/* ===================================== */
.kora-ad-fallback {
    min-height: 100px;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
    padding: 20px;
}

/* ===================================== */
/* Dark Mode Support                     */
/* ===================================== */
.dark-mode .kora-ad-after-header,
.dark-mode .kora-sidebar-ad {
    background: #1a1a1a;
    border-color: #333;
}

.dark-mode .nl7za-sticky-ad {
    background: #1e1e1e;
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.5);
}

.dark-mode .ad-label {
    color: #aaa;
}

/* ===================================== */
/* Performance Optimization              */
/* ===================================== */
.kora-ad-lazy-load {
    min-height: 250px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ===================================== */
/* Print Style - إخفاء الإعلانات عند الطباعة */
/* ===================================== */
@media print {
    .kora-ad-after-header,
    .kora-ad-top-post,
    .kora-ad-bottom-post,
    .kora-ad-between-para,
    .kora-ad-in-loop,
    .nl7za-sticky-ad,
    .kora-sidebar-ad {
        display: none !important;
    }
}

