:root{
  --acs-chatlog-bg: #f4eded; /* valor por defecto */
  --acs-chatlog-ft: #333333; /* valor por defecto */
  --acs-chatlog-bga: #f1f0f0; /* valor por defecto */
  --acs-chatlog-fta: #333333; /* valor por defecto */
  --acs-chatlog-bgu: #544747; /* valor por defecto */
  --acs-chatlog-ftu: #ffffff; /* valor por defecto */
}
/* --- BOTÓN FLOTANTE --- */
#chatbot-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 60px;
    z-index: 99998;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 15px 0 rgba(70,97,230,0.17);
    cursor: pointer;
    transition: box-shadow .19s;
}

/* --- VENTANA CHAT PRINCIPAL --- */
#chatbot-widget {
    position: fixed;
    bottom: 100px;
    right: 35px;
    z-index: 99999;
    max-width: 420px;
    width: 96vw;
    display: none;
    background: #fff;
    border: 1.2px solid #bbb;
    box-shadow: 0 5px 24px 0 rgba(70,97,230,0.13);
    border-radius: 20px;
    overflow: hidden;
    animation: chatbotFadeIn .41s;
    min-height: 430px;
    max-height: 85vh;
    flex-direction: column;
    height: 90%;
}

/* --- CABECERA DEL CHAT --- */
#chatbot-widget .chatbot-header {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 16px 8px 16px;
    border-bottom: 1px solid #f2f2f2;
    position: relative;
    background: #fff;
}

#chatbot-close-btn {
    position: absolute;
    right: 23px;
    top: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f3f3f6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #888;
}

#chatbot-widget .chatbot-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
    display: block;
}

#chatbot-widget .chatbot-header-title {
    font-weight: 700;
    font-size: 1.22rem;
    color: var(--acs-chatlog-bgu, #544747);
    display: block;
    line-height: 1;
}

/* --- LOG DEL CHAT --- */
#chatlog {
    height: 79%;
    overflow: auto;
    margin: 0;
    font-size: 13.5px;
    background: var(--acs-chatlog-bg, #f4eded);
    padding: 13px 12px 11px 12px;
}

/* --- MENSAJES --- */
#chatlog .agent-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 11px;
    position: relative;
}
#chatlog .agent-message-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 7px;
    min-width: 35px;
}
#chatlog .agent-message-bubble {
    background:  var(--acs-chatlog-bga, #f1f0f0);
    color:  var(--acs-chatlog-fta, #333333);
    padding: 7px 13px;
    border-radius: 12px 16px 16px 4px;
    max-width: 74vw;
    min-width: 60px;
    display: inline-block;
    text-align: left;
    box-shadow: 0 1px 4px #e8eefd;
}
#chatlog .agent-message-bubble a {
    text-decoration: underline !important;
}
#chatlog .agent-message-bubble p {
    margin-bottom: 10px;
}
#chatlog .user-message {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    margin-bottom: 9px;
}
#chatlog .user-message-bubble {
    background: var(--acs-chatlog-bgu, #544747);
    color: var(--acs-chatlog-ftu, #ffffff);
    padding: 7px 13px;
    border-radius: 16px 12px 4px 16px;
    max-width: 74vw;
    min-width: 60px;
    display: inline-block;
    text-align: right;
    box-shadow: 0 1px 5px #e6eefd;
}
#copychat {
    text-align: center;
    background: var(--acs-chatlog-bg, #f4eded);
}

#copychat p {
    font-family: 'Montserrat', sans-serif;
    color: var(--acs-chatlog-ft, #333333);
    display: inline-flex;
    align-items: center;
    gap: 5px; /* Espacio entre imagen y texto */
    margin-bottom: 0px;
    font-size: 11px;
}
#copychat p a{
    color: var(--acs-chatlog-ft, #333333);
}
#copychat img {
    vertical-align: middle;
}

/* 2. Contenedor de iconos oculto por defecto */
.agent-message .review-icons {
  display: none;
  position: absolute;
  bottom: -18px;
  left: 50px;
  gap: 6px;
  align-items: center;
  background-color: #ededed;
  border-radius: 5px;
}

/* 3. Al hacer hover, se muestran */
.agent-message:hover .review-icons {
  display: flex;
}

/* 4. Botones sin estilo extra */
.review-icons button {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  display: flex;
  color: #544747;
  align-items: center;
}
.review-icons button:hover {
  color: #2e2424;
}
.review-icons svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Estilo del aviso */
.review-feedback {
  position: absolute;
  bottom: -24px;
  right: 0;
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}

/* --- ENTRADA Y BOTÓN --- */
#chatbot-widget .chatbot-input-area {
    padding: 0 16px 14px 16px;
}
#chatinput {
    width: 100%;
    border-radius: 7px;
    border: 1.2px solid #ccc;
    padding: 8px 10px;
}
#send-chatbot {
    float: right;
    padding: 7px 7px;
    border-radius: 8px;
    color: #fff;
    border: none;
}
#send-chatbot:hover {
    color: #3451c2;
}
.clearfix { clear: both; }

/* --- ANIMACIONES --- */
@keyframes chatbotFadeIn {
    from {opacity:0; transform:translateY(35px);}
    to {opacity:1; transform:translateY(0);}
}
@keyframes chatbotFadeOut {
    from {opacity:1; transform:translateY(0);}
    to {opacity:0; transform:translateY(35px);}
}

/* --- MÓVIL Y TABLET: pantalla completa --- */
@media (max-width: 900px) {
    #chatbot-widget {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        min-height: 100vh !important;
        border-radius: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        margin: 0 !important;
    }
    #chatlog {
        height: 80%;
    }
}
.agent-message-avatar img,
.chatbot-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
    display: block;
}

/* El avatar pequeño dentro del chatlog */
.agent-message-avatar .avatar-small {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #e5e7ea;
    display: block;
}
#chatbot-toggle-btn .avatar-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    background: #eee;
    display: block;
}

#chatbot-toggle-btn .icon-btn {
    display: block;
    margin: auto;
}
.agent-message-avatar .avatar-small {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #e5e7ea;
    display: block;
}

.agent-message-avatar .agent-name {
    font-size: 10.8px;
    color: var(--acs-chatlog-ft, #333333);
    margin-top: 2px;
    text-align: center;
    width: 100%;
}
.chatbot-input-box {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 30px;
    border: 1.5px solid #eee;
    padding: 0 10px;
    margin: 2px 0 5px 0;
    box-shadow:0px 4px 16px 0px rgba(0, 0, 0, 0.1), 0px 2px 2px 0px rgba(0, 0, 0, 0.1);   
}

#chatinput {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 8px 6px;
    outline: none;
    margin-right: 2px;
    min-width: 0;
}

.icon-btn {
    background: none;
    border: none;
    outline: none;
    margin: 0 2px;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 1.3rem;
    color: #4661e6;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-chatbot svg {
    display: block;
}
.icon-btn {
    background: none;
    border: none;
    outline: none;
    margin: 0 2px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}

.icon-btn:hover {
    background: #f5f5f5;
}

.emoji-svg, .send-icon {
    width: 22px;
    height: 22px;
    color: #828282;
    display: block;
}

.chatbot-menu-wrapper {
    position: relative;
    display: inline-block;
    margin-left: auto;
    vertical-align: middle;
}
.chatbot-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    margin-left: 8px;
}
.chatbot-menu-dropdown {
    position: absolute;
    right: 0;
    top: 32px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    min-width: 190px;
    z-index: 999;
    font-size: 15px;
    padding: 6px 0;
    transition: 0.12s;
}
.chatbot-menu-item {
    padding: 9px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--acs-chatlog-bgu, #544747);
    border: none;
    background: none;
    font-family: inherit;
    font-size: 15px;
}
.chatbot-menu-item:hover {
    background: #f6f8ff;
}

@media (max-width: 640px) {
    #chatbot-widget {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        min-height: 100vh !important;
        border-radius: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        margin: 0 !important;
    }
    .chatbot-input-box {
        padding-left: 10px;
        padding-right: 4px;
    }
    #chatinput {
        font-size: 1rem;
        padding: 8px 2px;
    }
}
.chatbot-history-modal {
    position: fixed;
    top: 40px;
    right: 40px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,.19);
    width: 320px;
    z-index: 99999;
    animation: chatbotFadeIn .25s;
    border: 1px solid #eee;
}
.chatbot-history-header {
    padding: 15px 18px 8px 18px;
    font-weight: bold;
    font-size: 18px;
    border-bottom: 1px solid #f1f1f1;
}
/* ===== Globo inicial de aviso ===== */

/* Floating chat hint bubble */
#chatbot-float-tip {
  position: fixed;
  max-width: min(92vw, 420px);
  min-width: 260px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.45;
  z-index: 2147483647;
  margin-right: 10px;
}
#chatbot-float-tip .tip-content {
  padding-right: 22px;
}
#chatbot-float-tip .tip-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transition: opacity .2s ease;
}
#chatbot-float-tip:hover .tip-close {
  opacity: 1;
}
#chatbot-float-tip .tip-arrow{
  position: absolute;
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #fff; /* flecha abajo */
  bottom: -10px;
  left: 30%;                 /* valor base; el JS ya recalcula */
  transform: translateX(-50%);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.12));
}

#chatbot-float-tip { cursor: pointer; }
#chatbot-float-tip .tip-close { cursor: pointer; }



/* ===== Indicador de tecleo ===== */
.typing-indicator {
  display: flex;              /* Organiza avatar + burbuja en línea */
  align-items: center;        /* Centra verticalmente */
  margin: 8px 0;              /* Separación arriba/abajo */
}

.typing-avatar {
  width: 32px;                /* Ancho del avatar */
  height: 32px;               /* Alto del avatar */
  border-radius: 50%;         /* Lo hace redondo */
  margin-right: 8px;          /* Espacio a la derecha */
  background-size: cover;     /* Ajusta la imagen al contenedor */
  background-position: center;/* Centra la imagen */
}

.typing-bubble {
  background: #f1f0f0;        /* Color del globo */
  border-radius: 16px;        /* Bordes redondos */
  padding: 6px 12px;          /* Espacio dentro del globo */
  display: inline-flex;       /* Para alinear los puntitos */
  align-items: flex-end;      /* Puntitos abajo del todo */
}

.typing-dot {
  width: 6px;                 /* Tamaño de cada puntito */
  height: 6px;
  margin: 0 2px;              /* Separación entre puntitos */
  border-radius: 50%;         /* Redondos */
  background: #888;           /* Color gris */
  animation: bounce 1s infinite ease-in-out both;
                              /* Aplica la animación */
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
/* Hacemos que cada puntito empiece un poco después que el anterior */

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}


