/* Popup - Rediseñado y Mejorado */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 20px;
}

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

.popup {
    background: linear-gradient(135deg, var(--card-color) 0%, var(--surface-color) 100%);
    border-radius: 28px;
    padding: 50px 45px;
    max-width: 520px;
    width: 100%;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    position: relative;
    transform: translateY(40px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

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

/* Efecto de partículas en el fondo del popup */
.popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(229, 57, 53, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 152, 0, 0.08) 0%, transparent 50%);
    z-index: 0;
}

.popup::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
    z-index: 1;
}

/* Botón de cerrar mejorado */
.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.1);
    border: 2px solid var(--border-color);
    color: var(--text-secondary-color);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.popup-close:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 8px 25px rgba(229, 57, 53, 0.4);
}

/* Logo del popup */
.popup-logo {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

.popup-logo img {
    height: 70px;
    filter: brightness(0) invert(0);
    transition: all 0.4s ease;
}

body:not(.light-mode) .popup-logo img {
    filter: brightness(0) invert(1);
}

.popup-logo:hover img {
    transform: scale(1.05);
}

/* Icono principal del popup */
.popup-icon {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 2;
}

.popup-icon-inner {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 2.5rem;
    color: white;
    box-shadow: 
        0 15px 30px rgba(229, 57, 53, 0.3),
        0 0 0 8px rgba(229, 57, 53, 0.1);
    animation: pulse 2s infinite;
    position: relative;
    overflow: hidden;
}

.popup-icon-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.popup:hover .popup-icon-inner::before {
    left: 100%;
}

/* Contenido del popup */
.popup-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.popup h3 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--text-primary-color);
    font-weight: 700;
    line-height: 1.3;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.popup p {
    color: var(--text-secondary-color);
    margin-bottom: 20px;
    line-height: 1.7;
    font-size: 1.1rem;
    text-align: center;
}

.popup p:last-of-type {
    margin-bottom: 30px;
}

/* Botones del popup */
.popup .cta-buttons {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 15px;
}

.popup .btn {
    padding: 16px 35px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    min-width: 160px;
}

.popup .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.popup .btn:hover::before {
    left: 100%;
}

.popup .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 8px 25px rgba(229, 57, 53, 0.3);
}

.popup .btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 15px 35px rgba(229, 57, 53, 0.4),
        0 5px 15px rgba(229, 57, 53, 0.3);
}

/* Indicador de WhatsApp */
.whatsapp-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 25px 0;
    padding: 15px;
    background: rgba(37, 211, 102, 0.1);
    border-radius: 16px;
    border: 1px solid rgba(37, 211, 102, 0.2);
    position: relative;
    z-index: 2;
}

.whatsapp-indicator i {
    color: #25d366;
    font-size: 1.8rem;
    animation: bounce 2s infinite;
}

.whatsapp-indicator span {
    color: var(--text-primary-color);
    font-weight: 600;
    font-size: 1rem;
}

/* Animaciones mejoradas */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 
            0 15px 30px rgba(229, 57, 53, 0.3),
            0 0 0 8px rgba(229, 57, 53, 0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 
            0 20px 40px rgba(229, 57, 53, 0.4),
            0 0 0 12px rgba(229, 57, 53, 0.15);
    }
    100% {
        transform: scale(1);
        box-shadow: 
            0 15px 30px rgba(229, 57, 53, 0.3),
            0 0 0 8px rgba(229, 57, 53, 0.1);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Efecto de confeti (opcional, para celebrar la acción) */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    z-index: 1;
}

/* Responsive Design Mejorado */
@media (max-width: 768px) {
    .popup {
        padding: 40px 30px;
        border-radius: 24px;
        margin: 10px;
    }
    
    .popup-logo img {
        height: 60px;
    }
    
    .popup h3 {
        font-size: 1.7rem;
    }
    
    .popup p {
        font-size: 1rem;
    }
    
    .popup-icon-inner {
        width: 70px;
        height: 70px;
        font-size: 2.2rem;
    }
    
    .popup .btn {
        padding: 14px 30px;
        font-size: 1rem;
        min-width: 140px;
    }
    
    .popup-close {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 576px) {
    .popup {
        padding: 35px 25px;
        border-radius: 20px;
    }
    
    .popup-logo img {
        height: 50px;
    }
    
    .popup h3 {
        font-size: 1.5rem;
    }
    
    .popup-icon-inner {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .popup .cta-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .popup .btn {
        width: 100%;
        justify-content: center;
    }
    
    .whatsapp-indicator {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .popup {
        padding: 30px 20px;
    }
    
    .popup-overlay {
        padding: 15px;
    }
    
    .popup h3 {
        font-size: 1.4rem;
    }
    
    .popup p {
        font-size: 0.95rem;
    }
}

/* Modo claro específico */
body.light-mode .popup {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

body.light-mode .popup-close {
    background: rgba(0, 0, 0, 0.05);
}

body.light-mode .popup-close:hover {
    background: var(--primary);
}

/* Efecto de sacudida al abrir el popup */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.popup-overlay.active .popup {
    animation: shake 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) 0.3s both;
}

/* Transición de fondo más suave */
.popup-overlay {
    background: rgba(0, 0, 0, 0);
    transition: background 0.4s ease, opacity 0.4s ease, visibility 0.4s ease;
}

.popup-overlay.active {
    background: rgba(0, 0, 0, 0.8);
}

@media (max-width: 480px) {
    .popup {
        padding: 25px 20px;
        border-radius: 20px;
        margin: 10px;
    }
    
    .popup h3 {
        font-size: 1.3rem;
    }
    
    .popup p {
        font-size: 0.9rem;
    }
    
    .popup .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
}