/**
 * Popup System Styles
 * Newsletter, promotional and custom popups
 */

/* Popup Container */
.wowmart-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.wowmart-popup.active {
    opacity: 1;
    visibility: visible;
}

/* Popup Overlay */
.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

/* Popup Container */
.popup-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.wowmart-popup.active .popup-container {
    transform: scale(1);
}

/* Popup Content */
.popup-content {
    position: relative;
    background: var(--popup-bg-color, #ffffff);
    color: var(--popup-text-color, #333333);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: var(--popup-width, 600px);
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    min-height: 300px;
}

/* Close Button */
.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #666;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 0;
}

.popup-close:hover {
    background: #ffffff;
    color: #333;
    transform: scale(1.1);
}

/* Newsletter Popup Layout */
.newsletter-popup .popup-content {
    flex-direction: row;
}

.newsletter-popup .popup-image {
    flex: 1;
    min-height: 300px;
}

.newsletter-popup .popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.newsletter-popup .popup-text {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Popup Typography */
.popup-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 15px 0;
    line-height: 1.3;
    color: var(--popup-text-color, #333333);
}

.popup-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0 0 25px 0;
    line-height: 1.5;
}

/* Newsletter Form */
.newsletter-form {
    margin-top: 20px;
}

.form-group {
    position: relative;
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.email-input {
    flex: 1;
    height: 48px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 0 16px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.email-input:focus {
    outline: none;
    border-color: var(--popup-button-color, #d32f2f);
}

.subscribe-btn {
    height: 48px;
    padding: 0 20px;
    background: var(--popup-button-color, #d32f2f);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.subscribe-btn:hover {
    background: color-mix(in srgb, var(--popup-button-color, #d32f2f) 80%, black);
    transform: translateY(-2px);
}

/* Form Messages */
.form-message {
    font-size: 14px;
    padding: 8px 0;
    border-radius: 4px;
    text-align: center;
}

.form-message.success {
    color: #4caf50;
}

.form-message.error {
    color: #f44336;
}

/* Promotion Popup */
.promotion-popup .popup-content {
    text-align: center;
}

.promotion-popup .popup-image {
    width: 100%;
    max-height: 200px;
}

.promotion-popup .popup-text {
    padding: 40px;
}

.popup-content-text {
    font-size: 16px;
    line-height: 1.6;
    margin: 20px 0;
}

.popup-button {
    display: inline-block;
    background: var(--popup-button-color, #d32f2f);
    color: #ffffff;
    padding: 12px 30px;
    border-radius: 0;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.popup-button:hover {
    background: color-mix(in srgb, var(--popup-button-color, #d32f2f) 80%, black);
    transform: translateY(-2px);
}

/* Custom Popup */
.custom-popup .popup-text {
    padding: 40px;
    max-width: none;
}

/* Loading State */
.newsletter-form.loading .subscribe-btn {
    opacity: 0.7;
    cursor: not-allowed;
}

.newsletter-form.loading .subscribe-btn::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: popupSpin 1s linear infinite;
    margin-left: 8px;
}

@keyframes popupSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .popup-container {
        padding: 15px;
    }
    
    .popup-content {
        flex-direction: column;
        max-width: 100%;
        min-height: auto;
    }
    
    .newsletter-popup .popup-image {
        min-height: 200px;
        order: -1;
    }
    
    .newsletter-popup .popup-text,
    .promotion-popup .popup-text,
    .custom-popup .popup-text {
        padding: 30px 20px;
    }
    
    .popup-title {
        font-size: 20px;
    }
    
    .form-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .email-input,
    .subscribe-btn {
        width: 100%;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .popup-container {
        padding: 10px;
    }
    
    .popup-content {
        border-radius: 8px;
    }
    
    .popup-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    
    .newsletter-popup .popup-text,
    .promotion-popup .popup-text,
    .custom-popup .popup-text {
        padding: 25px 15px;
    }
    
    .popup-title {
        font-size: 18px;
    }
    
    .popup-subtitle {
        font-size: 13px;
    }
}