/**
 * Estilos para Lead Magnet Popup
 * Sistema de captura de leads con descuento de bienvenida
 */

/* Overlay del popup */
.lead-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    /* El blur en el backdrop puede provocar lentitud en dispositivos modestos.
       Por defecto lo desactivamos y lo activamos solo en dispositivos de escritorio. */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    will-change: opacity;
}

/* Activar blur solo en dispositivos con puntero fino (escritorio) */
@media (hover: hover) and (pointer: fine) {
  .lead-popup-overlay {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
  /* Cuando hay un popup activo, pausar animaciones y transiciones de elementos de fondo (hero, carruseles) */
  .ap-popup-active .hero-slide img,
  .ap-popup-active .carousel-track,
  .ap-popup-active .categories-carousel,
  .ap-popup-active .discount-ribbon-badge {
    transition: none !important;
    animation-play-state: paused !important;
  }
}

.lead-popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Contenedor del popup (optimizado para rendimiento) */
.lead-popup-content {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    max-width: 480px;
    width: 100%;
    max-height: 88vh; /* Reduce altura para evitar cortes */
    overflow-y: auto; /* Fallback: si aún no cabe, permite scroll interno */
    /* Box-shadow más ligero para reducir repaints */
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    transform: scale(0.96);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    will-change: transform;
}

.lead-popup-overlay.show .lead-popup-content {
    transform: scale(1);
}

/* Botón cerrar */
.lead-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.lead-popup-close:hover {
    background: rgba(0, 0, 0, 0.12);
    /* Evitar rotaciones costosas en algunos navegadores; usar scale para menor impacto */
    transform: scale(1.04);
}

/* Header del popup */
.lead-popup-header {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    padding: 32px 24px 18px; /* Menos padding vertical */
    text-align: center;
    border-radius: 24px 24px 0 0;
    color: white;
}

.lead-popup-icon {
    font-size: 2.6rem; /* Más compacto */
    margin-bottom: 10px;
    animation: bounce 3s ease-in-out infinite; /* menos frecuencia y easing más suave */
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Respetar preferencia reduce-motion: deshabilitar animación en dispositivos con movilidad reducida */
@media (prefers-reduced-motion: reduce) {
  .lead-popup-icon { animation: none !important; }
}

.lead-popup-title {
    font-size: 1.45rem; /* Reduce tamaño del título */
    font-weight: 800;
    margin: 0 0 10px 0;
    line-height: 1.2;
    color: white;
    text-transform: uppercase; /* Forzar todo en mayúsculas */
    letter-spacing: 0.4px;
} 

.lead-popup-description {
    font-size: 1rem;
    margin: 0;
    opacity: 0.95;
    line-height: 1.5;
    color: #ffffff !important;
}

/* Cuerpo del popup */
.lead-popup-body {
    padding: 20px; /* Compacta el cuerpo */
}

/* Badge de descuento (ocultada por petición: quitar tarjeta verde) */
.lead-discount-badge {
    display: none !important;
}

.lead-discount-percentage {
    font-size: 2.6rem; /* Reduce el número grande */
    font-weight: 900;
    line-height: 1;
    margin-bottom: 6px;
}

.lead-discount-text {
    font-size: 1rem;
    font-weight: 600;
    opacity: 0.95;
    line-height: 1.3;
}

/* Formulario */
.lead-form {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Menos espacio entre campos */
}

.lead-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lead-form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
}

.lead-form-group label svg {
    color: #0284c7;
}

.lead-form-group input {
    width: 100%;
    padding: 12px 14px; /* Más compacto */
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.lead-form-group input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.1);
}

.lead-form-group input::placeholder {
    color: #94a3b8;
}

/* Términos */
.lead-terms {
    margin-top: -8px;
}

.lead-terms small {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
    display: block;
}

/* Botón submit */
.lead-submit-btn {
    width: 100%;
    padding: 14px 20px; /* Reduce altura del botón */
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
    text-transform: uppercase; /* Forzar mayúsculas */
    letter-spacing: 0.6px;
}

.lead-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
}

.lead-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.lead-submit-btn .spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mensaje de éxito */
.lead-success-message {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lead-success-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.lead-success-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px 0;
}

.lead-success-text {
    font-size: 1rem;
    color: #64748b;
    margin: 0 0 24px 0;
}

/* Display del cupón */
.lead-coupon-display {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 3px dashed #0284c7;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.lead-coupon-code {
    font-size: 1.75rem;
    font-weight: 900;
    font-family: 'Segoe UI', 'Segoe UI Symbol' !important;
    color: #0284c7;
    letter-spacing: 2px;
    word-break: break-all;
}

.lead-copy-btn {
    padding: 10px 20px;
    background: #0284c7;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.lead-copy-btn:hover {
    background: #0369a1;
    transform: translateY(-2px);
}

/* Instrucciones del cupón */
.lead-coupon-instructions {
    background: #fef3c7;
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid #f59e0b;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #78350f;
    line-height: 1.5;
}

.lead-coupon-instructions strong {
    color: #92400e;
}

/* Botón de comprar ahora */
.lead-shop-now-btn {
    width: 100%;
    padding: 14px 20px; /* Reduce altura */
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    text-transform: uppercase; /* Botón en mayúsculas */
    letter-spacing: 0.6px;
}

.lead-shop-now-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Responsive */
@media (max-width: 640px) {
    .lead-popup-content {
        max-width: 100%;
        border-radius: 16px;
        margin: 10px;
    }

    .lead-popup-header {
        padding: 40px 24px 24px;
    }

    .lead-popup-title {
        font-size: 1.5rem;
    }

    .lead-popup-body {
        padding: 24px;
    }

    .lead-discount-percentage {
        font-size: 2.4rem;
    }

    .lead-coupon-code {
        font-size: 1.4rem;
    }
}

/* Imagen opcional debajo del header */
.lead-image-wrap {
    padding: 16px 24px 0;
}
.lead-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    max-height: 260px; /* Evita que la imagen domine el popup */
    object-fit: cover;
}

/* Ajustes para pantallas con poca altura para evitar scroll */
@media (max-height: 800px) {
    .lead-popup-header { padding: 28px 20px 16px; }
    .lead-popup-title { font-size: 1.35rem; }
    .lead-popup-description { font-size: 0.95rem; }
    .lead-popup-body { padding: 18px; }
    .lead-discount-percentage { font-size: 2.3rem; }
}

@media (max-height: 700px) {
    .lead-popup-header { padding: 26px 20px 14px; }
    .lead-popup-title { font-size: 1.35rem; }
    .lead-popup-description { font-size: 0.9rem; }
    .lead-discount-percentage { font-size: 2.2rem; }
    .lead-submit-btn, .lead-shop-now-btn { padding: 12px 18px; }
    .lead-image { max-height: 180px; }
}

/* Ajuste suave para pantallas medianas de altura (evita cortes) */
@media (max-height: 900px) {
    .lead-popup-content { max-height: 86vh; }
    .lead-popup-header { padding: 30px 22px 16px; }
    .lead-popup-title { font-size: 1.4rem; }
    .lead-discount-percentage { font-size: 2.5rem; }
}

@media (max-height: 620px) {
    .lead-popup-content { max-width: 440px; }
    .lead-popup-header { padding: 22px 18px 12px; }
    .lead-popup-title { font-size: 1.25rem; }
    .lead-discount-percentage { font-size: 2rem; }
}

/* Animaciones adicionales */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}
