/* Responsive Ad Styles */
.ads-container {
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.ad-wrapper, .single-ad-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.ad-wrapper:hover, .single-ad-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.ad-image {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.ad-link {
    text-decoration: none;
    display: block;
}

.ad-text-link {
    display: block;
    padding: 1rem;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: color 0.3s ease;
}

.ad-text-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.ad-text {
    display: block;
    padding: 1rem;
    text-align: center;
    color: #495057;
}

.ad-embed {
    width: 100%;
    height: 100%;
}

.ad-label {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Size-specific styles */
.ad-square {
    width: 300px;
    height: 300px;
    max-width: 100%;
}

.ad-landscape {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

.ad-half-horizontal {
    width: 468px;
    height: 60px;
    max-width: 100%;
}

.ad-vertical-banner {
    width: 160px;
    height: 600px;
    max-width: 100%;
}

.ad-mobile-banner {
    width: 320px;
    height: 50px;
    max-width: 100%;
}

.ad-large-rectangle {
    width: 336px;
    height: 280px;
    max-width: 100%;
}

.ad-responsive {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 120px;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .ad-landscape {
        width: 100%;
        max-width: 320px;
        height: 50px;
    }
    
    .ad-square {
        width: 100%;
        max-width: 300px;
        height: auto;
        aspect-ratio: 1;
    }
    
    .ad-half-horizontal {
        width: 100%;
        max-width: 320px;
        height: 50px;
    }
    
    .ad-vertical-banner {
        width: 100%;
        max-width: 160px;
        height: 300px;
    }
    
    .ad-large-rectangle {
        width: 100%;
        max-width: 280px;
        height: auto;
        aspect-ratio: 1.2;
    }
    
    .ads-container {
        margin: 0.5rem 0;
        gap: 0.5rem;
    }
    
    .ad-wrapper, .single-ad-wrapper {
        margin: 0 auto;
    }
}

/* Desktop-specific adjustments */
@media (min-width: 1200px) {
    .ad-landscape {
        width: 728px;
    }
    
    .ad-half-horizontal {
        width: 468px;
    }
}

/* Location-specific styles */
.ads-location-home {
    justify-content: center;
    margin: 2rem 0;
}

.ads-location-post_detail {
    margin: 1.5rem 0;
}

.ads-location-category {
    margin: 1rem 0;
}

/* Animation for ad loading */
.ad-wrapper, .single-ad-wrapper {
    opacity: 0;
    animation: fadeInAd 0.5s ease forwards;
}

@keyframes fadeInAd {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Error/Fallback styles */
.ad-error {
    width: 100%;
    height: 120px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-style: italic;
    border-radius: 8px;
}

/* Accessibility */
.ad-wrapper:focus-within, .single-ad-wrapper:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.ad-link:focus {
    outline: none;
}

/* Print styles */
@media print {
    .ad-wrapper, .single-ad-wrapper, .ads-container {
        display: none !important;
    }
}
