/* Interstitial Ad Styles
 * Reusable full-screen interstitial ad overlay
 * Usage: Include this CSS and js/interstitial-ad.js, then call showInterstitialAd()
 */

/* Overlay background */
.interstitial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.interstitial-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Container for ad content */
.interstitial-container {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: interstitialSlideIn 0.4s ease-out;
}

@keyframes interstitialSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Close button - large and accessible */
.interstitial-close-btn {
    position: absolute;
    top: -60px;
    right: -10px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    border: 3px solid #fff;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5), 0 0 0 4px rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    z-index: 100001;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.interstitial-close-btn:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #ff5252 0%, #e04444 100%);
    box-shadow: 0 6px 24px rgba(255, 107, 107, 0.6), 0 0 0 6px rgba(255, 255, 255, 0.3);
}

.interstitial-close-btn:active {
    transform: scale(0.95);
}

/* Cooldown info text */
.interstitial-cooldown-info {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(76, 175, 80, 0.3);
    padding: 6px 14px;
    border-radius: 16px;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

/* Donate link */
.interstitial-donate-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 12px;
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.8) 0%, rgba(255, 142, 83, 0.8) 100%);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.interstitial-donate-link:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 1) 0%, rgba(255, 142, 83, 1) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}


/* Ad content wrapper */
.interstitial-ad-content {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 320px;
    min-height: 250px;
    position: relative;
    overflow: hidden;
}

/* Loading state */
.interstitial-ad-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #eee;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: interstitialSpin 0.8s linear infinite;
}

.interstitial-ad-content.loaded::before {
    display: none;
}

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

/* Ad label (sponsor text) */
.interstitial-sponsor-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    margin-top: 16px;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .interstitial-close-btn {
        top: -50px;
        right: 50%;
        transform: translateX(50%);
        width: 60px;
        height: 60px;
        font-size: 32px;
    }

    .interstitial-close-btn:hover {
        transform: translateX(50%) scale(1.05);
    }


    .interstitial-ad-content {
        padding: 16px;
        border-radius: 12px;
        min-width: 300px;
        min-height: 200px;
    }

    .interstitial-container {
        max-width: 95vw;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .interstitial-ad-content {
        min-width: 280px;
        padding: 12px;
    }
}

/* Countdown timer (optional) */
.interstitial-countdown {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
}

/* Skip button (appears after countdown) */
.interstitial-skip-btn {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

.interstitial-skip-btn.visible {
    opacity: 1;
    visibility: visible;
}

.interstitial-skip-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}