/* ========================================================================
   LDF EXIT POPUP - Estilos Premium (v2)
   - Ícones alinhados via flexbox (sem absolute)
   - Bordas neutras até interação
   - Erro por campo individual
   ======================================================================== */

/* Overlay */
.ldf-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    box-sizing: border-box !important;
}

    .ldf-popup-overlay *:not(i):not([class*="fa-"]),
    .ldf-popup-overlay *::before:not([class*="fa-"]),
    .ldf-popup-overlay *::after:not([class*="fa-"]) {
        font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    }

    .ldf-popup-overlay *,
    .ldf-popup-overlay *::before,
    .ldf-popup-overlay *::after {
        box-sizing: border-box !important;
    }

    .ldf-popup-overlay.active {
        opacity: 1;
        visibility: visible;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(8px);
    }

/* Container */
.ldf-popup-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 1.25rem;
    box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Header gradient */
.ldf-popup-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #1e40af 100%);
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

    .ldf-popup-header::before {
        content: '';
        position: absolute;
        top: -60%;
        right: -30%;
        width: 200px;
        height: 200px;
        background: rgba(245, 158, 11, 0.15);
        border-radius: 50%;
        filter: blur(40px);
    }

    .ldf-popup-header::after {
        content: '';
        position: absolute;
        bottom: -40%;
        left: -20%;
        width: 160px;
        height: 160px;
        background: rgba(59, 130, 246, 0.2);
        border-radius: 50%;
        filter: blur(30px);
    }

.ldf-popup-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fbbf24;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    letter-spacing: 0.02em;
}

    .ldf-popup-badge i {
        font-size: 0.625rem;
    }

.ldf-popup-headline {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

    .ldf-popup-headline span {
        color: #fbbf24;
    }

.ldf-popup-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

/* Close button */
.ldf-popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    width: 2rem;
    height: 2rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

    .ldf-popup-close:hover {
        background: rgba(255, 255, 255, 0.2);
        color: #ffffff;
        transform: rotate(90deg);
    }

/* Form body */
.ldf-popup-body {
    padding: 1.5rem 2rem 2rem;
}

.ldf-popup-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

/* ============================================================
   INPUT GROUP - Ícone + Input alinhados via flexbox
   ============================================================ */
.ldf-popup-field {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ldf-popup-input-row {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 0.625rem !important;
    background: #f8fafc !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    overflow: hidden;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

    /* Ícone dentro do row - alinhado perfeitamente */
    .ldf-popup-input-row .ldf-popup-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.75rem;
        min-width: 2.75rem;
        height: 2.75rem;
        color: #94a3b8;
        font-size: 0.875rem;
        transition: color 0.2s ease;
        flex-shrink: 0;
    }

        .ldf-popup-input-row .ldf-popup-icon i {
            margin: 0 !important;
            padding: 0 !important;
            line-height: 1 !important;
            display: block !important;
        }

/* Input dentro do row - sem borda própria */
.ldf-popup-input {
    flex: 1;
    height: 2.75rem;
    padding: 0 0.875rem 0 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    line-height: normal !important;
    color: #1e293b !important;
    outline: none !important;
    box-shadow: none !important;
    min-width: 0;
}

    .ldf-popup-input::placeholder {
        color: #94a3b8;
    }

/* Focus no row inteiro */
.ldf-popup-input-row:focus-within {
    border-color: #3b82f6 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

    .ldf-popup-input-row:focus-within .ldf-popup-icon {
        color: #3b82f6 !important;
    }

/* Estado de erro - borda vermelha no row, NÃO no input */
.ldf-popup-input-row.has-error {
    border-color: #ef4444;
    background: #fef2f2;
}

    .ldf-popup-input-row.has-error:focus-within {
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    }

    .ldf-popup-input-row.has-error .ldf-popup-icon {
        color: #ef4444;
    }

/* Mensagem de erro por campo */
.ldf-popup-error-msg {
    display: none;
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
    padding-left: 0.25rem;
    font-weight: 500;
}

    .ldf-popup-error-msg.visible {
        display: block;
        animation: ldf-slideDown 0.25s ease;
    }

@keyframes ldf-slideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* CTA Button */
.ldf-popup-cta {
    width: 100%;
    height: 3rem;
    border: none;
    border-radius: 0.625rem;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    margin-top: 0.25rem;
    position: relative;
    overflow: hidden;
}

    .ldf-popup-cta::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
        opacity: 0;
        transition: opacity 0.25s;
    }

    .ldf-popup-cta:hover::before {
        opacity: 1;
    }

    .ldf-popup-cta:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 24px -4px rgba(30, 64, 175, 0.4);
    }

    .ldf-popup-cta:active {
        transform: translateY(0);
    }

    .ldf-popup-cta:disabled {
        opacity: 0.7;
        cursor: not-allowed;
        transform: none !important;
        box-shadow: none !important;
    }

    .ldf-popup-cta i {
        font-size: 0.875rem;
    }

    /* Loading state */
    .ldf-popup-cta .ldf-spinner {
        display: none;
        width: 1.125rem;
        height: 1.125rem;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-top-color: #ffffff;
        border-radius: 50%;
        animation: ldf-spin 0.6s linear infinite;
    }

    .ldf-popup-cta.loading .ldf-spinner {
        display: block;
    }

    .ldf-popup-cta.loading .ldf-cta-text,
    .ldf-popup-cta.loading .ldf-cta-icon {
        display: none;
    }

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

/* Trust note */
.ldf-popup-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
    font-size: 0.6875rem;
    color: #64748b;
    text-align: center;
    line-height: 1.4;
}

    .ldf-popup-trust i {
        font-size: 0.5625rem;
        flex-shrink: 0;
    }

/* Success state */
.ldf-popup-success {
    display: none;
    text-align: center;
    padding: 2rem;
}

    .ldf-popup-success.visible {
        display: block;
        animation: ldf-fadeUp 0.5s ease;
    }

@keyframes ldf-fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ldf-popup-success-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px -4px rgba(34, 197, 94, 0.35);
}

    .ldf-popup-success-icon i {
        color: #ffffff;
        font-size: 1.75rem;
    }

.ldf-popup-success-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.375rem;
}

.ldf-popup-success-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

/* Responsive - Mobile sheet */
@media (max-width: 480px) {
    .ldf-popup-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .ldf-popup-container {
        max-width: 100%;
        border-radius: 1.25rem 1.25rem 0 0;
        max-height: 92vh;
        overflow-y: auto;
        transform: translateY(100%);
    }

    .ldf-popup-overlay.active .ldf-popup-container {
        transform: translateY(0);
    }

    .ldf-popup-header {
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .ldf-popup-headline {
        font-size: 1.25rem;
    }

    .ldf-popup-body {
        padding: 1.25rem;
    }

    .ldf-popup-input {
        height: 2.625rem;
        font-size: 1rem;
    }

    .ldf-popup-input-row {
        height: auto;
    }

        .ldf-popup-input-row .ldf-popup-icon {
            height: 2.625rem;
            width: 2.625rem;
            min-width: 2.625rem;
        }

    .ldf-popup-cta {
        height: 2.875rem;
    }
}

/* Accessibility */
.ldf-popup-close:focus-visible,
.ldf-popup-input:focus-visible,
.ldf-popup-cta:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ldf-popup-overlay,
    .ldf-popup-container,
    .ldf-popup-input-row,
    .ldf-popup-cta,
    .ldf-popup-close {
        transition: none !important;
        animation: none !important;
    }
}
