/* ==========================================================================
   1. ESTILOS ORIGINALES RESTAURADOS (MODAL CAPTURADOR AL CENTRO CON OVERLAY)
   ========================================================================== */

#waContactBtn {
    background-color: #25d366;
    color: #ffffff;
    padding: 0 25px;
    height: 45px;
    min-height: 45px;
    line-height: 45px;
    border-radius: 25px;
    display: inline-block;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

#waContactBtn:hover {
    background-color: #128c7e;
}

/* --- Modal central del formulario de captura --- */
.modal-whatsapp {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(77 92 116 / 95%); /* Overlay idéntico a tu captura */
    -webkit-animation-name: fadeIn;
    -webkit-animation-duration: 0.4s;
}

/* Contenedor exactamente centrado en pantalla */
.modal-whatsapp-content {
    position: fixed;
    background-color: #E5DDD5;
    width: 100%;
    height: 500px;
    max-width: 450px;
    max-height: 90vh; /* Evita desbordarse en pantallas muy pequeñas */
    border-radius: 10px;
    -webkit-box-shadow: 0 10px 20px rgb(0 0 0 / 20%);
    box-shadow: 0 10px 20px rgb(0 0 0 / 20%);
    overflow: hidden;
    padding: 0;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
    animation-name: slideIn;
    animation-duration: 0.4s;
}

.modal-whatsapp-content .modal-whatsapp-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Empuja el header arriba y el formulario abajo */
    position: relative;
}

/* El patrón vuelve a posicionarse de fondo de todo el contenedor intermedio */
.modal-whatsapp-content .modal-whatsapp-wrap::after {
    content: "";
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-image: url('img/ws-fondo.webp');
    background-size: 450px;
    background-color: #E5DDD5;
    z-index: 0;
    opacity: 0.12;
    pointer-events: none;
}

.modal-whatsapp-header {
    padding: 10px;
    background-color: #009688; /* Verde idéntico al de tu captura */
    display: flex;
    z-index: 2; /* Por encima del fondo */
    color: #fff;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.company-info {
    display: flex;
    align-items: center;
}

.company-info img {
    width: 45px;
    height: 45px;
    padding: 0px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.info-text strong {
    font-size: 16px;
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
    line-height: normal;
}

.info-text span {
    font-size: 14px;
    display: block;
}

.close-btn {
    cursor: pointer;
    font-size: 35px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
}

/* El body recupera su fondo gris opaco y sólido para ocultar el patrón detrás de los inputs */
.modal-whatsapp-body {
    background-color: #EFEFEF; 
    padding: 10px 5px 5px 5px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    z-index: 2; /* Por encima del fondo */
    position: relative;
}

#whatsappContactForm {
    display: flex;
    width: 100%;
    margin: 0;
    align-items: center;
}

.form-fields {
    flex: 1 1 85%;
}

.form-submit {
    flex: 1 1 15%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#whatsappContactForm input[type="text"],
#whatsappContactForm input[type="tel"],
#whatsappContactForm input[type="email"],
#whatsappContactForm textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 20px;
    background-color: #fff !important;
    border: 1px solid #f1f1f1;
    box-sizing: border-box;
    height: 40px;
    font-size: 14px;
    font-family: inherit;
    min-height: 40px;
    resize: none;
}

#whatsappContactForm textarea {
    resize: none;
    overflow-y: hidden;
    min-height: 40px;
}

#whatsappContactForm input:hover {
    box-shadow: none;
}

#submitBtn {
    background-color: transparent;
    border: none;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

#submitBtn img {
    width: 30px;
}

.form-row-one {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

.form-row-two {
    display: flex;
    column-gap: 10px;
}

.error {
    color: red;
    font-size: 12px;
    margin-top: -5px;
    margin-bottom: 10px;
    padding: 0 2px;
    display: none;
}

#errormessage {
    color: #fff;
    display: none;
    font-size: 12px;
    border: 1px solid #ffff99;
    margin-bottom: 20px;
    padding: 10px;
    text-align: center;
}


/* ==========================================================================
   2. ESTILOS DE LA NUEVA CAJA FLOTANTE MULTI-ASESOR (POPUP)
   ========================================================================== */

.wa-float-container {
    position: fixed;
    right: 20px;
    bottom: 5%;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.wa-float-container .floating-btn {
    cursor: pointer;
    background-color: #25d366;
    color: #ffffff;
    max-width: 80px;
    padding: 15px;
    text-align: center;
    border-radius: 99px;
    border: 0;
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    outline: none;
    animation: wa-pulse 2s infinite;
}

.wa-float-container .floating-btn:focus {
    outline: none;
}

.wa-float-container .floating-btn span {
    font-size: 10px;
    line-height: 20px;
    text-transform: uppercase;
    font-weight: bold;
}

.wa-float-container .floating-btn:hover {
    background-color: #128c7e;
    animation-play-state: paused;
}

.wa-agents-popup {
    display: none;
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 340px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.wa-popup-header {
    background-color: #009688; /* Unificado con el color de cabecera original */
    padding: 15px;
    display: flex;
    align-items: center;
    color: #fff;
    column-gap: 12px;
}

.wa-popup-header-text {
    font-size: initial;
}

.wa-popup-header-text strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
    line-height: normal;
}

.wa-popup-header-text span {
    font-size: 12px;
    opacity: 0.8;
}

.wa-popup-body {
    padding: 10px;
    background: #f4f7f6;
    max-height: 350px;
    overflow-y: auto;
}

.agent-item {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border: 1px solid #eef2f1;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.agent-item:hover {
    background: #eef9f7;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.agent-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #ccc;
}

.agent-details span {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.agent-details strong {
    display: block;
    font-size: 13px;
    color: #009688;    
}

.agent-wa-icon {
    display: flex;
    align-items: center;
}

.wa-loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #009688;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: wa-spin 1s linear infinite;
    margin: 10px auto;
}

/* --- Animaciones nativas --- */
@keyframes wa-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@keyframes wa-pulse {
    0% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* --- Ajustes Responsivos Móviles --- */
@media (max-width: 768px) {
    .modal-whatsapp-content { 
        width: 92%; 
        max-width: 400px;
    }
}

@media only screen and (max-width: 480px) { 
    .modal-whatsapp-body { padding: 15px; }
    #whatsappContactForm { flex-direction: column; align-items: stretch; gap: 0; }
    .form-fields { flex: 1 1 100%; width: 100%; }
    .form-row-two { flex-direction: column; column-gap: 0; }
    .error { margin-top: -4px; margin-bottom: 8px; }
    .form-submit { flex: 1 1 100%; width: 100%; padding-left: 0; margin-top: 5px; }
    #submitBtn { 
        width: 100%; 
        background-color: #009688; 
        padding: 10px; 
        border-radius: 20px; 
        display: flex;
        align-items: center;
        justify-content: center;
    }
    #submitBtn svg { fill: #ffffff !important; width: 25px; height: 25px; }
    #submitBtn img { filter: brightness(0) invert(1); }
}