/**
 * Ads System CSS
 * Sistema completo de publicidade para o tema Informativo Angolano
 *
 * @package Informativo_Angolano
 * @since 2.0.0
 */

/* ==========================================================================
   BASE AD STYLES
   ========================================================================== */

.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: var(--space-6) 0;
    position: relative;
    width: 100%;
}

.ad-container.has-content {
    background: var(--bg-light);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ad-label {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: var(--bg-white);
    padding: 4px 12px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 1;
}

.ad-container img {
    max-width: 100%;
    height: auto;
    display: block;
}

.ad-container a {
    display: block;
}

/* Dark Mode Support */
body.dark-mode .ad-container.has-content {
    background: var(--bg-light);
    border-color: var(--border-color);
}

body.dark-mode .ad-label {
    background: var(--bg-light);
    color: var(--text-muted);
}

/* ==========================================================================
   LEADERBOARD AD - Top Banner
   ========================================================================== */

.leaderboard-ad-container {
    position: relative;
    width: 100%;
    display: none;
    background: var(--bg-light);
}

.leaderboard-ad-container.active {
    display: block;
}

.leaderboard-ad-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-4);
    position: relative;
}

.leaderboard-ad-inner {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#mvp-leader-wrap {
    display: block;
    text-align: center;
}

.leaderboard-ad-desktop {
    max-width: 100%;
    height: auto;
    display: block;
}

.leaderboard-ad-mobile {
    display: none;
    max-width: 100%;
    height: auto;
}

.leaderboard-ad-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: all var(--transition-fast);
    z-index: 10;
}

.leaderboard-ad-close:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.leaderboard-ad-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    background: linear-gradient(135deg, var(--bg-light) 0%, #f0f0f0 100%);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    min-width: 300px;
    min-height: 100px;
}

.leaderboard-ad-placeholder .ad-label {
    top: -10px;
    background: var(--bg-white);
}

.leaderboard-ad-placeholder .ad-dimensions {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-2);
}

/* Responsive Leaderboard */
@media (max-width: 768px) {
    .leaderboard-ad-desktop {
        display: none;
    }
    
    .leaderboard-ad-mobile {
        display: block;
    }
    
    .leaderboard-ad-close {
        width: 32px;
        height: 32px;
        top: -16px;
        right: -8px;
    }
}

/* ==========================================================================
   HOMEPAGE BANNER AD
   ========================================================================== */

.homepage-banner-ad {
    margin: var(--space-8) 0;
    padding: var(--space-6);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.homepage-banner-ad .ad-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.homepage-banner-ad img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
    .homepage-banner-ad {
        margin: var(--space-6) 0;
        padding: var(--space-4);
    }
}

body.dark-mode .homepage-banner-ad {
    background: var(--bg-light);
    border-color: var(--border-color);
}

/* ==========================================================================
   IN-FEED AD - Between Posts
   ========================================================================== */

.in-feed-ad {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: var(--space-6) 0;
    padding: var(--space-6);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    min-height: 100px;
}

.in-feed-ad .ad-inner {
    text-align: center;
}

.in-feed-ad .ad-label {
    position: static;
    transform: none;
    display: inline-block;
    margin-bottom: var(--space-3);
}

.news-grid-3-col .in-feed-ad {
    grid-column: 1 / -1;
}

@media (max-width: 992px) {
    .in-feed-ad {
        margin: var(--space-4) 0;
        padding: var(--space-4);
    }
}

body.dark-mode .in-feed-ad {
    background: var(--bg-light);
    border-color: var(--border-color);
}

/* ==========================================================================
   SIDEBAR AD WIDGET
   ========================================================================== */

.sidebar-widget.ad-widget {
    margin-bottom: var(--space-6);
}

.ad-widget .ad-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-8) var(--space-4);
    min-height: 250px;
}

.ad-widget .ad-placeholder .ad-label {
    position: static;
    transform: none;
    margin-bottom: var(--space-2);
}

.ad-widget .ad-placeholder .ad-info {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.ad-widget img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

body.dark-mode .ad-widget .ad-placeholder {
    background: var(--bg-light);
    border-color: var(--border-color);
}

/* ==========================================================================
   ARTICLE CONTENT ADS
   ========================================================================== */

.article-ad {
    margin: var(--space-8) 0;
    display: flex;
    justify-content: center;
    align-items: center;
    clear: both;
}

.article-ad img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

.article-ad-left {
    float: left;
    margin-right: var(--space-6);
    margin-bottom: var(--space-4);
}

.article-ad-right {
    float: right;
    margin-left: var(--space-6);
    margin-bottom: var(--space-4);
}

.article-ad-center {
    display: flex;
    justify-content: center;
    clear: both;
}

/* After paragraphs in content */
.entry-content .article-ad {
    margin: var(--space-6) auto;
}

/* Responsive Article Ads */
@media (max-width: 600px) {
    .article-ad-left,
    .article-ad-right {
        float: none;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ==========================================================================
   ARTICLE IN-CONTENT AD
   ========================================================================== */

.article-in-content-ad {
    margin: var(--space-8) 0;
    padding: var(--space-4);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.article-in-content-ad.has-code {
    padding: var(--space-6);
}

@media (max-width: 768px) {
    .article-in-content-ad {
        margin: var(--space-6) 0;
    }
}

body.dark-mode .article-in-content-ad {
    background: var(--bg-light);
    border-color: var(--border-color);
}

/* ==========================================================================
   CATEGORY PAGE AD
   ========================================================================== */

.category-page-banner {
    margin: 0 0 var(--space-8);
    padding: var(--space-6);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.category-page-banner .ad-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
}

.category-page-banner img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
    .category-page-banner {
        margin: 0 0 var(--space-6);
        padding: var(--space-4);
    }
}

body.dark-mode .category-page-banner {
    background: var(--bg-light);
    border-color: var(--border-color);
}

/* ==========================================================================
   FOOTER AD BANNER
   ========================================================================== */

.footer-ad-banner {
    margin: 0;
    padding: var(--space-6);
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-ad-banner .ad-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    max-width: 1200px;
    width: 100%;
}

.footer-ad-banner img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
    .footer-ad-banner {
        padding: var(--space-4);
    }
}

body.dark-mode .footer-ad-banner {
    background: var(--bg-light);
    border-color: var(--border-color);
}

/* ==========================================================================
   MOBILE INTERSTITIAL AD
   ========================================================================== */

.mobile-interstitial-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: var(--space-4);
    transform: translateY(100%);
    transition: transform var(--transition-base);
    z-index: 9999;
    display: none;
}

.mobile-interstitial-ad.active {
    display: block;
    transform: translateY(0);
}

.mobile-interstitial-ad .ad-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-interstitial-ad .ad-inner {
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-interstitial-ad img {
    max-width: 100%;
    height: auto;
    max-height: 150px;
}

/* Show only on mobile */
@media (min-width: 769px) {
    .mobile-interstitial-ad {
        display: none !important;
    }
}

/* ==========================================================================
   RESPONSIVE AD SIZES
   ========================================================================== */

/* Desktop Large */
@media (min-width: 1200px) {
    .ad-container.ad-728x90 {
        min-height: 90px;
    }
    
    .ad-container.ad-970x250 {
        min-height: 250px;
    }
}

/* Desktop */
@media (min-width: 992px) {
    .ad-container.ad-300x600 {
        min-height: 600px;
    }
    
    .ad-container.ad-300x250 {
        min-height: 250px;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991px) {
    .ad-container.ad-468x60 {
        min-height: 60px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .ad-container.ad-320x100 {
        min-height: 100px;
    }
    
    .ad-container.ad-320x50 {
        min-height: 50px;
    }
}

/* ==========================================================================
   AD LOADING ANIMATION
   ========================================================================== */

.ad-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.ad-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: ad-spin 1s linear infinite;
}

@keyframes ad-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   AD PERFORMANCE OPTIMIZATION
   ========================================================================== */

.ad-container[data-adlazy="true"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ad-container[data-adlazy="true"].loaded {
    opacity: 1;
}

/* Prevent layout shift */
.ad-container.ad-fixed-size {
    min-height: var(--ad-height, 250px);
}

/* ==========================================================================
   AD ACCESSIBILITY
   ========================================================================== */

.ad-container a:focus,
.ad-widget a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.ad-label {
    font-family: var(--font-sans);
}

/* ==========================================================================
   PRINT STYLES FOR ADS
   ========================================================================== */

@media print {
    .leaderboard-ad-container,
    .sidebar-widget.ad-widget,
    .article-ad,
    .footer-ad-banner,
    .mobile-interstitial-ad {
        display: none !important;
    }
}

