/**
 * Popup Manager Styles
 *
 * Beautiful, mobile-responsive modal designs with smooth animations.
 * Optimized for conversions with professional styling and accessibility.
 *
 * @package ExpiredAuctions
 * @since   1.0.0
 */

/* ============================================================================
   Popup Overlay & Container
   ========================================================================= */

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.popup-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.popup-overlay.show .popup-container {
    transform: scale(1);
}

.popup-inner {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* ============================================================================
   Popup Close Button
   ========================================================================= */

.popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    color: #333;
}

.popup-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.popup-close:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.popup-close svg {
    width: 20px;
    height: 20px;
}

/* ============================================================================
   Popup Body & Content
   ========================================================================= */

.popup-body {
    padding: 2.5rem;
}

.popup-content-wrapper {
    text-align: center;
}

.popup-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.popup-icon-newsletter {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.3);
}

.popup-icon svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.popup-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.popup-description {
    font-size: 1rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* ============================================================================
   Popup Actions & Buttons
   ========================================================================= */

.popup-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.popup-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.popup-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

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

.popup-dismiss {
    color: #6c757d;
    font-size: 0.9rem;
    padding: 0.5rem;
}

.popup-dismiss:hover {
    color: #495057;
    text-decoration: underline;
}

/* ============================================================================
   Popup Forms
   ========================================================================= */

.popup-form {
    text-align: left;
}

.popup-form .form-control {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.popup-form .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.popup-form .form-control::placeholder {
    color: #adb5bd;
}

/* ============================================================================
   Animation Variants
   ========================================================================= */

/* Fade Animation (Default) */
.popup-animation-fade .popup-container {
    transform: scale(0.95);
    opacity: 0;
}

.popup-animation-fade.show .popup-container {
    transform: scale(1);
    opacity: 1;
}

/* Slide Up Animation */
.popup-animation-slide-up .popup-container {
    transform: translateY(50px);
    opacity: 0;
}

.popup-animation-slide-up.show .popup-container {
    transform: translateY(0);
    opacity: 1;
}

/* Slide Down Animation */
.popup-animation-slide-down .popup-container {
    transform: translateY(-50px);
    opacity: 0;
}

.popup-animation-slide-down.show .popup-container {
    transform: translateY(0);
    opacity: 1;
}

/* Zoom Animation */
.popup-animation-zoom .popup-container {
    transform: scale(0.7);
    opacity: 0;
}

.popup-animation-zoom.show .popup-container {
    transform: scale(1);
    opacity: 1;
}

/* No Animation */
.popup-animation-none .popup-container {
    transition: none;
}

/* ============================================================================
   Custom Popup Styles
   ========================================================================= */

/* Twitter/X Popup */
.popup-social-twitter .popup-icon {
    background: linear-gradient(135deg, #1da1f2 0%, #0d8bd9 100%);
    box-shadow: 0 10px 30px rgba(29, 161, 242, 0.3);
}

.popup-social-twitter .popup-cta {
    background: linear-gradient(135deg, #1da1f2 0%, #0d8bd9 100%);
    border-color: #1da1f2;
}

.popup-social-twitter .popup-cta:hover {
    box-shadow: 0 6px 20px rgba(29, 161, 242, 0.4);
}

/* Newsletter Popup */
.popup-newsletter .popup-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.3);
}

/* Welcome Popup */
.popup-welcome .popup-icon-welcome {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.3);
    margin-bottom: 1rem;
}

.popup-welcome .popup-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.popup-welcome .popup-description {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.popup-welcome .popup-benefits {
    text-align: left;
    margin-bottom: 1.25rem;
}

.popup-welcome .benefit-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.625rem;
    padding: 0.5rem 0.625rem;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.popup-welcome .benefit-item:last-child {
    margin-bottom: 0;
}

.popup-welcome .benefit-item:hover {
    background: #e9ecef;
    transform: translateX(3px);
}

.popup-welcome .benefit-icon {
    flex-shrink: 0;
    color: #28a745;
}

.popup-welcome .benefit-item span {
    font-size: 0.875rem;
    color: #495057;
    line-height: 1.4;
}

.popup-welcome .popup-body {
    padding: 2rem 2.5rem;
}

.popup-welcome .popup-actions {
    margin-top: 1.25rem;
}

/* ============================================================================
   Mobile Responsive
   ========================================================================= */

@media (max-width: 576px) {
    .popup-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .popup-container {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }

    .popup-inner {
        border-radius: 16px 16px 0 0;
    }

    .popup-body {
        padding: 2rem 1.5rem;
    }

    .popup-title {
        font-size: 1.5rem;
    }

    .popup-description {
        font-size: 0.95rem;
    }

    .popup-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 1.25rem;
    }

    .popup-icon svg {
        width: 36px;
        height: 36px;
    }

    /* Mobile fullscreen option */
    .popup-overlay.mobile-fullscreen {
        align-items: stretch;
    }

    .popup-overlay.mobile-fullscreen .popup-container {
        max-height: 100vh;
        border-radius: 0;
    }

    .popup-overlay.mobile-fullscreen .popup-inner {
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        align-items: center;
    }
}

/* ============================================================================
   Accessibility
   ========================================================================= */

/* Focus visible for keyboard navigation */
.popup-overlay *:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .popup-overlay,
    .popup-container,
    .popup-close,
    .popup-cta {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .popup-inner {
        border: 2px solid currentColor;
    }

    .popup-close {
        border: 1px solid currentColor;
    }
}

/* ============================================================================
   Loading & Success States
   ========================================================================= */

.popup-loading {
    pointer-events: none;
    opacity: 0.6;
}

.popup-success {
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ============================================================================
   Print Styles
   ========================================================================= */

@media print {
    .popup-overlay {
        display: none !important;
    }
}

/* ============================================================================
   Dark Mode Support (Optional)
   ========================================================================= */

@media (prefers-color-scheme: dark) {
    .popup-inner {
        background: #1a1a1a;
        color: #ffffff;
    }

    .popup-title {
        color: #ffffff;
    }

    .popup-description {
        color: #b0b0b0;
    }

    .popup-close {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    .popup-close:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .popup-form .form-control {
        background: #2a2a2a;
        border-color: #404040;
        color: #ffffff;
    }

    .popup-form .form-control:focus {
        background: #2a2a2a;
        border-color: #0d6efd;
    }

    .popup-dismiss {
        color: #b0b0b0;
    }

    .popup-dismiss:hover {
        color: #ffffff;
    }
}

/* ============================================================================
   Utility Classes
   ========================================================================= */

.popup-hidden {
    display: none !important;
}

.popup-no-scroll {
    overflow: hidden;
}
