/**
 * Popup Styles - Premium Design
 */

/* Wrapper */
.sp-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999;
    /* High z-index to ensure it sits on top of everything */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0.4s;
    backdrop-filter: blur(2px);
    /* Subtle blur behind */
}

.sp-popup.sp-open {
    opacity: 1;
    visibility: visible;
}

/* Overlay */
.sp-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    /* Darker, more premium overlay */
    cursor: pointer;
}

/* Inner Wrapper (Holds Close Btn + Container) */
.sp-popup-inner {
    position: relative;
    width: 90%;
    max-width: 700px;
    z-index: 10;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Ensure no overflow hidden here so close button can show */
}

.sp-popup.sp-open .sp-popup-inner {
    transform: scale(1) translateY(0);
}

/* Content Container (Scrollable) */
.sp-popup-container {
    background: #ffffff;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 0;
}

/* Scrollbar for content */
.sp-popup-container::-webkit-scrollbar {
    width: 6px;
}

.sp-popup-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sp-popup-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Base Styles */
html.sp-no-scroll,
body.sp-no-scroll {
    overflow: hidden !important;
    height: 100% !important;
    /* Force height to prevent weird jumping/scrolling */
}

/* Close Button - Professional Style */
.sp-popup-close {
    position: absolute;
    top: -15px;
    right: -8px;
    width: 38px;
    height: 38px;
    background: var(--sp-close-bg, #333);
    color: var(--sp-close-text, #fff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: opacity 0.2s ease;
    z-index: 110;
    line-height: 1;
    padding: 0;
    margin: 0;
    border: none;
    /* Resetting or removing border as per user snippet which didn't include it, or maybe they want no border? The snippet implies a full override. */
}

/* SVG Icon Styling */
.sp-popup-close svg {
    width: 20px;
    height: 20px;
    display: block;
    /* Keeping structural properties to ensure visibility */
    stroke: currentColor;
    stroke-width: 3;
    fill: none;
    pointer-events: none;
}

.sp-popup-close:hover {
    opacity: 0.8;
    /* Simple opacity hover */
    background: var(--sp-close-bg, #333);
    /* Keep same bg */
    color: var(--sp-close-text, #fff);
    transform: none;
    /* Remove rotation */
}

/* Content Area */
.sp-popup-content {
    padding: 0;
    /* Removed padding */
    line-height: 1.6;
    color: #444;
}

.sp-popup-content img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Remove padding if the user wants full-width content (common for image popups) */
.sp-popup-content.no-padding {
    padding: 0;
}

/* Animations */
.sp-effect-fade .sp-popup-container {
    /* Uses default transitions defined in .sp-popup-container */
}

.sp-effect-slide .sp-popup-container {
    transform: translateY(100px) scale(0.95);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.5s ease;
}

.sp-popup.sp-open.sp-effect-slide .sp-popup-container {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
    .sp-popup-inner {
        width: 90%;
        /* Slightly less width to give room for close button if it sticks out */
    }

    .sp-popup-container {
        max-height: 85vh;
    }

    .sp-popup-content {
        padding: 0;
        /* Remove padding as requested */
    }

    /* Fix Close Button on Mobile: clearer size, better positioning */
    .sp-popup-close {
        top: -12px;
        right: -8px;
        width: 32px;
        /* Larger touch target than before */
        height: 32px;
        /* Keep border radius and colors from desktop */
    }

    .sp-popup-close svg {
        width: 16px;
        height: 16px;
    }
}