/* Ad System Styles */

/* New Header Ad Styles */
#headerAdContainer {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow: visible;
    max-height: none;
    opacity: 1;
    display: block;
}

.header-ad-container {
    position: relative;
    width: 100%;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.header-ad-content {
    flex: 1;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
}

.header-ad-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    z-index: 1001;
}

.header-ad-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* Header ad content styling */
.header-ad-content iframe,
.header-ad-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0 auto;
    display: block;
}

/* Smooth transitions for all elements */
#headerAdContainer * {
    transition: all 0.3s ease;
}



/* Let header ad code handle its own iframe/img styling */

/* Interstitial Ad Styles */
#interstitialAd {
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

#interstitialAd .bg-white {
    animation: scaleIn 0.3s ease-out;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

#interstitialAd .ad-content {
    text-align: center;
}

#interstitialAd .ad-content iframe,
#interstitialAd .ad-content img {
    max-width: 100%;
    border-radius: 8px;
}

/* Sidebar Ad Styles - White Background */
.sidebar-ad-container {
    background: white; /* White background */
    margin-bottom: 24px;
    min-height: 250px; /* Simple size for good UI/UX */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Footer Ad Styles - Only width and height */
.footer-ad-container {
    width: 100%;
    height: 100px;
}

.footer-ad-container .ad-content iframe,
.footer-ad-container .ad-content img {
    max-width: 100%;
}

/* Description Ad Styles */
.description-ad-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.description-ad-container .ad-content iframe,
.description-ad-container .ad-content img {
    max-width: 100%;
    border-radius: 8px;
}

/* Ad Container Base Styles */
.ad-container {
    position: relative;
    overflow: hidden;
}

.ad-content {
    position: relative;
}

.ad-content iframe {
    border: none;
    display: block;
    margin: 0 auto;
}

.ad-content img {
    display: block;
    margin: 0 auto;
}

/* Responsive Ad Styles */
@media (max-width: 768px) {
    
    .header-ad-container {
        padding: 8px 12px;
        min-height: 50px;
    }
    
    .header-ad-close {
        width: 24px;
        height: 24px;
        font-size: 12px;
        top: 6px;
        right: 6px;
    }
    
    .header-ad-content iframe,
    .header-ad-content img {
        max-height: 40px;
    }
    
    .footer-ad-container {
        width: 100%;
        height: 100px;
    }
    
    .description-ad-container {
        padding: 12px;
        margin: 16px 0;
    }
    
    #interstitialAd .bg-white {
        margin: 16px;
        padding: 16px;
    }
    
    #interstitialPopup .bg-white {
        max-width: 90vw;
        margin: 16px;
        padding: 20px;
    }
    
    #interstitialPopup #interstitialAdContent {
        min-height: 150px;
    }
    
    #interstitialPopup #interstitialAdContent iframe,
    #interstitialPopup #interstitialAdContent img {
        max-height: 300px;
    }
    
    #interstitialPopup #countdown {
        font-size: 1.25rem;
        padding: 6px 12px;
    }
}

/* Ad Loading States */
.ad-container.loading {
    background: #f3f4f6;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-container.loading::after {
    content: "Loading ad...";
    color: #6b7280;
    font-size: 14px;
}

/* Ad Error States */
.ad-container.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px;
    text-align: center;
    border-radius: 8px;
}

.ad-container.error::after {
    content: "Ad failed to load";
    font-size: 14px;
}

/* Animations */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Ad Close Button Styles */
.ad-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.ad-close-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Ad Label Styles */
.ad-label {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sticky Ad Styles */
.ad-sticky {
    position: fixed;
    z-index: 1000;
    transition: all 0.3s ease;
}

.ad-sticky.minimized {
    transform: translateY(-80%);
}

.ad-sticky.minimized .ad-content {
    opacity: 0.7;
}

/* Ad Performance Indicators */
.ad-performance {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    display: none; /* Hidden by default, shown in admin mode */
}

/* Dark Mode Ad Styles */
@media (prefers-color-scheme: dark) {
    .sidebar-ad-container,
    .description-ad-container {
        background: #ffffff;
        border-color: #374151;
    }
    
    .ad-container.error {
        background: #1f2937;
        border-color: #dc2626;
        color: #fca5a5;
    }
}

/* Print Styles - Hide Ads */
@media print {
    .ad-container,
    #headerAd,
    #interstitialAd,
    #interstitialPopup,
    .sidebar-ad-container,
    .description-ad-container {
        display: none !important;
    }
}

/* Interstitial Popup Styles */
#interstitialPopup {
    animation: fadeIn 0.3s ease-out;
}

#interstitialPopup .bg-white {
    animation: scaleIn 0.3s ease-out;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

#interstitialPopup #interstitialAdContent {
    text-align: center;
    margin-bottom: 1.5rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#interstitialPopup #interstitialAdContent iframe,
#interstitialPopup #interstitialAdContent img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin: 0 auto;
    display: block;
}

#interstitialPopup #countdown {
    font-weight: bold;
    color: #dc2626;
    font-size: 1.5rem;
    background: #fef2f2;
    padding: 8px 16px;
    border-radius: 8px;
    border: 2px solid #fecaca;
    display: inline-block;
    margin: 0 8px;
    animation: pulse 2s infinite;
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.1);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 6px rgba(220, 38, 38, 0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 12px rgba(220, 38, 38, 0.2);
    }
}

/* Button Styles - Hide URL on Hover */
#downloadBtn,
#demoBtn {
    cursor: pointer;
    text-decoration: none;
}

#downloadBtn:hover,
#demoBtn:hover {
    text-decoration: none;
}

/* Remove any default link styling */
#downloadBtn:focus,
#demoBtn:focus {
    outline: none;
    text-decoration: none;
}
