/* Next Stage Ads - BoostAds Frontend Styles */

/* Popup Overlay */
.nsba-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nsba-popup-overlay.nsba-show {
    display: flex;
    opacity: 1;
}

/* Popup Container */
.nsba-popup-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

/* Loading indicator for close button (kept for bottom button) */
.nsba-loading {
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
    animation: nsba-pulse 1.5s ease-in-out infinite;
}

@keyframes nsba-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Ad Content */
.nsba-ad-content {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: block;
    background: #f8f9fa;
}

/* Loading message while ad is loading */
.nsba-ad-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 16px;
    text-align: center;
    animation: nsba-fade-in 0.5s ease-in;
    z-index: 2;
    width: 100%;
    max-width: 300px;
}

@keyframes nsba-fade-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
}

.nsba-ad-content iframe,
.nsba-ad-content img,
.nsba-ad-content video {
    width: 100% !important;
    height: 100vh !important;
    object-fit: cover;
    border: none;
}

/* Ensure AdSense ads are visible and properly sized */
.nsba-ad-content ins.adsbygoogle,
.nsba-ad-content div.adsbygoogle,
.nsba-ad-content iframe[src*="googlesyndication"],
.nsba-ad-content iframe[src*="googleusercontent"] {
    display: block !important;
    width: 100% !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Fix for responsive AdSense ads */
.nsba-ad-content ins.adsbygoogle[data-ad-format="auto"],
.nsba-ad-content ins.adsbygoogle[data-full-width-responsive="true"] {
    width: 100% !important;
    height: 100vh !important;
    min-height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Ensure ad iframes are visible */
.nsba-ad-content iframe {
    border: none !important;
    background: transparent !important;
}

/* Override any hiding styles that might affect ads */
.nsba-popup-overlay .nsba-ad-content * {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force AdSense ads to be full screen and properly positioned */
.nsba-popup-overlay .nsba-ad-content ins.adsbygoogle,
.nsba-popup-overlay .nsba-ad-content div.adsbygoogle,
.nsba-popup-overlay .nsba-ad-content iframe[src*="googlesyndication"],
.nsba-popup-overlay .nsba-ad-content iframe[src*="googleusercontent"] {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    display: block !important;
    z-index: 1 !important;
}

/* Ensure AdSense containers don't have margins/padding */
.nsba-popup-overlay .nsba-ad-content > ins,
.nsba-popup-overlay .nsba-ad-content > div {
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Remove duplicate rule - merged above */

/* Ensure ad content fills the space */
.nsba-ad-content * {
    max-width: 100%;
    max-height: 100vh;
}

/* Animation for popup appearance */
@keyframes nsbaFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes nsbaSlideIn {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nsba-popup-overlay.nsba-animate-in .nsba-popup-container {
    animation: nsbaFadeIn 0.3s ease-out;
}



/* Mobile optimizations */

    /* Ensure no scrolling on mobile */
    .nsba-popup-overlay.nsba-show {
        position: fixed;
        overflow: hidden;
    }

    /* Hide mobile browser UI */
    .nsba-popup-container {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for better mobile support */
    }

    .nsba-ad-content {
        height: 100vh;
        height: 100dvh;
    }

    .nsba-ad-content iframe,
    .nsba-ad-content img,
    .nsba-ad-content video {
        height: 100vh !important;
        height: 100dvh !important;
    }

    .nsba-ad-content > div {
        height: 100vh;
        height: 100dvh;
        display: block;
    }

    /* Ensure AdSense ads are full width on mobile */
    .nsba-ad-content ins.adsbygoogle,
    .nsba-ad-content div.adsbygoogle,
    .nsba-ad-content iframe[src*="googlesyndication"] {
        height: 100vh !important;
        height: 100dvh !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        padding: 0 !important;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
    }

    .nsba-close-bottom-button {
        height: 50px;
        font-size: 14px;
        bottom: env(safe-area-inset-bottom, 0);
    }

    .nsba-popup-container {
        padding-bottom: calc(50px + env(safe-area-inset-bottom, 0));
    }

    .nsba-ad-content {
        height: calc(100vh - 50px - env(safe-area-inset-bottom, 0));
        max-height: calc(100vh - 50px - env(safe-area-inset-bottom, 0));
    }

    .nsba-ad-content iframe,
    .nsba-ad-content img,
    .nsba-ad-content video {
        height: calc(100vh - 50px - env(safe-area-inset-bottom, 0)) !important;
        max-height: calc(100vh - 50px - env(safe-area-inset-bottom, 0)) !important;
    }
}

/* High DPI screens */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    /* No high DPI specific styles needed for bottom button */
}

.nsba-popup-overlay[aria-hidden="true"] {
    display: none !important;
}

/* Prevent body scroll when popup is open */
body.nsba-popup-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Landscape orientation on mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .nsba-close-bottom-button {
        height: 45px;
        font-size: 13px;
    }
}

/* Support for notch/safe area on modern phones */
@supports (padding: max(0px)) {
    @media screen and (max-width: 768px) {
        .nsba-popup-container {
            padding-top: env(safe-area-inset-top);
            padding-bottom: env(safe-area-inset-bottom);
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
        }
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .nsba-popup-overlay {
        background-color: rgba(0, 0, 0, 0.98);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .nsba-popup-overlay {
        transition: none;
    }

    .nsba-popup-overlay.nsba-animate-in .nsba-popup-container {
        animation: none;
    }

    .nsba-close-bottom-button:hover {
        transform: none;
    }
}

/* Bottom Close Button */
.nsba-close-bottom-button {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    z-index: 1000001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nsba-close-bottom-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}

.nsba-close-bottom-button:active {
    transform: translateY(0);
    background: rgba(0, 0, 0, 0.95);
}

.nsba-close-bottom-button span {
    position: relative;
    z-index: 1;
}

/* Adjust ad content to account for bottom button */
.nsba-popup-container {
    position: relative;
    padding-bottom: 60px; /* Space for bottom button */
}

.nsba-ad-content {
    height: calc(100vh - 60px); /* Subtract bottom button height */
    max-height: calc(100vh - 60px);
}

/* Mobile optimizations for bottom button */
@media screen and (max-width: 768px) {
    .nsba-close-bottom-button {
        height: 50px;
        font-size: 14px;
        bottom: env(safe-area-inset-bottom, 0);
    }

    .nsba-popup-container {
        padding-bottom: calc(50px + env(safe-area-inset-bottom, 0));
    }

    .nsba-ad-content {
        height: calc(100vh - 50px - env(safe-area-inset-bottom, 0));
        max-height: calc(100vh - 50px - env(safe-area-inset-bottom, 0));
    }

    .nsba-ad-content iframe,
    .nsba-ad-content img,
    .nsba-ad-content video {
        height: calc(100vh - 50px - env(safe-area-inset-bottom, 0)) !important;
        max-height: calc(100vh - 50px - env(safe-area-inset-bottom, 0)) !important;
    }
}

/* Dark mode support for bottom button */
@media (prefers-color-scheme: dark) {
    .nsba-close-bottom-button {
        background: rgba(0, 0, 0, 0.9);
        border-top-color: rgba(255, 255, 255, 0.2);
    }

    .nsba-close-bottom-button:hover {
        background: rgba(0, 0, 0, 0.95);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .nsba-close-bottom-button {
        background: #000000;
        border-top: 2px solid #ffffff;
        color: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .nsba-close-bottom-button {
        transition: none;
    }

    .nsba-close-bottom-button:hover {
        transform: none;
    }
}

/* Print styles - hide popup when printing */
@media print {
    .nsba-popup-overlay {
        display: none !important;
    }
}

