/* Advanced Popup Plugin - Frontend Styles */

.advanced-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(2px);
    overflow: auto;
    padding-block: 5vw;
}

.advanced-popup {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    max-width: 90vw;
    /* max-height: 90vh; */
    /* overflow: hidden; */
    animation: popupSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    direction: rtl;
}

.advanced-popup.text-image-popup {
    padding: 40px;
    text-align: center;
    min-width: 320px;
    max-width: 440px;
    padding: unset;
    background: #232326 !important;
}

.advanced-popup.image-only-popup {
    padding: 0;
    max-width: 80vw;
    max-height: 80vh;
}

.advanced-popup img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.advanced-popup.text-image-popup img {
    aspect-ratio: 440/225;
    width: 100%;
    object-fit: cover;
    /* border-radius: 8px; */
    /* box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); */
}

.advanced-popup.image-only-popup img {
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.advanced-popup.image-only-popup img:hover {
    transform: scale(1.02);
}

.advanced-popup h3 {
    margin-bottom: 1rem;
    color: #fff;
    font-weight: 500;
    font-size: 2rem;
    line-height: .9;
    text-shadow: 0px 4px 38.9px rgba(0, 0, 0, 0.16);
}

.advanced-popup p {
    margin-bottom: 2rem;
    color: #fff;
    line-height: 1.5;
    font-size: 1.25rem;
}

.popup-button {
    width: max-content;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    color: white;
    border: none;
    padding: 15px 30px;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    /* box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #FFF;
    color: #000;
    display: flex;
    align-items: center;
    gap: 0 0.5rem;
}

.popup-button:hover {
    transform: translateY(-2px);
    box-shadow: unset;
    background: white;
}

.popup-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.advanced-popup-close {
    position: absolute;
    top: -43px;
    right: -18px;
    width: 40px;
    height: 40px;
    background: unset !important;
    color: white;
    border: unset;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000001;
    transition: all 0.3s ease;
    box-shadow: unset !important;
    line-height: 1;
    font-family: Arial, sans-serif;
}

.advanced-popup-close:hover {
    transform: scale(1.15) rotate(90deg);
    background: linear-gradient(135deg, #ff3838 0%, #ff2f2f 100%);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.6);
}

.advanced-popup-close:active {
    transform: scale(1.05) rotate(90deg);
}



/* Close button pulse animation */
@keyframes closePulse {
    0% {
        box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
    }

    50% {
        box-shadow: 0 4px 15px rgba(255, 71, 87, 0.6), 0 0 0 8px rgba(255, 71, 87, 0.1);
    }

    100% {
        box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
    }
}

.advanced-popup-close {
    animation: closePulse 2s ease-in-out infinite;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(-50px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes popupSlideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    to {
        opacity: 0;
        transform: scale(0.7) translateY(-50px);
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .advanced-popup-overlay {
        padding: 20px;
        align-items: flex-start;
        padding-top: 10vh;
    }

    .advanced-popup.text-image-popup {
        padding: 25px;
        min-width: auto;
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .advanced-popup.image-only-popup {
        max-width: 95vw;
        max-height: 70vh;
    }

    .advanced-popup h3 {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .advanced-popup p {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .popup-button {
        font-size: 14px;
        padding: 12px 25px;
        width: max-content;
    }

    .advanced-popup-close {
        top: -15px;
        right: -15px;
        width: 35px;
        height: 35px;
        font-size: 18px;
        border-width: 2px;
    }

    .advanced-popup-close::before {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .advanced-popup-overlay {
        padding: 15px;
        padding-top: 5vh;
    }

    .advanced-popup.text-image-popup {
        padding: 20px;
    }

    .advanced-popup h3 {
        font-size: 20px;
    }

    .advanced-popup p {
        font-size: 13px;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .advanced-popup {
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    }

    .popup-button {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    }

    .advanced-popup-close {
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .advanced-popup-overlay {
        background: rgba(0, 0, 0, 0.8);
    }

    .advanced-popup {
        background: #2c2c2c;
        color: #fff;
    }

    .advanced-popup h3 {
        color: #fff;
    }

    .advanced-popup p {
        color: #fff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .advanced-popup {
        animation: none;
    }

    .advanced-popup-overlay {
        animation: none;
    }

    .popup-button {
        transition: none;
    }

    .advanced-popup-close {
        transition: none;
    }

    .advanced-popup-close:hover {
        transform: none;
    }

    .popup-button:hover {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .advanced-popup-overlay {
        display: none !important;
    }
}

/* Focus Styles for Accessibility */
.popup-button:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

.advanced-popup-close:focus {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* RTL Support Enhancements */
[dir="rtl"] .advanced-popup-close {
    right: auto;
    left: -13px;
}

[dir="rtl"] .advanced-popup h3,
[dir="rtl"] .advanced-popup p {
    text-align: right;
}

/* Custom Scrollbar for Popup Content */
.advanced-popup::-webkit-scrollbar {
    width: 6px;
}

.advanced-popup::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.advanced-popup::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.advanced-popup::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading State */
.advanced-popup.loading {
    opacity: 0.7;
    pointer-events: none;
}

.advanced-popup.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #667eea;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    z-index: 1000001;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Popup Entrance Effects */
.advanced-popup.slide-from-top {
    animation: slideFromTop 0.5s ease;
}

.advanced-popup.slide-from-bottom {
    animation: slideFromBottom 0.5s ease;
}

.advanced-popup.fade-in-scale {
    animation: fadeInScale 0.4s ease;
}

@keyframes slideFromTop {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideFromBottom {
    from {
        opacity: 0;
        transform: translateY(100px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.advanced-popup-content {
    display: flex;
    padding: 1.25rem 2rem 2rem;
    flex-direction: column;
    align-items: start;
}

.advanced-popup-close {
    position: absolute;
    top: -44px !important;
    right: 10px;
    z-index: 10;
}