/**
 * Catenaa Ads Styles
 * 
 * @package Catenaa
 * @since 1.0.0
 */

/* ==========================================================================
   Ad Container Styles
   ========================================================================== */

.catenaa-ad {
    display: block;
    margin: 1rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.catenaa-ad img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.catenaa-ad a {
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.3s ease;
}

.catenaa-ad a:hover {
    opacity: 0.8;
}

/* ==========================================================================
   Ad Zone Specific Styles
   ========================================================================== */

/* Header Banner */
.catenaa-ad[data-zone="header"] {
    width: 100%;
    margin: 0 0 2rem 0;
}

.catenaa-ad[data-zone="header"] img {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
}

/* Sidebar Ads */
.catenaa-ad[data-zone="sidebar"] {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.catenaa-ad[data-zone="sidebar"] img {
    max-width: 100%;
    border-radius: 4px;
}

/* Article Ads */
.catenaa-ad[data-zone="article_top"],
.catenaa-ad[data-zone="article_middle"],
.catenaa-ad[data-zone="article_bottom"] {
    margin: 2rem auto;
    padding: 1rem;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    background: #fafbfc;
    max-width: 600px;
}

.catenaa-ad[data-zone="article_top"] {
    margin-top: 1rem;
}

.catenaa-ad[data-zone="article_bottom"] {
    margin-bottom: 1rem;
}

/* Footer Ads */
.catenaa-ad[data-zone="footer"] {
    margin: 2rem 0 1rem 0;
    padding: 1.5rem;
    background: #343a40;
    color: #fff;
    border-radius: 8px;
}

.catenaa-ad[data-zone="footer"] a {
    color: #fff;
}

/* Mobile Banner */
.catenaa-ad[data-zone="mobile_banner"] {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border-top: 2px solid #007cba;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    margin: 0;
}

.catenaa-ad[data-zone="mobile_banner"] img {
    max-height: 60px;
}

/* Popup/Modal Ads */
.catenaa-ad[data-zone="popup"] {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

.catenaa-ad[data-zone="popup"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

/* ==========================================================================
   Ad Type Specific Styles
   ========================================================================== */

/* Text Ads */
.catenaa-ad[data-type="text"] {
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
    text-align: left;
}

.catenaa-ad[data-type="text"] a {
    color: #fff;
    font-weight: 600;
}

.catenaa-ad[data-type="text"] h3,
.catenaa-ad[data-type="text"] h4 {
    margin: 0 0 0.5rem 0;
    color: #fff;
}

/* Banner Ads */
.catenaa-ad[data-type="banner"] {
    border-radius: 8px;
    overflow: hidden;
}

.catenaa-ad[data-type="banner"] img {
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.catenaa-ad[data-type="banner"]:hover img {
    transform: scale(1.02);
}

/* Video Ads */
.catenaa-ad[data-type="video"] {
    position: relative;
}

.catenaa-ad[data-type="video"] video {
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
}

/* Affiliate Ads */
.catenaa-ad[data-type="affiliate"] {
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 1rem;
    background: #f8fff9;
}

.catenaa-ad[data-type="affiliate"] a {
    color: #28a745;
    font-weight: 600;
    text-decoration: none;
}

.catenaa-ad[data-type="affiliate"] a:hover {
    text-decoration: underline;
}

.catenaa-ad[data-type="affiliate"]::before {
    content: "Sponsored";
    display: inline-block;
    background: #28a745;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-weight: 600;
}

/* Google Ads */
.catenaa-ad[data-type="google_ads"] {
    position: relative;
}

.catenaa-ad[data-type="google_ads"]::after {
    content: "Advertisement";
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
}

/* ==========================================================================
   Header Ad Space Responsive Images
   ========================================================================== */

.ad-space__content {
    display: block;
    width: 100%;
    position: relative;
}

.ad-space__image {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Desktop image - show only on devices 768px and above */
.ad-space__image--desktop {
    display: block;
}

/* Mobile image - hide by default */
.ad-space__image--mobile {
    display: none;
}

/* Mobile responsive - show mobile image below 768px */
@media (max-width: 767px) {
    .ad-space__image--desktop {
        display: none;
    }
    
    .ad-space__image--mobile {
        display: block;
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .catenaa-ad[data-zone="header"] {
        margin: 0 0 1rem 0;
    }
    
    .catenaa-ad[data-zone="header"] img {
        max-height: 80px;
    }
    
    .catenaa-ad[data-zone="sidebar"] {
        margin: 1rem 0;
        padding: 0.75rem;
    }
    
    .catenaa-ad[data-zone="article_top"],
    .catenaa-ad[data-zone="article_middle"],
    .catenaa-ad[data-zone="article_bottom"] {
        margin: 1.5rem auto;
        padding: 0.75rem;
    }
    
    .catenaa-ad[data-zone="popup"] {
        padding: 1rem;
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .catenaa-ad[data-zone="mobile_banner"] {
        padding: 0.25rem;
    }
    
    .catenaa-ad[data-zone="mobile_banner"] img {
        max-height: 50px;
    }
}

@media (min-width: 1200px) {
    .catenaa-ad[data-zone="header"] img {
        max-height: 150px;
    }
    
    .catenaa-ad[data-zone="article_top"],
    .catenaa-ad[data-zone="article_middle"],
    .catenaa-ad[data-zone="article_bottom"] {
        max-width: 728px;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

.catenaa-ad:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.catenaa-ad a:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Screen reader text for sponsored content */
.catenaa-ad .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Animation Effects
   ========================================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.catenaa-ad.animate-in {
    animation: fadeInUp 0.6s ease-out;
}

/* Hover effects */
.catenaa-ad {
    transition: all 0.3s ease;
}

.catenaa-ad:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.catenaa-ad[data-zone="sidebar"]:hover,
.catenaa-ad[data-zone="article_top"]:hover,
.catenaa-ad[data-zone="article_middle"]:hover,
.catenaa-ad[data-zone="article_bottom"]:hover {
    border-color: #007cba;
    box-shadow: 0 4px 20px rgba(0, 124, 186, 0.15);
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .catenaa-ad {
        display: none !important;
    }
}

/* ==========================================================================
   Widget Area Styles
   ========================================================================== */

.widget .catenaa-ad {
    margin: 0;
}

.widget .catenaa-ad img {
    width: 100%;
    height: auto;
}

/* ==========================================================================
   Admin Preview Styles
   ========================================================================== */

.single-ad .admin-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    color: #856404;
}

.single-ad .ad-settings-preview {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 4px;
}

.single-ad .ad-settings-preview h3 {
    margin: 0 0 15px 0;
    color: #495057;
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .catenaa-ad[data-zone="sidebar"] {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .catenaa-ad[data-zone="article_top"],
    .catenaa-ad[data-zone="article_middle"],
    .catenaa-ad[data-zone="article_bottom"] {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .catenaa-ad[data-zone="popup"] {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .catenaa-ad[data-type="affiliate"] {
        background: #1a2332;
        border-color: #38a169;
        color: #e2e8f0;
    }
}
