/* Smalk AI Ads Frontend Styles */

/* Base Container Styles */
.smalk-ai-ads-container {
    margin: 20px 0;
    clear: both;
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
}

.smalk-ai-ads-container * {
    box-sizing: border-box;
}

/* Loading States */
.smalk-ad-placeholder {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smalk-ad-loading {
    font-size: 14px;
    font-style: italic;
    position: relative;
}

.smalk-ad-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #6c757d;
    border-radius: 50%;
    border-top: 2px solid transparent;
    animation: spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ad Content Container */
.smalk-ad-content {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.smalk-ai-ads-container.smalk-ad-loaded .smalk-ad-content {
    opacity: 1;
}

/* Text Ad Styles */
.smalk-text-ad {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.smalk-ad-title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    line-height: 1.3;
}

.smalk-ad-body {
    margin: 0 0 15px 0;
    color: #495057;
    line-height: 1.5;
    font-size: 14px;
}

.smalk-ad-cta {
    display: inline-block;
    background: #007bff;
    color: white !important;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.2s ease;
    border: none;
}

.smalk-ad-cta:hover {
    background: #0056b3;
    text-decoration: none;
    color: white !important;
}

/* Image Ad Styles */
.smalk-image-ad {
    text-align: center;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.smalk-image-ad a:hover .smalk-ad-image {
    transform: scale(1.02);
}

.smalk-ad-caption {
    padding: 12px;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
}

/* Video Ad Styles */
.smalk-video-ad {
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.smalk-ad-video {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
}

.smalk-ad-description {
    background: #fff;
    padding: 15px;
    color: #495057;
    font-size: 14px;
    line-height: 1.5;
}

/* Native Ad Styles */
.smalk-native-ad {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
}

.smalk-ad-label {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #6c757d;
    color: white;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 2px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.smalk-native-headline {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #212529;
    line-height: 1.4;
}

.smalk-native-body {
    margin: 0 0 15px 0;
    color: #495057;
    line-height: 1.5;
    font-size: 14px;
}

.smalk-native-image {
    width: 100%;
    height: auto;
    margin: 15px 0;
    border-radius: 4px;
}

.smalk-native-cta {
    display: inline-block;
    background: transparent;
    color: #007bff;
    border: 1px solid #007bff;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.smalk-native-cta:hover {
    background: #007bff;
    color: white;
    text-decoration: none;
}

/* Fallback Ad Styles */
.smalk-fallback-ad,
.smalk-ad-error {
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    font-size: 13px;
}

.smalk-ad-error {
    background: #fff5f5;
    border-color: #fed7d7;
    color: #c53030;
}

/* Position-Specific Styles */
.smalk-ad-position-top_page {
    margin-top: 0;
    margin-bottom: 30px;
}

.smalk-ad-position-bottom_page {
    margin-top: 30px;
    margin-bottom: 0;
}

.smalk-ad-position-paragraph {
    margin: 25px 0;
}

.smalk-ad-position-image {
    margin: 25px 0;
}

.smalk-ad-position-sidebar {
    margin: 15px 0;
}

.smalk-ad-position-widget {
    margin: 10px 0;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .smalk-ai-ads-container {
        margin: 15px 0;
    }
    
    .smalk-text-ad,
    .smalk-native-ad {
        padding: 15px;
    }
    
    .smalk-ad-title {
        font-size: 16px;
    }
    
    .smalk-native-headline {
        font-size: 15px;
    }
    
    .smalk-ad-body,
    .smalk-native-body {
        font-size: 13px;
    }
    
    .smalk-ad-cta,
    .smalk-native-cta {
        font-size: 13px;
        padding: 6px 12px;
    }
}

@media screen and (max-width: 480px) {
    .smalk-ai-ads-container {
        margin: 10px 0;
    }
    
    .smalk-text-ad,
    .smalk-native-ad {
        padding: 12px;
    }
    
    .smalk-ad-title {
        font-size: 15px;
    }
    
    .smalk-native-headline {
        font-size: 14px;
    }
    
    .smalk-ad-body,
    .smalk-native-body,
    .smalk-ad-description {
        font-size: 12px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .smalk-text-ad,
    .smalk-image-ad,
    .smalk-native-ad {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .smalk-ad-title,
    .smalk-native-headline {
        color: #f7fafc;
    }
    
    .smalk-ad-body,
    .smalk-native-body,
    .smalk-ad-description {
        color: #cbd5e0;
    }
    
    .smalk-ad-placeholder,
    .smalk-fallback-ad {
        background: #2d3748;
        border-color: #4a5568;
        color: #a0aec0;
    }
    
    .smalk-ad-loading {
        color: #a0aec0;
    }
    
    .smalk-ad-loading::after {
        border-color: #a0aec0;
        border-top-color: transparent;
    }
}

/* Print Styles */
@media print {
    .smalk-ai-ads-container {
        display: none !important;
    }
}

/* Accessibility Improvements */
.smalk-ai-ads-container:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.smalk-ad-cta:focus,
.smalk-native-cta:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Animation Classes */
.smalk-fade-in {
    animation: fadeIn 0.5s ease-in;
}

.smalk-slide-up {
    animation: slideUp 0.3s ease-out;
}

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

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

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .smalk-text-ad,
    .smalk-image-ad,
    .smalk-native-ad {
        border: 2px solid #000;
        background: #fff;
    }
    
    .smalk-ad-title,
    .smalk-native-headline {
        color: #000;
    }
    
    .smalk-ad-cta {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }
    
    .smalk-native-cta {
        border: 2px solid #000;
        color: #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .smalk-ai-ads-container *,
    .smalk-ad-content,
    .smalk-ad-image,
    .smalk-ad-cta,
    .smalk-native-cta {
        transition: none !important;
        animation: none !important;
    }
    
    .smalk-ad-loading::after {
        animation: none;
        border: 2px solid #6c757d;
    }
}

/* Special Layout Classes */
.smalk-ads-compact .smalk-text-ad,
.smalk-ads-compact .smalk-native-ad {
    padding: 10px;
    margin: 10px 0;
}

.smalk-ads-minimal .smalk-text-ad,
.smalk-ads-minimal .smalk-native-ad {
    border: none;
    box-shadow: none;
    background: transparent;
}

.smalk-ads-bordered .smalk-text-ad,
.smalk-ads-bordered .smalk-native-ad {
    border: 2px solid #007bff;
}

/* AMP Compatibility */
.smalk-ai-ads-container amp-img {
    max-width: 100%;
    height: auto;
}

/* Custom Properties for Easy Theming */
.smalk-ai-ads-container {
    --smalk-ad-bg: #fff;
    --smalk-ad-border: #e9ecef;
    --smalk-ad-text: #495057;
    --smalk-ad-title: #212529;
    --smalk-ad-cta-bg: #007bff;
    --smalk-ad-cta-color: #fff;
    --smalk-ad-shadow: rgba(0, 0, 0, 0.1);
}

/* Use Custom Properties */
.smalk-text-ad,
.smalk-native-ad {
    background: var(--smalk-ad-bg);
    border-color: var(--smalk-ad-border);
    color: var(--smalk-ad-text);
}

.smalk-ad-title,
.smalk-native-headline {
    color: var(--smalk-ad-title);
}

.smalk-ad-cta {
    background: var(--smalk-ad-cta-bg);
    color: var(--smalk-ad-cta-color);
}

.smalk-text-ad,
.smalk-image-ad,
.smalk-native-ad {
    box-shadow: 0 2px 4px var(--smalk-ad-shadow);
}