/* ==========================================
   JCFlow — Smart Floating Lead Card (assets/css/lead-popup.css)
   Alternativa no invasiva de alta conversión:
   - Posicionamiento flotante no bloqueante (esquina inferior derecha)
   - Cero overlay que oscurezca la navegación
   - Estética Glassmorphism Cyber Indigo coherente con JCFlow
   - Optimizado para touch targets WCAG 2.2 (min 44x44px)
   ========================================== */

.lead-smart-card {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    top: auto;
    z-index: 9990;
    width: 390px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.96);
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.35s;
}

.lead-smart-card[hidden] {
    display: none;
}

.lead-smart-card.lead-smart-card--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Card principal */
.lead-smart-card__inner {
    position: relative;
    background: linear-gradient(155deg, rgba(17, 24, 39, 0.98) 0%, rgba(10, 15, 30, 0.98) 100%);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 20px;
    padding: 22px 22px 20px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55),
                0 0 0 1px rgba(255, 255, 255, 0.05),
                0 4px 20px rgba(79, 70, 229, 0.25);
    color: #f1f5f9;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* Header de la tarjeta */
.lead-smart-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-right: 28px;
}

.lead-smart-card__status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(37, 211, 102, 0.12);
    border: 1px solid rgba(37, 211, 102, 0.3);
    color: #4ade80;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 4px 11px;
    border-radius: 999px;
    text-transform: uppercase;
}

.lead-smart-card__pulse-dot {
    width: 7px;
    height: 7px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: leadCardPulse 2s infinite;
}

@keyframes leadCardPulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Botón cerrar táctil 44x44px */
.lead-smart-card__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s ease;
    touch-action: manipulation;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.lead-smart-card__close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    transition: transform 0.2s ease;
}

.lead-smart-card__close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.lead-smart-card__close:hover svg {
    transform: rotate(90deg);
}

/* Título */
.lead-smart-card__title {
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 8px 0;
    color: #ffffff;
}

.lead-smart-card__title-accent {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Descripción */
.lead-smart-card__desc {
    font-size: 0.86rem;
    line-height: 1.45;
    color: #cbd5e1;
    margin: 0 0 16px 0;
}

/* Acciones */
.lead-smart-card__actions {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

/* Botón principal WhatsApp */
.lead-smart-card__btn-wa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 44px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #ffffff !important;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
}

.lead-smart-card__btn-wa:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(37, 211, 102, 0.5);
    color: #ffffff;
}

.lead-smart-card__wa-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

/* Enlace secundario */
.lead-smart-card__link-trial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 38px;
    padding: 6px 14px;
    color: #a5b4fc;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
    text-align: center;
}

.lead-smart-card__link-trial:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Micro-badge de confianza */
.lead-smart-card__trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.74rem;
    color: #94a3b8;
}

.lead-smart-card__trust svg {
    width: 13px;
    height: 13px;
    fill: #22c55e;
    flex-shrink: 0;
}

/* Responsividad Mobile: Native Bottom-Sheet en viewports < 768px */
@media (max-width: 767.98px) {
    /* Ocultar card flotante de desktop en móviles */
    .lead-smart-card {
        display: none !important;
    }
}

/* ============================================
   JCFlow — Native Mobile Slidable Bottom-Sheet
   (Reemplaza popups/modales en viewports < 768px)
   ============================================ */
.lead-bottom-sheet {
    display: none;
}

@media (max-width: 767.98px) {
    .lead-bottom-sheet {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
    }

    .lead-bottom-sheet[hidden] {
        display: none;
    }

    .lead-bottom-sheet.lead-bottom-sheet--visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* Backdrop con blur profundo */
    .lead-bottom-sheet__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(4, 7, 18, 0.78);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        transition: opacity 0.3s ease;
    }

    /* Hoja deslizable inferior estilo iOS / Android nativo */
    .lead-bottom-sheet__sheet {
        position: relative;
        z-index: 1;
        width: 100%;
        max-height: 88vh;
        background: linear-gradient(175deg, #111827 0%, #090d16 100%);
        border-top: 1px solid rgba(99, 102, 241, 0.4);
        border-radius: 24px 24px 0 0;
        padding: 8px 20px calc(24px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.75);
        color: #f8fafc;
        font-family: 'Inter', system-ui, -apple-system, sans-serif;
        box-sizing: border-box;
        transform: translateY(100%);
        transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
        will-change: transform;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    .lead-bottom-sheet.lead-bottom-sheet--visible .lead-bottom-sheet__sheet {
        transform: translateY(0);
    }

    /* Zona de arrastre táctil / Drag handle pill */
    .lead-bottom-sheet__handle-zone {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px 0 14px;
        cursor: grab;
        touch-action: none;
    }

    .lead-bottom-sheet__handle {
        width: 44px;
        height: 5px;
        border-radius: 99px;
        background: rgba(255, 255, 255, 0.28);
        transition: background-color 0.2s;
    }

    .lead-bottom-sheet__handle-zone:active .lead-bottom-sheet__handle {
        background: rgba(99, 102, 241, 0.7);
    }

    /* Botón cerrar táctil 44x44px */
    .lead-bottom-sheet__close {
        position: absolute;
        top: 14px;
        right: 14px;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.06);
        border: none;
        border-radius: 12px;
        color: #94a3b8;
        cursor: pointer;
        padding: 0;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .lead-bottom-sheet__close svg {
        width: 20px;
        height: 20px;
        stroke: currentColor;
        stroke-width: 2.2;
        fill: none;
    }

    /* Header del Bottom-Sheet */
    .lead-bottom-sheet__header {
        margin-bottom: 16px;
        padding-right: 36px;
    }

    .lead-bottom-sheet__badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: rgba(37, 211, 102, 0.12);
        border: 1px solid rgba(37, 211, 102, 0.3);
        color: #4ade80;
        font-size: 0.72rem;
        font-weight: 700;
        padding: 3px 9px;
        border-radius: 999px;
        text-transform: uppercase;
        margin-bottom: 8px;
    }

    .lead-bottom-sheet__pulse-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background-color: #22c55e;
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
        animation: leadCardPulse 2s infinite;
    }

    .lead-bottom-sheet__title {
        font-size: 1.15rem;
        font-weight: 800;
        line-height: 1.3;
        margin: 0 0 6px 0;
        color: #ffffff;
    }

    .lead-bottom-sheet__desc {
        font-size: 0.85rem;
        line-height: 1.45;
        color: #cbd5e1;
        margin: 0;
    }

    /* Tabs de elección (WhatsApp / Email) */
    .lead-bottom-sheet__tabs {
        display: flex;
        gap: 6px;
        background: rgba(255, 255, 255, 0.05);
        padding: 4px;
        border-radius: 12px;
        margin-bottom: 14px;
    }

    .lead-bottom-sheet__tab {
        flex: 1;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: transparent;
        color: #94a3b8;
        font-size: 0.82rem;
        font-weight: 600;
        border-radius: 9px;
        cursor: pointer;
        transition: all 0.2s ease;
        touch-action: manipulation;
    }

    .lead-bottom-sheet__tab--active {
        background: rgba(99, 102, 241, 0.28);
        color: #ffffff;
        border: 1px solid rgba(99, 102, 241, 0.45);
    }

    /* Campos de formulario */
    .lead-bottom-sheet__field {
        margin-bottom: 14px;
    }

    .lead-bottom-sheet__label {
        display: block;
        font-size: 0.78rem;
        font-weight: 600;
        color: #cbd5e1;
        margin-bottom: 6px;
    }

    .lead-bottom-sheet__input-wrap {
        display: flex;
        align-items: center;
        background: rgba(17, 24, 39, 0.9);
        border: 1px solid rgba(99, 102, 241, 0.35);
        border-radius: 12px;
        overflow: hidden;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .lead-bottom-sheet__input-wrap:focus-within {
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    }

    .lead-bottom-sheet__flag {
        padding: 0 10px;
        font-size: 0.82rem;
        font-weight: 600;
        color: #94a3b8;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        white-space: nowrap;
        user-select: none;
    }

    .lead-bottom-sheet__input {
        flex: 1;
        min-height: 48px;
        height: 48px;
        background: transparent;
        border: none;
        outline: none;
        color: #ffffff;
        font-size: 1rem;
        font-family: inherit;
        padding: 0 12px;
        box-sizing: border-box;
    }

    .lead-bottom-sheet__input::placeholder {
        color: #64748b;
    }

    /* Botón de envío principal */
    .lead-bottom-sheet__submit {
        width: 100%;
        min-height: 50px;
        height: 50px;
        background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
        border: none;
        border-radius: 12px;
        color: #ffffff;
        font-size: 0.96rem;
        font-weight: 700;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.12s ease, filter 0.12s ease;
    }

    .lead-bottom-sheet__submit:active {
        transform: scale(0.97);
        filter: brightness(1.1);
    }

    /* Estado de feedback */
    .lead-bottom-sheet__feedback {
        text-align: center;
        padding: 20px 10px;
    }

    .lead-bottom-sheet__feedback-icon {
        font-size: 2.5rem;
        margin-bottom: 8px;
    }

    .lead-bottom-sheet__feedback-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: #ffffff;
        margin: 0 0 6px 0;
    }

    .lead-bottom-sheet__feedback-text {
        font-size: 0.85rem;
        color: #94a3b8;
        margin: 0;
    }

    /* Confianza */
    .lead-bottom-sheet__trust {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin-top: 14px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        font-size: 0.74rem;
        color: #94a3b8;
    }
}
