/**
 * Regenerating Ads CSS
 * Styles for the ad regeneration system
 */

/* Base regenerating ad styles */
.regenerating-ad {
    position: relative;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.regenerating-ad.show {
    opacity: 1;
    transform: scale(1);
}

/* Animation types */
.regenerating-ad.slide {
    transform: translateX(-100%);
}

.regenerating-ad.slide.show {
    transform: translateX(0);
}

.regenerating-ad.fade {
    opacity: 0;
    transform: none;
}

.regenerating-ad.fade.show {
    opacity: 1;
}

.regenerating-ad.bounce {
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.regenerating-ad.pulse {
    animation: pulseIn 0.8s ease-in-out;
}

@keyframes pulseIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Banner ads */
.regenerating-ad.banner-ad {
    width: 100%;
    margin: 10px 0;
    background: white;
    border: 1px solid #e0e0e0;
}

.regenerating-ad.banner-ad.position-top {
    margin-bottom: 20px;
}

.regenerating-ad.banner-ad.position-bottom {
    margin-top: 20px;
}

/* Sidebar ads */
.regenerating-ad.sidebar-ad {
    position: fixed;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.regenerating-ad.sidebar-ad.left {
    left: 10px;
}

.regenerating-ad.sidebar-ad.right {
    right: 10px;
}

/* Floating ads */
.regenerating-ad.floating-ad {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    max-width: 350px;
    transform: translateY(100px);
}

.regenerating-ad.floating-ad.show {
    transform: translateY(0);
}

/* Popup ads */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.show {
    opacity: 1;
}

.regenerating-ad.popup-ad {
    background: white;
    border-radius: 15px;
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    position: relative;
}

.popup-overlay.show .regenerating-ad.popup-ad {
    transform: scale(1);
}

/* Content ads */
.regenerating-ad.content-ad {
    width: 100%;
    margin: 20px auto;
    background: white;
    border: 1px solid #e0e0e0;
    text-align: center;
}

/* Close button */
.ad-close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
}

.ad-close-btn:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

/* Ad content styling */
.ad-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

/* AdSense placeholder */
.adsense-placeholder {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 15px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* HTML content styling */
.html-ad-content {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Image ad styling */
.image-ad-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Responsive design */
@media (max-width: 768px) {
    .regenerating-ad.floating-ad {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .regenerating-ad.sidebar-ad {
        width: 60px !important;
        height: 400px !important;
    }
    
    .regenerating-ad.banner-ad {
        font-size: 14px;
    }
    
    .popup-overlay .regenerating-ad.popup-ad {
        margin: 20px;
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }
}

@media (max-width: 480px) {
    .regenerating-ad.floating-ad {
        bottom: 5px;
        right: 5px;
        left: 5px;
    }
    
    .regenerating-ad.sidebar-ad {
        width: 50px !important;
        height: 300px !important;
    }
    
    .ad-close-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
}

/* Loading states */
.regenerating-ad.loading {
    opacity: 0.5;
    pointer-events: none;
}

.regenerating-ad.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error states */
.regenerating-ad.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.regenerating-ad.error .ad-content {
    text-align: center;
    font-size: 12px;
}

/* Success states */
.regenerating-ad.success {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
}

/* Performance indicators */
.ad-performance-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    z-index: 5;
}

.ad-performance-indicator.high {
    background: rgba(40, 167, 69, 0.8);
}

.ad-performance-indicator.medium {
    background: rgba(255, 193, 7, 0.8);
}

.ad-performance-indicator.low {
    background: rgba(220, 53, 69, 0.8);
}

/* Regeneration counter */
.regeneration-counter {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    z-index: 5;
}

/* Hover effects */
.regenerating-ad:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.regenerating-ad.floating-ad:hover {
    transform: translateY(-5px);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .regenerating-ad {
        background: #2d3748;
        border-color: #4a5568;
        color: white;
    }
    
    .regenerating-ad.banner-ad,
    .regenerating-ad.content-ad {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .regenerating-ad.error {
        background: #742a2a;
        border-color: #9b2c2c;
        color: #fed7d7;
    }
}
