/* ==========================================================
   Netstream – Announcement Popup  v35.3
   Fixed: freeze (desktop+mobile), scroll-lock, WebView
   ========================================================== */

/* No overflow or position on body/html from CSS side —
   JS handles it cleanly to avoid race conditions */

.isf-ap-root {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2147483647; /* max z-index */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
    /* compositor layer — fixes WebView mis-anchoring */
    will-change: opacity;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* hidden by default — opacity+visibility so it doesn't intercept events */
    opacity: 0;
    visibility: hidden;
    transition: opacity .01s ease .5s, visibility .01s ease .5s;
}
.isf-ap-root.isf-ap-visible {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
    transition: none;
}

/* ---- OVERLAY ---- */
.isf-ap-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 50% 25%, rgba(40,8,20,.6) 0%, rgba(0,0,0,.92) 70%);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    opacity: 0;
    transition: opacity .4s ease;
    z-index: 0;
    cursor: pointer;
}
.isf-ap-root.isf-ap-visible .isf-ap-overlay { opacity: 1; }

/* ---- CARD ---- */
.isf-ap-card {
    position: relative;
    z-index: 1;
    width: min(460px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 22px;
    background: linear-gradient(165deg, #16161e 0%, #0c0c11 60%, #0a0a0e 100%);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 30px 90px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.03);
    transform: scale(.88) translateY(28px);
    opacity: 0;
    transition: transform .5s cubic-bezier(.16,1,.3,1), opacity .38s ease;
}
.isf-ap-root.isf-ap-visible .isf-ap-card {
    transform: scale(1) translateY(0);
    opacity: 1;
    transition-delay: .07s;
}

/* Rotating glow ring */
.isf-ap-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 23px;
    padding: 1px;
    background: conic-gradient(from 0deg, var(--isf-ap-accent,#E50914), transparent 22%, transparent 50%, var(--isf-ap-accent,#E50914) 72%, transparent 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: .5;
    pointer-events: none;
    animation: isfApRotate 7s linear infinite;
    will-change: transform;
}
@keyframes isfApRotate { to { transform: rotate(360deg); } }

.isf-ap-glow {
    position: absolute;
    top: -130px; left: 50%;
    transform: translateX(-50%);
    width: 320px; height: 240px;
    background: radial-gradient(circle, var(--isf-ap-accent,#E50914) 0%, transparent 70%);
    opacity: .2;
    filter: blur(8px);
    pointer-events: none;
}

/* ---- CLOSE BTN ---- */
.isf-ap-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(6px);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 13px;
    transition: background .2s, transform .3s, border-color .2s;
    -webkit-tap-highlight-color: transparent;
}
.isf-ap-close:hover { background: var(--isf-ap-accent,#E50914); border-color: transparent; transform: rotate(90deg); }

/* ---- BANNER ---- */
.isf-ap-banner { position: relative; width: 100%; height: 168px; overflow: hidden; }
.isf-ap-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.isf-ap-banner::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to top, #0c0c11 0%, rgba(12,12,17,.25) 55%, transparent 100%);
}

/* ---- BADGE ---- */
.isf-ap-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 100px;
    background: linear-gradient(135deg, var(--isf-ap-accent,#E50914), color-mix(in srgb,var(--isf-ap-accent,#E50914) 55%,#ff8a00));
    color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
    box-shadow: 0 4px 18px color-mix(in srgb,var(--isf-ap-accent,#E50914) 45%,transparent);
}

/* ---- BODY ---- */
.isf-ap-body { position: relative; padding: 24px 26px 26px; }
.isf-ap-body-nobanner { padding-top: 44px; }

.isf-ap-title { font-size: 23px; font-weight: 800; color: #fff; margin: 14px 0 10px; line-height: 1.28; letter-spacing: -.3px; }
.isf-ap-message { font-size: 14px; line-height: 1.65; color: rgba(255,255,255,.62); margin: 0 0 20px; }

/* ---- LINKS ---- */
.isf-ap-links { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.isf-ap-link-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 12px;
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
    transition: background .2s, border-color .2s;
}
.isf-ap-link-row:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14); }
.isf-ap-link-icon { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.06); display: flex; align-items: center; justify-content: center; color: var(--isf-ap-accent,#E50914); flex-shrink: 0; font-size: 12px; }
.isf-ap-link-text { flex: 1; min-width: 0; }
.isf-ap-link-label { font-size: 12px; color: rgba(255,255,255,.4); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 1px; }
.isf-ap-link-url { font-size: 13px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.isf-ap-link-actions { display: flex; gap: 6px; flex-shrink: 0; }
.isf-ap-link-btn {
    width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04);
    color: rgba(255,255,255,.7);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12px; text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    -webkit-tap-highlight-color: transparent;
}
.isf-ap-link-btn:hover { background: var(--isf-ap-accent,#E50914); color: #fff; border-color: transparent; }
.isf-ap-link-btn.isf-ap-copied { background: #00e676; color: #06210f; border-color: transparent; }

/* ---- CTA ---- */
.isf-ap-cta {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px 20px; border-radius: 14px; border: none;
    background: linear-gradient(135deg, var(--isf-ap-accent,#E50914), color-mix(in srgb,var(--isf-ap-accent,#E50914) 65%,#ff3d3d));
    color: #fff; font-size: 14.5px; font-weight: 700; cursor: pointer; text-decoration: none;
    box-shadow: 0 10px 30px color-mix(in srgb,var(--isf-ap-accent,#E50914) 40%,transparent);
    transition: transform .2s, box-shadow .2s;
    margin-bottom: 14px;
    -webkit-tap-highlight-color: transparent;
}
.isf-ap-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 36px color-mix(in srgb,var(--isf-ap-accent,#E50914) 55%,transparent); }
.isf-ap-cta:active { transform: scale(.98); }

/* ---- FOOTER ---- */
.isf-ap-footer { display: flex; align-items: center; justify-content: center; }
.isf-ap-dontshow { display: flex; align-items: center; gap: 7px; font-size: 12px; color: rgba(255,255,255,.4); cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.isf-ap-dontshow input { accent-color: var(--isf-ap-accent,#E50914); width: 14px; height: 14px; cursor: pointer; }

/* ---- MOBILE: bottom-sheet ---- */
@media (max-width: 540px) {
    .isf-ap-root { padding: 0; align-items: flex-end; }
    .isf-ap-card {
        width: 100%; max-height: 86vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        padding-bottom: env(safe-area-inset-bottom, 8px);
    }
    .isf-ap-root.isf-ap-visible .isf-ap-card {
        transform: translateY(0);
        transition: transform .45s cubic-bezier(.16,1,.3,1);
        transition-delay: .05s;
    }
    /* swipe handle */
    .isf-ap-card::after {
        content: '';
        display: block;
        width: 38px; height: 4px; border-radius: 2px;
        background: rgba(255,255,255,.15);
        margin: 10px auto 0;
    }
    .isf-ap-title { font-size: 20px; }
    .isf-ap-body { padding: 10px 18px 22px; }
    .isf-ap-body-nobanner { padding-top: 36px; }
    .isf-ap-banner { height: 140px; }
}

/* ---- DESKTOP tweak ---- */
@media (min-width: 541px) {
    .isf-ap-card { box-shadow: 0 40px 120px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.04); }
}
