/**
 * PM Popup - Frontend Styles
 */

/* Base popup styles */
.pm-popup {
    position: fixed;
    z-index: 999999;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    width: 400px;
    padding: 30px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* Opening animation */
.pm-popup-opening {
    animation: pmPopupFadeIn 0.3s ease-in-out forwards;
}

/* Closing animation */
.pm-popup-closing {
    animation: pmPopupFadeOut 0.3s ease-in-out forwards;
}

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

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

/* Position variations */
.pm-popup-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pm-popup-center.pm-popup-opening {
    animation: pmPopupFadeInCenter 0.3s ease-in-out forwards;
}

@keyframes pmPopupFadeInCenter {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.pm-popup-top-left {
    top: 20px;
    left: 20px;
}

.pm-popup-top-right {
    top: 20px;
    right: 20px;
}

.pm-popup-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.pm-popup-top-center.pm-popup-opening {
    animation: pmPopupFadeInTopCenter 0.3s ease-in-out forwards;
}

@keyframes pmPopupFadeInTopCenter {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.pm-popup-bottom-left {
    bottom: 20px;
    left: 20px;
}

.pm-popup-bottom-right {
    bottom: 20px;
    right: 20px;
    /* Extra margin to avoid chat widget - adjust as needed */
    margin-right: 80px;
    margin-bottom: 80px;
}

.pm-popup-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.pm-popup-bottom-center.pm-popup-opening {
    animation: pmPopupFadeInBottomCenter 0.3s ease-in-out forwards;
}

@keyframes pmPopupFadeInBottomCenter {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Close button */
.pm-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.2s ease;
    z-index: 10;
}

.pm-popup-close:hover {
    color: #333;
}

.pm-popup-close:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* Content */
.pm-popup-content {
    display: flex;
    flex-direction: row;
    gap: 5px;
    align-items: flex-start;
}

/* Image on right (desktop only) */
.pm-popup-image-right .pm-popup-content {
    flex-direction: row-reverse;
}

/* Image */
.pm-popup-image {
    max-width: 150px;
    width: 150px;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Text column: title, subtitle, button */
.pm-popup-left-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

/* Title */
.pm-popup-title {
    margin: 0;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
}

/* Subtitle */
.pm-popup-subtitle {
    margin: 0;
    line-height: 1.5;
    text-align: left;
}

/* Button */
.pm-popup-button {
    display: block;
        width: 100%;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    text-align: center;
}

.pm-popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pm-popup-button:active {
    transform: translateY(0);
}

.pm-popup-button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Responsive styles */
@media (max-width: 768px) {
    .pm-popup {
        width: 98%;
            max-width: 98%;
        padding: 15px;
        box-sizing: border-box;
    }

    /* Adjust positions for mobile - keep vertical, center horizontal */
    .pm-popup-top-left,
    .pm-popup-top-right,
    .pm-popup-top-center {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
        top: 20px;
    }

    .pm-popup-bottom-left,
    .pm-popup-bottom-right,
    .pm-popup-bottom-center {
        left: 50% !important;
        right: auto !important;
        bottom: 20px;
        transform: translateX(-50%) !important;
        margin: 0 !important;
    }

    .pm-popup-bottom-right,
    .pm-popup-bottom-left {
        /* Extra margin for chat widget on mobile */
        bottom: 90px !important;
    }

    .pm-popup-center {
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
    }

    .pm-popup-content {
        flex-direction: column !important;
        align-items: center;
        gap: 12px;
    }

        .pm-popup-image {
            max-height: 150px;
        width: 100%;
        max-width: 100%;
            object-fit: contain;
    }

        .pm-popup-left-column {
            gap: 10px;
            width: 100%;
    }

    .pm-popup-title {
        font-size: 18px !important;
        text-align: center !important;
    }

    .pm-popup-subtitle {
        font-size: 13px !important;
        text-align: center !important;
    }

    .pm-popup-button {
        font-size: 14px !important;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .pm-popup {
        width: 98%;
            max-width: 98%;
        padding: 12px;
    }

    .pm-popup-close {
        font-size: 24px;
        top: 8px;
        right: 8px;
        }
        
        .pm-popup-image {
        max-height: 150px;
            width: 100%;
            max-width: 100%;
            object-fit: contain;
        }
        
        .pm-popup-title {
            font-size: 16px !important;
        }
        
        .pm-popup-subtitle {
            font-size: 12px !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .pm-popup,
    .pm-popup-button {
        animation: none !important;
        transition: none !important;
    }
}

/* Print styles */
@media print {
    .pm-popup {
        display: none !important;
    }
}
