/**
 * Popup System Styles
 * 
 * Versatile popup styles supporting multiple types:
 * - Newsletter signup (exit intent)
 * - Free shipping reminder
 * - Promotional offers
 * - Notifications
 */

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

/* ============================================
   Base Overlay
   ============================================ */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* ============================================
   Modal Container
   ============================================ */
.popup-modal {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    padding: 32px;
    position: relative;
    text-align: center;
    box-shadow: 20px 20px 20px 0px rgba(0, 0, 0, 0.08);
    
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
}

.popup-active .popup-modal {
    transform: scale(1) translateY(0);
}

/* ============================================
   Close Button
   ============================================ */
.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    z-index: 10;
}

.popup-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.popup-close svg {
    width: 20px;
    height: 20px;
    stroke: #666;
    stroke-width: 2;
}

.popup-close:hover svg {
    stroke: #333;
}

/* ============================================
   Header Image
   ============================================ */
.popup-header-image {
    width: 100%;
    height: 190px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ffa726 25%, #ffeb3b 50%, #66bb6a 75%, #42a5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.popup-header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Discount badge overlay */
.popup-discount-badge {
    font-family: 'Open Sans', 'Inter', Arial, sans-serif;
    font-size: 72px;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -2px;
}

/* Alternative: Simple colored header */
.popup-header-simple {
    width: 100%;
    padding: 32px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #30ade7 0%, #1e90d0 100%);
}

.popup-header-simple .popup-discount-badge {
    font-size: 56px;
}

/* ============================================
   Content
   ============================================ */
.popup-content {
    margin-bottom: 24px;
}

.popup-title {
    font-family: 'Open Sans', 'Inter', Arial, sans-serif;
    font-size: 32px;
    font-weight: 600;
    color: #000000;
    border-bottom: 0px solid #ddd;
    padding-bottom: 0px;
    margin-bottom: 10px;
    line-height: 1.3;
}

.popup-description {
    font-family: 'Open Sans', 'Inter', Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.56);
    line-height: 1.4;
    margin: 0;
}

.popup-description strong {
    color: rgba(0, 0, 0, 0.8);
}

/* ============================================
   Form Elements
   ============================================ */
.popup-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.popup-input {
    width: 100%;
    height: 48px;
    padding: 14px 16px;
    border: 1px solid #cccccc;
    border-radius: 8px;
    font-family: 'Open Sans', 'Inter', Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #333333;
    background: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.popup-input::placeholder {
    color: #acacac;
}

.popup-input:focus {
    outline: none;
    border-color: #30ade7;
    box-shadow: 0 0 0 3px rgba(48, 173, 231, 0.15);
}

.popup-input.error {
    border-color: #e74c3c;
}

.popup-button {
    width: 100%;
    height: 48px;
    padding: 14px 20px;
    background: #30ade7;
    border: none;
    border-radius: 8px;
    font-family: 'Open Sans', 'Inter', Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #f5f5f5;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-button:hover {
    background: #1e90d0;
}

.popup-button:active {
    transform: scale(0.98);
}

.popup-button:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* Secondary/Ghost button */
.popup-button-secondary {
    background: transparent;
    color: #acacac;
    font-size: 14px;
    height: auto;
    padding: 8px 16px;
    text-transform: none;
}

.popup-button-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #666666;
}

/* ============================================
   Messages
   ============================================ */
.popup-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 16px;
    color: #dc2626;
    font-size: 14px;
    display: none;
}

.popup-error.visible {
    display: block;
}

.popup-success {
    display: none;
}

.popup-success.visible {
    display: block;
}

.popup-success-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.popup-success-icon svg {
    width: 32px;
    height: 32px;
    stroke: #ffffff;
    stroke-width: 3;
}

.popup-discount-code {
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: 700;
    color: #30ade7;
    letter-spacing: 2px;
}

/* ============================================
   Privacy Note
   ============================================ */
.popup-privacy {
    font-size: 12px;
    color: #acacac;
    margin-top: 16px;
}

.popup-privacy a {
    color: #30ade7;
    text-decoration: none;
}

.popup-privacy a:hover {
    text-decoration: underline;
}

/* ============================================
   Cart Value / Free Shipping Variant
   ============================================ */
.popup-shipping-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px auto;
}

.popup-shipping-icon svg {
    width: 100%;
    height: 100%;
    fill: #30ade7;
}

.popup-remaining-amount {
    font-size: 32px;
    font-weight: 700;
    color: #30ade7;
    margin: 8px 0;
}

.popup-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.popup-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #30ade7 0%, #10b981 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Shipping Tiers */
.popup-shipping-tiers {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.shipping-tier {
    text-align: center;
    padding: 12px 20px;
    border-radius: 8px;
    background: #f9fafb;
    transition: all 0.2s ease;
}

.shipping-tier.reached {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}

.shipping-tier.reached .tier-label,
.shipping-tier.reached .tier-price {
    color: #fff;
}

.tier-label {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.tier-price {
    display: block;
    font-size: 13px;
    color: #666;
}

.shipping-tier.current {
    border: 2px solid #30ade7;
    background: #f0f9ff;
}

.shipping-tier.current .tier-label {
    color: #30ade7;
}

/* ============================================
   Loading State
   ============================================ */
.popup-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.popup-loading.visible {
    display: flex;
}

.popup-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #30ade7;
    border-radius: 50%;
    animation: popup-spin 0.8s linear infinite;
}

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

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 480px) {
    .popup-overlay {
        padding: 12px;
        align-items: flex-end;
    }
    
    .popup-modal {
        padding: 24px;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .popup-header-image {
        height: 140px;
        margin-bottom: 20px;
    }
    
    .popup-discount-badge {
        font-size: 48px;
    }
    
    .popup-title {
        font-size: 20px;
    }
    
    .popup-description {
        font-size: 14px;
    }
    
    .popup-input,
    .popup-button {
        height: 44px;
        font-size: 15px;
    }
}

/* ============================================
   Animation Variants
   ============================================ */
.popup-overlay.slide-up .popup-modal {
    transform: translateY(100%);
}

.popup-overlay.slide-up.popup-active .popup-modal {
    transform: translateY(0);
}

.popup-overlay.fade .popup-modal {
    transform: none;
    opacity: 0;
}

.popup-overlay.fade.popup-active .popup-modal {
    opacity: 1;
}
