/**
 * Estilos do Frontend - WhatsApp MPI
 * Todos os seletores usam prefixo whatsapp-MPI_ para evitar conflitos
 */

/* Botão Flutuante */
.whatsapp-MPI_floating-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 9998;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.whatsapp-MPI_floating-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.6);
}

.whatsapp-MPI_floating-button:focus {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

.whatsapp-MPI_icon {
    width: 32px;
    height: 32px;
    display: block;
}

.whatsapp-MPI_badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #FF0000;
    color: #FFFFFF;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

/* Overlay */
.whatsapp-MPI_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}



/* Popup */
.whatsapp-MPI_popup {
    position: fixed;
    bottom: 62px;
    right: 74px;
    width: 90%;
    max-width: 350px;
    background-color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.whatsapp-MPI_popup.active {
    opacity: 1;
    visibility: visible;
  
}


.whatsapp-MPI_popup-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.whatsapp-MPI_header {
    background: linear-gradient(135deg, #075E54 0%, #128C7E 100%);
    padding: 15px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.whatsapp-MPI_header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.whatsapp-MPI_logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background-color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.whatsapp-MPI_logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.whatsapp-MPI_title {
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.whatsapp-MPI_close {
    background: transparent;
    border: none;
    color: #FFFFFF;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.whatsapp-MPI_close:hover {
    opacity: 0.7;
}

.whatsapp-MPI_close:focus {
    outline: 2px solid #FFFFFF;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Body */
.whatsapp-MPI_body {
    padding: 30px 20px;
    background-color: #F5F5F5;
}

.whatsapp-MPI_form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.whatsapp-MPI_field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.whatsapp-MPI_label {
    color: #333333;
    font-size: 14px;
    font-weight: 500;
    display: block;
}

.whatsapp-MPI_input,
.whatsapp-MPI_select {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid #DDDDDD;
    border-radius: 8px;
    font-size: 12px;
    background-color: #FFFFFF;
    color: #333333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.whatsapp-MPI_input:focus,
.whatsapp-MPI_select:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.whatsapp-MPI_input::placeholder {
    color: #999999;
}

.whatsapp-MPI_select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.whatsapp-MPI_error {
    color: #FF0000;
    font-size: 12px;
    display: none;
    margin-top: 4px;
}

.whatsapp-MPI_error.show {
    display: block;
}

.whatsapp-MPI_input.error {
    border-color: #FF0000 !important;
}

.whatsapp-MPI_field-hidden {
    display: none !important;
}

.whatsapp-MPI_field-visible {
    display: flex !important;
    animation: whatsapp-MPI_slideDown 0.3s ease;
}

@keyframes whatsapp-MPI_slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.whatsapp-MPI_button:disabled {
    background-color: #CCCCCC;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.whatsapp-MPI_button {
    width: 100%;
    padding: 10px 20px;
    background-color: #25D366;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    letter-spacing: 0.5px;
}

.whatsapp-MPI_button:hover {
    background-color: #20BA5A;
    transform: translateY(-1px);
}

.whatsapp-MPI_button:active {
    transform: translateY(0);
}

.whatsapp-MPI_button:focus {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

.whatsapp-MPI_button:disabled {
    background-color: #CCCCCC;
    cursor: not-allowed;
    transform: none;
}

/* Loading - mantém botão verde */
.whatsapp-MPI_button.loading {
    background-color: #25D366 !important;
    cursor: wait;
}

.whatsapp-MPI_button.loading:disabled {
    background-color: #25D366 !important;
    cursor: wait;
}

.whatsapp-MPI_loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.whatsapp-MPI_spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: whatsapp-MPI_spin 0.8s linear infinite;
}

@keyframes whatsapp-MPI_spin {
    to {
        transform: rotate(360deg);
    }
}

.whatsapp-MPI_button.loading .whatsapp-MPI_button-text {
    display: none;
}

.whatsapp-MPI_button.loading .whatsapp-MPI_loading {
    display: flex !important;
}

/* Responsividade */
@media (max-width: 768px) {
    .whatsapp-MPI_popup {
        width: calc(100% - 40px);
        max-width: none;
        bottom: 80px;
        right: 20px;
        left: 20px;
    }

    .whatsapp-MPI_header {
        padding: 16px;
    }

    .whatsapp-MPI_title {
        font-size: 16px;
    }

    .whatsapp-MPI_body {
        padding: 24px 16px;
    }

    .whatsapp-MPI_floating-button {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }

    .whatsapp-MPI_icon {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .whatsapp-MPI_popup {
        width: calc(100% - 32px);
        max-width: none;
        bottom: 90px;
        right: 16px;
        left: 16px;
        max-height: calc(100vh - 100px);
    }
}

/* Animações */
@keyframes whatsapp-MPI_fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes whatsapp-MPI_scaleIn {
    from {
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {
    .whatsapp-MPI_popup,
    .whatsapp-MPI_overlay,
    .whatsapp-MPI_floating-button,
    .whatsapp-MPI_button {
        transition: none;
    }
}
