/**
 * Public Styles for Simple Ad Manager
 */

/* Ad Position Wrappers */
.sam-position-wrapper {
    margin: 40px auto;
    max-width: 100%;
    padding: 0 15px;
    clear: both;
}

.sam-position-wrapper.sam-position-header {
    margin: 20px auto;
}

.sam-position-wrapper.sam-position-footer {
    margin: 30px auto 20px;
}

.sam-position-wrapper.sam-position-sidebar {
    margin: 20px 0;
}

/* Individual Ad Wrapper */
.sam-ad-wrapper {
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

.sam-ad-wrapper:last-child {
    margin-bottom: 0;
}

/* Image Ad Styles */
.sam-image-ad {
    display: block;
}

.sam-ad-link {
    display: inline-block;
    line-height: 0;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.sam-ad-link:hover {
    opacity: 0.9;
}

.sam-ad-link:active {
    transform: scale(0.98);
}

.sam-ad-image {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* Code Ad Styles */
.sam-code-ad {
    overflow: hidden;
    min-height: 50px;
}

/* Common Ad Sizes */
.sam-ad-wrapper.size-728x90 {
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
}

.sam-ad-wrapper.size-300x250 {
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.sam-ad-wrapper.size-160x600 {
    max-width: 160px;
}

.sam-ad-wrapper.size-300x600 {
    max-width: 300px;
}

/* Ad Label (optional - can be enabled via filter) */
.sam-ad-label {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

/* Loading State */
.sam-ad-wrapper.sam-loading {
    min-height: 100px;
    background: #f5f5f5;
    position: relative;
}

.sam-ad-wrapper.sam-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: sam-rotate 0.8s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .sam-position-wrapper {
        padding: 0 10px;
        margin: 30px auto;
    }
    
    .sam-ad-wrapper {
        margin-bottom: 20px;
    }
    
    /* Hide large ads on mobile if needed */
    .sam-ad-wrapper.hide-mobile {
        display: none;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet specific styles */
    .sam-position-wrapper {
        padding: 0 20px;
    }
}

@media (min-width: 1025px) {
    /* Desktop specific styles */
    .sam-position-wrapper.sam-position-before-content,
    .sam-position-wrapper.sam-position-after-content {
        max-width: 1200px;
    }
}

/* Accessibility */
.sam-ad-link:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .sam-position-wrapper,
    .sam-ad-wrapper {
        display: none !important;
    }
}

/* RTL Support */
[dir="rtl"] .sam-ad-wrapper {
    text-align: center;
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .sam-ad-wrapper.sam-loading {
        background: #2a2a2a;
    }
    
    .sam-ad-label {
        color: #666;
    }
}

/* Animation on Load (optional) */
.sam-ad-wrapper.sam-fade-in {
    animation: samFadeIn 0.5s ease-in;
}

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

/* Sticky Ad Support (can be added via filter) */
.sam-ad-wrapper.sam-sticky {
    position: sticky;
    top: 20px;
    z-index: 100;
}

/* Multiple Ads in Same Position */
.sam-position-wrapper .sam-ad-wrapper + .sam-ad-wrapper {
    margin-top: 30px;
}

/* AdSense Specific */
.sam-code-ad ins.adsbygoogle {
    display: block;
}

/* Fallback for No Ads */
.sam-position-wrapper:empty {
    display: none;
}