/**
 * AVANC3 Exit Intent Popup - Frontend Styles
 * 
 * @package AVANC3_Exit_Popup
 * @author AVANC3 Web - https://avanc3.pe
 */

/* ========== OVERLAY ========== */
.avanc3-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    padding: 20px;
    box-sizing: border-box;
}

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

/* ========== CONTAINER ========== */
.avanc3-popup-container {
    background: var(--avanc3-bg, #ffffff);
    border-radius: 24px;
    max-width: 520px;
    width: 100%;
    overflow: hidden;
    transform: scale(0.8) translateY(30px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    position: relative;
    font-family: var(--avanc3-font, 'Playfair Display', serif);
    max-height: 90vh;
    overflow-y: auto;
}

.avanc3-popup-overlay.active .avanc3-popup-container {
    transform: scale(1) translateY(0);
}

/* ========== CLOSE BUTTON ========== */
.avanc3-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #666;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    line-height: 1;
    padding: 0;
}

.avanc3-popup-close:hover {
    background: #ff6b6b;
    color: white;
    transform: rotate(90deg);
}

/* ========== HEADER ========== */
.avanc3-popup-header {
    background: linear-gradient(135deg, var(--avanc3-primary, #1a1a1a) 0%, color-mix(in srgb, var(--avanc3-primary, #1a1a1a) 80%, #333) 100%);
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.avanc3-popup-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    animation: avanc3-shimmer 4s infinite linear;
}

@keyframes avanc3-shimmer {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

.avanc3-popup-emoji {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: block;
    animation: avanc3-wave 1.5s ease-in-out infinite;
    position: relative;
}

@keyframes avanc3-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

.avanc3-popup-header h2 {
    font-family: var(--avanc3-font, 'Playfair Display', serif);
    color: white;
    font-size: 1.75rem;
    margin: 0 0 10px 0;
    position: relative;
    font-weight: 700;
    line-height: 1.3;
}

.avanc3-popup-header p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    position: relative;
    margin: 0;
    font-weight: 400;
}

/* ========== BODY ========== */
.avanc3-popup-body {
    padding: 35px 30px;
    text-align: center;
}

/* ========== COUPON TICKET ========== */
.avanc3-coupon-ticket {
    background: linear-gradient(135deg, var(--avanc3-secondary, #c9a87c) 0%, color-mix(in srgb, var(--avanc3-secondary, #c9a87c) 85%, white) 50%, var(--avanc3-secondary, #c9a87c) 100%);
    border-radius: 16px;
    padding: 25px 35px;
    margin-bottom: 25px;
    position: relative;
    box-shadow: 0 8px 30px color-mix(in srgb, var(--avanc3-secondary, #c9a87c) 40%, transparent);
}

.avanc3-coupon-ticket::before,
.avanc3-coupon-ticket::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--avanc3-bg, #ffffff);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.avanc3-coupon-ticket::before {
    left: -10px;
}

.avanc3-coupon-ticket::after {
    right: -10px;
}

.avanc3-coupon-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.avanc3-coupon-discount {
    font-family: var(--avanc3-font, 'Playfair Display', serif);
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    line-height: 1;
    margin: 0 0 5px 0;
}

.avanc3-coupon-discount span {
    font-size: 1.5rem;
    vertical-align: super;
}

.avanc3-coupon-subtitle {
    color: white;
    font-size: 0.95rem;
    opacity: 0.95;
    margin: 0;
    font-weight: 500;
}

/* ========== COUPON CODE ========== */
.avanc3-coupon-code-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px 20px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.avanc3-coupon-code {
    font-family: var(--avanc3-font, 'Playfair Display', serif);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--avanc3-primary, #1a1a1a);
}

.avanc3-copy-btn {
    background: var(--avanc3-primary, #1a1a1a);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    font-family: var(--avanc3-font, 'Playfair Display', serif);
    letter-spacing: 1px;
    white-space: nowrap;
}

.avanc3-copy-btn:hover {
    background: var(--avanc3-accent, #667eea);
    transform: scale(1.05);
}

.avanc3-copy-btn.copied {
    background: #27ae60;
}

/* ========== MESSAGE ========== */
.avanc3-popup-message {
    color: var(--avanc3-text, #666);
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0 0 25px 0;
}

.avanc3-popup-message strong {
    color: var(--avanc3-primary, #1a1a1a);
}

/* ========== CTA BUTTON ========== */
.avanc3-popup-cta {
    background: linear-gradient(135deg, var(--avanc3-primary, #1a1a1a) 0%, color-mix(in srgb, var(--avanc3-primary, #1a1a1a) 80%, #444) 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    width: 100%;
    font-family: var(--avanc3-font, 'Playfair Display', serif);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.avanc3-popup-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.avanc3-popup-cta:active {
    transform: translateY(-1px);
}

/* ========== FOOTER ========== */
.avanc3-popup-footer {
    background: color-mix(in srgb, var(--avanc3-bg, #ffffff) 95%, var(--avanc3-secondary, #c9a87c));
    padding: 18px 20px;
    text-align: center;
    border-top: 1px dashed color-mix(in srgb, var(--avanc3-secondary, #c9a87c) 30%, transparent);
}

.avanc3-popup-footer p {
    font-size: 0.85rem;
    color: var(--avanc3-text, #888);
    margin: 0;
}

.avanc3-timer {
    color: #e74c3c;
    font-weight: 700;
    font-family: var(--avanc3-font, 'Playfair Display', serif);
}

/* ========== TOAST NOTIFICATION ========== */
.avanc3-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    padding: 16px 28px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(39, 174, 96, 0.4);
    z-index: 1000000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-family: var(--avanc3-font, 'Playfair Display', serif);
}

.avanc3-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.avanc3-toast-icon {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .avanc3-popup-overlay {
        padding: 15px;
        align-items: flex-end;
    }

    .avanc3-popup-container {
        border-radius: 24px 24px 0 0;
        max-height: 85vh;
    }

    .avanc3-popup-header {
        padding: 30px 20px;
    }

    .avanc3-popup-emoji {
        font-size: 2.8rem;
    }

    .avanc3-popup-header h2 {
        font-size: 1.4rem;
    }

    .avanc3-popup-body {
        padding: 25px 20px;
    }

    .avanc3-coupon-ticket {
        padding: 20px 30px;
    }

    .avanc3-coupon-discount {
        font-size: 2.8rem;
    }

    .avanc3-coupon-code-container {
        flex-direction: column;
        gap: 12px;
    }

    .avanc3-coupon-code {
        font-size: 1.2rem;
    }

    .avanc3-copy-btn {
        width: 100%;
        padding: 12px 20px;
    }

    .avanc3-popup-cta {
        padding: 16px 30px;
        font-size: 0.85rem;
    }

    .avanc3-toast {
        bottom: 20px;
        left: 20px;
        right: 20px;
        transform: translateX(0) translateY(100px);
        border-radius: 12px;
        justify-content: center;
    }

    .avanc3-toast.show {
        transform: translateX(0) translateY(0);
    }
}

@media (max-width: 380px) {
    .avanc3-popup-header h2 {
        font-size: 1.25rem;
    }

    .avanc3-coupon-discount {
        font-size: 2.4rem;
    }

    .avanc3-coupon-code {
        font-size: 1rem;
        letter-spacing: 2px;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes avanc3-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--avanc3-secondary, #c9a87c) 50%, transparent);
    }
    50% {
        box-shadow: 0 0 0 15px transparent;
    }
}

.avanc3-coupon-ticket {
    animation: avanc3-pulse 2s infinite;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .avanc3-popup-overlay,
    .avanc3-popup-container,
    .avanc3-popup-close,
    .avanc3-copy-btn,
    .avanc3-popup-cta,
    .avanc3-toast {
        transition: none;
    }

    .avanc3-popup-emoji,
    .avanc3-popup-header::before,
    .avanc3-coupon-ticket {
        animation: none;
    }
}
