/* ==========================================================================
   WIDGET DE CHAT (WHATSAPP MULTIAGENT) - ESTILO MODERNIZADO CON SVG
   ========================================================================== */

/* Contenedor Fijo Flotante */
div.chatallinonemod {
    position: fixed;
    bottom: 25px !important;
    right: 25px !important;
    z-index: 99999;
    width: auto !important;
}

/* Botón disparador principal */
div.chatallinonemod > button.chatallinonemodbuttonflat {
    height: 60px !important;
    width: 60px !important;
    padding: 0 !important;
    border-radius: 50%;
    border: none;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: #2a850f !important; /* Verde corporativo */
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(42, 133, 15, 0.3);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

div.chatallinonemod > button.chatallinonemodbuttonflat:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 12px 28px rgba(42, 133, 15, 0.5) !important;
}

/* Icono SVG dentro del botón principal */
.svg-main-chat {
    width: 28px;
    height: 28px;
    fill: #ffffff;
    display: block;
}

/* Contador de agentes online */
div.chatallinonemod > .online_agent_count {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #007ACC;
    position: absolute;
    right: -4px !important;
    top: -4px !important;
    font-size: 11px;
    font-weight: bold;
    margin: 0;
    padding: 0;
    color: #fff;
    border: 2px solid #0b0f19; /* Separador óptico del fondo */
}

/* ==========================================================================
   CAJA DESPLEGABLE DEL CHAT (Modo Oscuro Premium)
   ========================================================================== */
.chataio_agent {
    position: fixed;
    bottom: 95px !important;
    width: 350px;
    background: #1e293b !important; /* Fondo oscuro premium */
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    font-family: system-ui, -apple-system, sans-serif !important;
    border-radius: 16px;
    font-size: 14px;
    overflow: hidden;
    z-index: 9999999 !important;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.boxright { right: 30px !important; }
.boxleft  { left: 30px !important; }

/* Tipografías internas */
.chataio_agent h1, .chataio_agent h2,
.chataio_agent p, .chataio_agent span {
    font-family: inherit !important;
}

.chataio_agent h1, .chataio_agent h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px 0 !important;
}

.chataio_agent p, .chataio_agent span {
    font-size: 14px;
    line-height: 1.5;
}

/* Cabecera del chat */
.chataio_agent_header {
    background: #2a850f !important;
    padding: 24px;
    color: #ffffff;
    position: relative;
}

.chataio_agent_image {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 16px;
    display: inline-block;
    vertical-align: middle;
}

.chataio_agent_credentails {
    color: #fff !important;
    display: inline-block;
    vertical-align: middle;
}

span.agent_name {
    font-weight: 600;
    font-size: 16px;
    display: block;
}

/* Indicadores de Estado Integrados (Online / Offline) */
.chataio_agent_header::before {
    content: "";
    position: absolute;
    top: 62px;
    left: 64px;
    width: 12px;
    height: 12px;
    background-color: #22c55e; /* Verde activo */
    border-radius: 50%;
    border: 2px solid #2a850f;
    z-index: 2;
}

.chataio_header_offline::before {
    background-color: #ef4444 !important; /* Rojo inactivo */
}

/* Botón de cierre superior (Optimizado para SVG) */
.close_chat, .back_to_list {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px !important;
    height: 36px;
    position: absolute;
    top: 16px;
    right: 16px;
    cursor: pointer;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.15) !important;
    color: #ffffff;
    transition: background-color 0.2s, transform 0.2s;
}

.close_chat:hover, .back_to_list:hover {
    background-color: rgba(0, 0, 0, 0.3) !important;
}

.close_chat svg, .back_to_list svg {
    display: block;
}

/* Cuerpo del chat y burbujas de mensaje */
.greeting {
    padding: 20px;
}

.greeting p {
    color: #f8fafc !important; /* Texto claro */
}

.agents_message, .agents_offline_message {
    background: #334155; /* Contenedor de burbuja gris azulado */
    color: #f8fafc;
    padding: 12px 16px;
    border-radius: 0px 12px 12px 12px;
    margin-top: 10px;
    line-height: 1.5;
}

/* Contenedor de botones de canales */
.chat_buttons_cont {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    width: 100%;
}

.chatbutton {
    flex: 1;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s, transform 0.2s;
}

.chatbutton:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Identidad cromática de canales */
.chatbutton-messenger { background: #0084FF !important; }
.chatbutton-whatsapp  { background: #4FCE5D !important; }
.chatbutton-telegram  { background: #0088CC !important; }
.chatbutton-call      { background: #685AB0 !important; }

/* Configuración unificada para iconos SVG internos */
.svgicons {
    fill: #ffffff !important;
    width: 24px !important;
    height: 24px !important;
    display: block;
}

/* Formularios de contacto offline */
form.form_offline input,
form.form_offline textarea {
    width: 100%;
    background-color: #334155;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 12px;
    color: #ffffff;
    font-size: 13px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* Clases de Control de Estado (JS) */
.hide { display: none !important; }
.show { display: block !important; }

/* ==========================================================================
   INTERFACES MÓVILES (Responsividad Avanzada)
   ========================================================================== */
@media (max-width: 480px) {
    div.chatallinonemod {
        right: 10px !important;
        bottom: 10px !important;
    }
    .chataio_agent {
        width: calc(100vw - 20px) !important;
        right: 10px !important;
        left: 10px !important;
        bottom: 80px !important;
        border-radius: 12px;
    }
}
