/**
 * KreaWA WhatsApp - Unified Premium Popup Styles
 * Baseado no design profissional de alta conversão.
 * Implementado com metodologia Mobile-First.
 *
 * @since 1.0.0
 */

/* ============================================
   BASE & OVERLAY (Mobile First)
   ============================================ */

.kreawa-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    /* Centralizado verticalmente */
    justify-content: center;
    /* Centralizado horizontalmente */
    padding: 1rem;
    /* Respiro lateral no mobile */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.kreawa-popup-overlay.kreawa-popup-active .kreawa-popup-container {
    animation: kreawa-scaleInMobile 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes kreawa-scaleInMobile {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

/* ============================================
   CONTAINER (Mobile First)
   ============================================ */

.kreawa-popup-container {
    width: 100%;
    max-width: 500px;
    /* Limite máximo universal */
    margin: 0 auto;
    background-color: white;
    border-radius: 1.5rem;
    /* Bordas arredondadas completas */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: visible !important;
    border: 1px solid #f3f4f6;
    position: relative;
    font-family: Arial, sans-serif !important;
}

/* ============================================
   HEADER
   ============================================ */

.kreawa-popup-header {
    background-color: #3C373D;
    padding: 2rem 1.5rem;
    text-align: center;
    color: white;
    position: relative;
    border-radius: 1.5rem 1.5rem 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kreawa-popup-close {
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    background-color: rgba(0, 0, 0, 0.3) !important;
    border: none !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    transition: all 0.2s;
    color: white !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 100 !important;
}

.kreawa-popup-close:hover {
    background-color: rgba(0, 0, 0, 0.5) !important;
    transform: scale(1.05);
}

.kreawa-popup-close svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
}

.icon-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.icon-circle {
    background-color: white;
    padding: 0.75rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.whatsapp-icon-header {
    width: 2rem;
    height: 2rem;
    color: #25D366;
    fill: none;
    stroke: currentColor;
}

.kreawa-popup-title {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    margin: 0 0 0.5rem 0 !important;
    color: white !important;
    line-height: 1.1 !important;
    text-transform: none !important;
    letter-spacing: 0px !important;
    font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
}

.kreawa-popup-subtitle {
    opacity: 0.9;
    font-weight: 500;
    font-size: 0.9375rem;
    margin: 0;
    color: white !important;
    line-height: 1.4;
}

/* ============================================
   BODY & FORM
   ============================================ */

.kreawa-popup-body {
    padding: 1.5rem;
    background-color: white;
}

.kreawa-field {
    margin-bottom: 0.8rem;
    position: relative;
    z-index: 1;
}

/* Stacking context for DDI list */
.kreawa-field:focus-within,
.kreawa-field:has(.iti--open) {
    z-index: 1000 !important;
}

.kreawa-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
    margin-left: 0.25rem;
    text-align: left;
}

.kreawa-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible !important;
}

.kreawa-input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.125rem;
    height: 1.125rem;
    color: #9ca3af;
    pointer-events: none;
    z-index: 2;
}

.kreawa-input {
    width: 100% !important;
    padding: 0.75rem 1rem 0.75rem 3rem !important;
    /* Espaço suficiente para o ícone padrão */
    border-radius: 0.75rem !important;
    border: 1px solid #e5e7eb !important;
    font-size: 1rem !important;
    outline: none !important;
    transition: all 0.2s !important;
    height: auto !important;
    background-color: white !important;
    color: #111827 !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    letter-spacing: 0px !important;
    font-family: 'Segoe UI', 'Helvetica Neue', sans-serif !important;
}

/* Espaço específico para o input de telefone com DDI */
.kreawa-phone-input {
    padding-left: 5.5rem !important;
    /* Espaço maior para o DDI do intl-tel-input */
}

.kreawa-input:focus {
    border-color: #25D366 !important;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1) !important;
}

/* intl-tel-input */
.iti {
    z-index: 9999 !important;
    width: 100% !important;
    position: relative;
    display: block;
}

.iti__country-list {
    z-index: 9999999 !important;
    background-color: #FFFFFF !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    border: 1px solid #E5E7EB !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
    width: 100%;
}

/* ============================================
   SUBMIT BUTTON
   ============================================ */

.kreawa-submit-btn {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    background-color: #25D366 !important;
    color: white !important;
    font-weight: bold !important;
    padding: 0.875rem !important;
    border-radius: 0.75rem !important;
    border: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.2);
    transition: all 0.2s;
    font-size: 1rem !important;
    height: auto !important;
    margin-top: 0.5rem !important;
    position: relative;
    z-index: 1;
}

.kreawa-submit-btn:active {
    transform: scale(0.98);
}

.kreawa-btn-icon {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
}

.kreawa-popup-extra-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

/* ============================================
   LGPD
   ============================================ */

.kreawa-consent-field {
    margin-bottom: 1rem;
}

.kreawa-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.75rem;
    color: #6B7280;
    line-height: 1.5;
}

.kreawa-checkbox {
    width: 1rem;
    height: 1rem;
    margin-top: 1px;
    flex-shrink: 0;
}

/* ============================================
   FOOTER
   ============================================ */

.kreawa-popup-footer {
    background-color: #f9fafb;
    padding: 1.25rem 1rem;
    border-top: 1px solid #f3f4f6;
    text-align: center;
    border-radius: 0 0 1.5rem 1.5rem;
}

.kreawa-popup-secure {
    font-size: 0.6875rem !important;
    color: #9ca3af !important;
    margin: 0 !important;
    letter-spacing: 0.025em;
}

/* ============================================
   DESKTOP ENHANCEMENTS (min-width: 481px)
   ============================================ */

@media (min-width: 481px) {
    .kreawa-popup-overlay {
        padding: 2rem;
    }

    .kreawa-popup-container {
        max-width: 28rem;
    }

    .kreawa-popup-header {
        padding: 2rem;
    }

    .kreawa-popup-close {
        width: 3rem;
        height: 3rem;
    }

    .kreawa-popup-body {
        padding: 2rem;
    }

    .kreawa-submit-btn {
        padding: 0.75rem !important;
        margin-top: 0 !important;
    }
}

/* ============================================
   TOAST NOTIFICATION (Universal)
   ============================================ */

.kreawa-toast {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    left: 1.25rem;
    /* Full width on tiny mobile */
    background-color: white;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 9999999;
    animation: kreawa-toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (min-width: 481px) {
    .kreawa-toast {
        left: auto;
        width: auto;
        max-width: 25rem;
        right: 1.5rem;
        top: 1.5rem;
    }
}

@keyframes kreawa-toastIn {
    from {
        transform: translateY(-100%) scale(0.8);
        opacity: 0;
    }

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

.kreawa-toast.success {
    border-left: 5px solid #25D366;
}

.kreawa-toast.error {
    border-left: 5px solid #ef4444;
}

.kreawa-toast-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.kreawa-toast.success .kreawa-toast-icon {
    color: #25D366;
}

.kreawa-toast.error .kreawa-toast-icon {
    color: #ef4444;
}

.kreawa-toast-message {
    flex: 1;
    color: #1f2937;
    font-size: 0.875rem;
    font-weight: 500;
}