/*
 * popup-manager.css
 * High-converting popup & banner styles for the dynamic ad system
 * Extends .popup-overlay/.popup-box — does NOT modify email popup CSS
 */

/* =========================================
   AD POPUP ENTRANCE ANIMATION
========================================= */
@keyframes pm-popIn {
    0%   { opacity: 0; transform: scale(0.7) translateY(30px); }
    60%  { opacity: 1; transform: scale(1.03) translateY(-4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pm-pulse {
    0%, 100% { box-shadow: 0 0 18px rgba(239, 68, 68, 0.45), 0 0 0 0 rgba(239,68,68,0.3); }
    50%      { box-shadow: 0 0 40px rgba(239, 68, 68, 0.9), 0 0 0 8px rgba(239,68,68,0); }
}

@keyframes pm-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes pm-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

@keyframes pm-onlinePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    50%      { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}

/* =========================================
   FULLSCREEN OVERLAY (ad mode)
========================================= */
@keyframes pm-overlayFadeIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

.popup-overlay.pm-ad-overlay-active {
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: pm-overlayFadeIn 0.35s ease forwards;
}

/* Override popup-box appearance when showing an ad */
.popup-box.pm-ad-active {
    background: linear-gradient(160deg, #0c0f1d 0%, #1a1145 50%, #0f172a 100%);
    border: 1px solid rgba(124, 58, 237, 0.5);
    border-radius: 28px;
    max-width: 440px;
    width: 92%;
    padding: 55px 36px 36px;
    position: relative;
    box-shadow:
        0 0 0 1px rgba(124, 58, 237, 0.25),
        0 0 80px rgba(124, 58, 237, 0.25),
        0 40px 100px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(255,255,255,0.06);
    animation: pm-popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Close button — large, top-right, always visible */
.pm-ad-active .popup-close.pm-ad-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.25s;
    z-index: 10;
    padding: 0;
    line-height: 1;
}

.pm-ad-active .popup-close.pm-ad-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fff;
    transform: scale(1.1);
}

/* =========================================
   AVATAR — large with glowing ring
========================================= */
.pm-avatar-wrap {
    position: relative;
    width: 130px;
    height: 130px;
    margin: -30px auto 1rem auto;
    transition: transform 0.3s ease;
}

.pm-avatar-wrap:hover {
    transform: scale(1.06);
}

.pm-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 3.5px solid #ef4444;
    box-shadow:
        0 0 25px rgba(239, 68, 68, 0.5),
        0 0 50px rgba(239, 68, 68, 0.15);
    animation: pm-pulse 2s infinite;
    transition: box-shadow 0.3s ease;
}

.pm-avatar:hover {
    box-shadow:
        0 0 35px rgba(239, 68, 68, 0.7),
        0 0 70px rgba(239, 68, 68, 0.25);
}

.pm-avatar-placeholder {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow:
        0 0 30px rgba(239, 68, 68, 0.45),
        0 0 50px rgba(239, 68, 68, 0.15);
    animation: pm-pulse 2s infinite;
}

/* Green online dot */
.pm-online-dot {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: #10b981;
    border-radius: 50%;
    border: 3px solid #0c0f1d;
    animation: pm-onlinePulse 1.6s infinite;
    z-index: 2;
}

/* =========================================
   TEXT
========================================= */
.pm-title {
    font-size: 1.2rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

.pm-main-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.pm-sub-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

/* Urgency line — "2 miles away · Online now" */
.pm-urgency {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 1rem;
}

.pm-urgency::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    animation: pm-blink 1.2s infinite;
}

/* =========================================
   COUNTDOWN TIMER — bold, red, blinking
========================================= */
.pm-timer {
    display: inline-block;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #ef4444;
    font-size: 0.85rem;
    font-weight: 800;
    padding: 6px 18px;
    border-radius: 20px;
    margin-bottom: 1.25rem;
    letter-spacing: 0.5px;
}

.pm-timer-count {
    font-size: 1rem;
    font-weight: 900;
    animation: pm-blink 1s infinite;
}

/* =========================================
   BUTTONS — dominant Accept with glow
========================================= */
.pm-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 0.25rem;
}

.pm-btn-accept {
    flex: 2;
    height: 54px;
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #10b981 100%);
    background-size: 200% auto;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow:
        0 4px 20px rgba(16, 185, 129, 0.45),
        0 0 40px rgba(16, 185, 129, 0.15);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pm-shimmer 3s linear infinite;
    letter-spacing: 0.02em;
}

.pm-btn-accept:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 8px 35px rgba(16, 185, 129, 0.6),
        0 0 60px rgba(16, 185, 129, 0.25);
    color: #fff;
    text-decoration: none;
}

.pm-btn-reject {
    flex: 1;
    height: 54px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
}

.pm-btn-reject:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

/* =========================================
   BANNER (top / bottom sticky)
========================================= */
.pm-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1998;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.97), rgba(26, 17, 69, 0.97));
    backdrop-filter: blur(16px);
    padding: 14px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -4px 30px rgba(0,0,0,0.4);
}

.pm-banner.pm-banner-bottom {
    bottom: 0;
    border-top: 1px solid rgba(124, 58, 237, 0.3);
    transform: translateY(100%);
}

.pm-banner.pm-banner-top {
    top: 0;
    border-bottom: 1px solid rgba(124, 58, 237, 0.3);
    transform: translateY(-100%);
}

.pm-banner.pm-banner-visible {
    transform: translateY(0);
}

.pm-banner-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.35);
    animation: pm-pulse 2.5s infinite;
}

.pm-banner-content {
    flex-grow: 1;
}

.pm-banner-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.35;
}

.pm-banner-sub {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

.pm-banner-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 11px 26px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    display: inline-block;
    transition: all 0.25s;
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35);
}

.pm-banner-btn:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.55);
    color: #fff;
    text-decoration: none;
}

.pm-banner-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 1.4rem;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.pm-banner-close:hover {
    color: #fff;
}

/* =========================================
   MOBILE
========================================= */
@media (max-width: 600px) {
    .popup-box.pm-ad-active {
        max-width: 95%;
        padding: 45px 22px 26px;
        border-radius: 22px;
    }
    .pm-actions { flex-direction: column; }
    .pm-btn-accept { flex: unset; }
    .pm-btn-reject { flex: unset; }
    .pm-avatar-wrap, .pm-avatar, .pm-avatar-placeholder { width: 105px; height: 105px; }
    .pm-avatar-wrap { margin-top: -22px; }
    .pm-avatar-placeholder { font-size: 2.5rem; }
    .pm-online-dot { width: 17px; height: 17px; bottom: 5px; right: 5px; }
    .pm-ad-active .popup-close.pm-ad-close { width: 32px; height: 32px; font-size: 1.1rem; top: 10px; right: 10px; }
    .pm-banner { flex-wrap: wrap; padding: 12px 16px; }
    .pm-banner-btn { width: 100%; text-align: center; }
}
