/* ===== Site Popup System ===== */

.site-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: popupFadeIn 0.3s ease;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.site-popup-overlay.active {
    display: flex;
}

.site-popup {
    position: relative;
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1429 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
    animation: popupSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
}

.site-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
}

.site-popup__close {
    position: fixed;
    top: 16px;
    right: 16px;
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    width: 44px;
    height: 44px;
    border: none;
    background: #dc2626;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    transition: background 0.2s, transform 0.2s;
    z-index: 999999;
    pointer-events: all;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.2);
    -webkit-tap-highlight-color: transparent;
}

.site-popup__close.active {
    display: flex;
}

.site-popup__close:hover {
    background: #b91c1c;
    transform: rotate(90deg) scale(1.1);
}

.site-popup__close:active {
    transform: scale(0.9);
}

.site-popup__body {
    padding: 32px 28px 20px;
    overflow-y: auto;
    max-height: 65vh;
    position: relative;
    z-index: 1;
}

/* Text Popup */
.site-popup__text {
    color: #e2e8f0;
    font-size: 15px;
    line-height: 1.7;
    text-align: center;
}

.site-popup__text h1,
.site-popup__text h2,
.site-popup__text h3 {
    color: #fff;
    margin-bottom: 12px;
}

/* HTML Popup */
.site-popup__html {
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.site-popup__html * {
    max-width: 100%;
    box-sizing: border-box;
}

.site-popup__html img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.site-popup__html table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.site-popup__html table th,
.site-popup__html table td {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.site-popup__html table th {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

/* Image Popup */
.site-popup--image .site-popup__body {
    padding: 0;
}

.site-popup__image {
    width: 100%;
    display: block;
    border-radius: 0;
}

/* Button */
.site-popup__footer {
    padding: 0 28px 24px;
    text-align: center;
}

.site-popup__btn {
    display: inline-block;
    padding: 10px 32px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.3px;
}

.site-popup__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    color: #fff;
}

/* Animations */
@keyframes popupFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popupSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive */
@media (max-width: 575px) {
    .site-popup {
        width: 95%;
        max-width: none;
        margin: 10px;
    }
    .site-popup__body {
        padding: 24px 18px 16px;
    }
    .site-popup__footer {
        padding: 0 18px 18px;
    }
    .site-popup__text {
        font-size: 14px;
    }
}
