/* =========================================
   Fullscreen Ads Manager – Frontend Styles
   ========================================= */

/* ---- Overlay (full viewport) ---- */
.fsa-overlay {
    position: fixed;
    inset: 0;
    display: none; /* JS sets display:flex before adding .fsa-visible */
    align-items: center;
    justify-content: center;
    background-color: var(--fsa-bg, rgba(0,0,0,.8));
    z-index: var(--fsa-z, 999999);
    opacity: 0;
    pointer-events: none;
    /* Transition only opacity; display is toggled by JS with a reflow in between */
    transition: opacity .4s ease;
    overflow: hidden;
}

/* JS sets display:flex first, forces reflow, THEN adds this class → transition fires */
.fsa-overlay.fsa-visible {
    opacity: 1;
    pointer-events: all;
}

/* ---- Animations ---- */
/* Fade (default) */
.fsa-anim-fade .fsa-container { transition: opacity .4s ease; opacity: 0; }
.fsa-anim-fade.fsa-visible .fsa-container { opacity: 1; }

/* Zoom */
.fsa-anim-zoom .fsa-container { transition: transform .45s cubic-bezier(.175,.885,.32,1.275), opacity .35s ease; transform: scale(.6); opacity: 0; }
.fsa-anim-zoom.fsa-visible .fsa-container { transform: scale(1); opacity: 1; }

/* Slide from top */
.fsa-anim-slide_top .fsa-container { transition: transform .4s ease, opacity .35s ease; transform: translateY(-100vh); opacity: 0; }
.fsa-anim-slide_top.fsa-visible .fsa-container { transform: translateY(0); opacity: 1; }

/* Slide from bottom */
.fsa-anim-slide_bottom .fsa-container { transition: transform .4s ease, opacity .35s ease; transform: translateY(100vh); opacity: 0; }
.fsa-anim-slide_bottom.fsa-visible .fsa-container { transform: translateY(0); opacity: 1; }

/* None */
.fsa-anim-none .fsa-container { transition: none; opacity: 1; }

/* ---- Container (the ad box) ---- */
.fsa-container {
    position: relative;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,.5);
    max-width: 100vw;
    max-height: 100vh;
}

/* ---- Content ---- */
.fsa-content {
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
}

.fsa-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fsa-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ---- Close button ---- */
.fsa-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,.75);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .2s, transform .15s;
    outline: none;
    line-height: 1;
}

.fsa-close-btn:not([disabled]):hover {
    background: rgba(0,0,0,.95);
    transform: scale(1.1);
}

.fsa-close-btn[disabled] {
    cursor: default;
    opacity: .6;
}

.fsa-close-icon {
    font-size: 16px;
    line-height: 1;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

/* ---- SVG countdown ring ---- */
.fsa-countdown-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.fsa-ring-bg {
    fill: none;
    stroke: rgba(255,255,255,.2);
    stroke-width: 3;
}

.fsa-ring-progress {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 94.25; /* 2π × 15 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset .05s linear;
}

/* ---- Body lock when ad is open ---- */
body.fsa-lock {
    overflow: hidden;
}

/* ---- Countdown badge (optional timer text) ---- */
.fsa-countdown-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 4px 10px;
    border-radius: 20px;
    pointer-events: none;
    z-index: 10;
    transition: opacity .3s;
}

.fsa-countdown-badge.fsa-badge-hidden { opacity: 0; }
