/* Popup wrapper */
.pw-popup {
    position: relative;
}

/* Trigger - clickable area */
.pw-popup-trigger {
    cursor: pointer;
    display: inline-block;
    width: 100%;
}

.pw-popup-trigger:hover {
    opacity: 0.9;
}

/* Modal container - hidden by default */
.pw-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pw-popup-modal.is-open {
    display: flex;
}

/* Backdrop overlay */
.pw-popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transition: opacity 0.3s ease;
}

/* Popup container */
.pw-popup-container {
    position: relative;
    z-index: 2;
    background: white;
    border-radius: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    animation: popupFadeIn 0.3s ease;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Width variants */
.pw-popup-container.width-small {
    max-width: 500px;
}

.pw-popup-container.width-medium {
    max-width: 700px;
}

.pw-popup-container.width-large {
    max-width: 900px;
}

.pw-popup-container.width-extra-large {
    max-width: 1200px;
}

/* Close button */
.pw-popup-close {
    position: absolute;
    z-index: 10;
    background: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    box-shadow: none;
    outline: none !important;
}

.pw-popup-close:hover {
    transform: scale(1.1);
    box-shadow: none;
}

.pw-popup-close:active {
    transform: scale(0.95);
}

.pw-popup-close:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.pw-popup-close span {
    font-size: 24px;
    line-height: 1;
    color: #333;
    font-weight: bold;
    user-select: none;
}

.pw-popup-close img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Popup content */
.pw-popup-content {
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 12px;
}

/* Scrollbar styling */
.pw-popup-content::-webkit-scrollbar {
    width: 8px;
}

.pw-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.pw-popup-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.pw-popup-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Body scroll lock when popup is open */
body.pw-popup-open {
    overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pw-popup-modal {
        padding: 8px;
    }

    .pw-popup-container {
        border-radius: 8px;
        max-height: calc(100vh - 16px);
    }

    .pw-popup-content {
        border-radius: 8px;
    }
}

/* Focus trap helper */
.pw-popup-modal:focus {
    outline: none;
}