/* chat-widget.css - Tato Seguros V2 (Alto Contraste) */

/* Colores de referencia */
:root {
  --primary-color: #0A2A66; /* Azul Oscuro (Tato) */
  --secondary-color: #FF6600; /* Naranja (Contraste) */
  --accent-color: #0077cc; /* Azul Intermedio */
  --bg-bot: #F1F1F1; /* Fondo Bot Claro */
  --bg-user: #D6E8FF; /* Fondo Usuario Azul Claro (Alto contraste) */
}

/* CONTENEDOR PRINCIPAL */
#tato-chat-root {
  position: fixed;
  bottom: 25px;
  right: 100px; /* separado del WA (ajustar si hace falta) */
  z-index: 99999;
  font-family: "Montserrat", sans-serif;
}

/* BOTÓN (AVATAR) */
.tato-avatar-btn {
  width: 95px;
  height: 95px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0,0,0,0.45);
  border: 4px solid var(--secondary-color); /* Borde de contraste */
  transition: transform .18s ease, box-shadow .18s ease;
}

/* HOVER */
.tato-avatar-btn:hover { transform: scale(1.05); }
.tato-avatar-btn.is-open { border-color: var(--primary-color); } /* Borde al abrir */

/* ANIMACIÓN "HABLANDO" */
.avatar-speaking { animation: speakAnimation 0.7s infinite ease-in-out; }
@keyframes speakAnimation { 0% { transform: scale(1);} 50% { transform: scale(1.04);} 100% { transform: scale(1);} }

/* VENTANA DEL CHAT */
.tato-chat-window {
  width: 340px;
  max-width: calc(100vw - 120px);
  height: 460px;
  position: absolute;
  bottom: 115px;
  right: 0;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* CABECERA */
.tato-chat-header {
  background: var(--primary-color); /* Azul Oscuro Alto Contraste */
  color: white;
  padding: 12px;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tato-chat-header img { 
    width:36px; height:36px; border-radius:50%; object-fit:cover; 
    border: 2px solid var(--secondary-color); /* Contraste en la imagen */
}

/* MENSAJES */
.tato-chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  font-size: 14px;
  color: #111;
  display:flex;
  flex-direction:column;
  gap:8px;
  background: #fff; /* Fondo claro y limpio */
}

/* Burbuja bot / usuario */
.msg-bot {
  background: var(--bg-bot);
  padding: 10px 12px;
  border-radius: 12px;
  margin: 0;
  align-self: flex-start;
  max-width: 86%;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.msg-user {
  background: var(--bg-user); /* Alto Contraste */
  padding: 10px 12px;
  border-radius: 12px;
  margin: 0;
  align-self: flex-end;
  max-width: 86%;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.msg-bot b { color: var(--accent-color); }

/* Contenedor para quick-replies (botones) */
.tato-quick {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:6px;
}
.tato-quick button {
  background: var(--secondary-color); /* Naranja Principal */
  color:white;
  border:none;
  padding:8px 12px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
  font-size:13px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: background .15s ease;
}
.tato-quick button:hover {
    background: #e65c00;
}
.tato-quick button.secondary {
  background: var(--bg-bot); /* Fondo claro para Volver */
  color: var(--primary-color);
  border: 1px solid #ccc;
  font-weight:600;
}
.tato-quick button.secondary:hover {
    background: #e6e6e6;
}

/* INPUT */
.tato-chat-input {
  border-top: 1px solid #ddd;
  display: flex;
  gap:6px;
  padding:8px;
  align-items:center;
  background:#fff;
}
.tato-chat-input input {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border:2px solid #ccc; /* Borde más visible */
  outline: none;
  font-size: 14px;
  transition: border-color .15s ease;
}
.tato-chat-input input:focus {
    border-color: var(--accent-color);
}
.tato-chat-input button {
  padding: 10px 12px;
  background: var(--accent-color);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 700;
  border-radius: 10px;
  transition: background .15s ease;
}
.tato-chat-input button:hover {
    background: #005699;
}
/* --- AÑADIR ESTE BLOQUE AL CSS EXISTENTE --- */

/* Botón de Cierre (Cruz) */
.tato-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 26px; /* Tamaño visible */
    font-weight: 300; /* Peso ligero para que parezca una "X" moderna */
    line-height: 1;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity .15s ease;
}

.tato-close-btn:hover {
    opacity: 1;
}

/* Ajuste del header para asegurar espacio */
.tato-chat-header {
    /* ... otros estilos ... */
    position: relative; /* Necesario para que la posición absolute del cierre funcione */
}
/* Responsive */
@media (max-width:480px) {
  #tato-chat-root { right: 16px; bottom: 16px; }
  .tato-avatar-btn { width:72px; height:72px; border-width: 3px; }
  .tato-chat-window { width: calc(100vw - 32px); right: 0; bottom: 92px; height: 64vh; }
}