/**
 * Professional Ads System Styles
 * نظام الإعلانات الاحترافي
 */

/* Ad Container */
.ad-container {
    margin: 1rem 0;
    animation: fadeIn 0.5s ease-in;
    max-width: 100%;
    overflow: hidden;
}

/* Image Ad */
.ad-container img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Force all ad content to be responsive */
.ad-container *,
.ad-container iframe,
.ad-container div {
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Fix for inline styles with fixed widths */
.ad-container [style*="width"] {
    max-width: 100% !important;
}

/* Fix for flex items with fixed basis */
.ad-container [style*="flex"] {
    flex: 1 1 auto !important;
    max-width: 100% !important;
}

/* Video Ad Player */
.video-ad-player {
    font-family: 'Cairo', sans-serif;
}

.video-ad-player video {
    background: #000;
}

/* Skip Button Animation */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#skip-button {
    animation: slideIn 0.3s ease-out;
}

/* Progress Bar */
#ad-progress {
    transition: width 0.1s linear;
}

/* HTML Ad Wrapper */
.html-ad-wrapper {
    background: #f9f9f9;
    max-width: 100%;
    overflow: hidden;
}

/* Ad Badge */
.ad-badge {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    font-weight: bold;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .ad-container {
        margin: 0.5rem 0;
    }

    .video-ad-player {
        font-size: 14px;
    }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.ad-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 8px;
}

.ad-loading::after {
    content: "جاري تحميل الإعلان...";
    color: #666;
    font-weight: bold;
}

/* Ad Overlay (for mid-video ads) */
.ad-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in;
}

.ad-overlay-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.ad-overlay-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: #fff;
    color: #000;
    border: 2px solid #000;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.ad-overlay-close:hover {
    background: #FFD700;
    transform: scale(1.05);
}

/* Between Episodes Ad */
.episode-ad-slot {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Prevent Layout Shift (CLS) */
.ad-placeholder {
    min-height: 250px;
    background: #f5f5f5;
}

.ad-placeholder-banner {
    aspect-ratio: 4/1;
}

.ad-placeholder-square {
    aspect-ratio: 1/1;
}

.ad-placeholder-video {
    aspect-ratio: 16/9;
}