/* EL ÍCONO FLOTANTE */
/* --- Placa metálica flotante --- */
#iconoChat {
  position: fixed;
  bottom: 0px;
  right: 0px;
  z-index: 100;

  /* Layout */
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 14px 0px 0px 0px;
  cursor: pointer;
  user-select: none;
  text-decoration: none;

  /* Tipografía/ícono */
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: rgba(0, 0, 0, 0.99);
  transition: color 0.25s ease;
}

/* Metal: base + vetas cepilladas + brillo/sombreado */
#iconoChat {
  background:
    /* brillo superior y leve sombreado inferior */
    linear-gradient(to bottom,
      rgba(255,255,255,.65) 0%,
      rgba(255,255,255,.15) 36%,
      rgba(0,0,0,0) 60%,
      rgba(0,0,0,.12) 100%
    ),
    /* vetas del cepillado */
    repeating-linear-gradient(-60deg,
      rgba(255,255,255,.06) 0 2px,
      rgba(0,0,0,.06) 2px 4px
    ),
    /* gradiente metálico base */
    linear-gradient(135deg, #eeeeee 0%, #d7d7d7 45%, #c9c9c9 55%, #e6e6e6 100%);
  border: 1px solid #bdbdbd;
  box-shadow:
    0 10px 18px rgba(0,0,0,.22),      /* sombra exterior */
    inset 0 1px 0 rgba(255,255,255,.55); /* bisel interior alto */
}

/* Icono */
#iconoChat i {
  font-size: 18px;
  opacity: .9;
}

/* Efecto “placa” al pasar el mouse */
#iconoChat:hover {
  color: rgba(0, 0, 0, 0.85);
  box-shadow:
    0 10px 18px rgba(0,0,0,0.28),      /* sombra exterior */
    inset 0 1px 0 rgba(255,255,255,0.55); /* bisel interior alto */
}

/* Click */
#iconoChat:active {
  transform: translateY(0);
  box-shadow:
    0 6px 12px rgba(0,0,0,.22),
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 -1px 0 rgba(0,0,0,.22);
}

/* “Tornillos” decorativos sutiles (opcional y elegante) */
#iconoChat::before,
#iconoChat::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin: 0 2px;
  background: radial-gradient(circle at 30% 30%, #ffffff 0 25%, #9f9f9f 26% 60%, #6f6f6f 61% 100%);
  box-shadow: inset 0 0 1px rgba(0,0,0,.35);
}
#iconoChat::before { order: -1; }  /* a la izquierda */
#iconoChat::after  { order:  2; }  /* a la derecha */

/* Texto */
#iconoChat .texto {
  white-space: nowrap;
  letter-spacing: .2px;
}

/* Accesibilidad: foco visible al navegar con teclado */
#iconoChat:focus-visible {
  outline: 3px solid rgba(0,123,255,.5);
  outline-offset: 3px;
}

/* Animación sutil (respiración muy leve) */
@keyframes pulsoPlaca {
  0%   { transform: translateY(0) scale(1); }
  50%  { transform: translateY(0) scale(1); }
  100% { transform: translateY(0) scale(1); }
}
#iconoChat {
  animation: pulsoPlaca 3.2s ease-in-out infinite;
}

/* Respeto preferencias de usuario: reducir movimiento */
@media (prefers-reduced-motion: reduce) {
  #iconoChat { animation: none; transition: none; }
}

/* Responsivo: compactar en móviles estrechos */
@media (max-width: 420px) {
  #iconoChat {
    padding: 9px 12px;
    gap: 8px;
  }
  #iconoChat .texto {
    font-size: 14px;
  }
}

/* EL CONTENEDOR */
#contenedorChat {
    width: 380px;
    height: 420px;
    background: rgba(255, 255, 255, 1);
    border-radius: 5px 5px 1px 1px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    position: fixed;
    bottom: 0px;
    right: 10px;
    overflow: hidden;
    z-index: 1000;
    transform: scale(0) translateX(-400px) translateY(-400px);
    transform-origin: bottom right;
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

#contenedorChat:not(.hidden) {
    transform: scale(1) translateX(0px) translateY(0px);
    opacity: 1;
}

#contenedorChat .hidden {
    display: none; /* Oculto por defecto */
}

@media (max-width: 650px) {
    #contenedorChat {
        width: 85vw; /* % del ancho visible */    
        height: 400px;
    }
} 

/* ENCABEZADO DEL CONTENEDOR */
#chat-header {
  background: rgba(20, 91, 93, 1);
  color: white;
  font-weight: bold;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#chat-header:hover {
    box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

#chat-header button {
  background: none;
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  width: 33px;
  height: 33px;
}

#chat-header button:hover {
  background-color: rgba(255, 255, 255, 0.05);
}


/* EL CHAT EN EL CONTENEDOR */
#chatbox {
    font-size: 14px;
    line-height: 18px;
    letter-spacing: 0.8px;
    font-family: "Open Sans", Helvetica, sans-serif;
    box-shadow: inset 0px 0px 10px 0.6px rgba(0,0,0,0.08); /* offset-x | offset-y | blur-radius | spread-radius | color */
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.msg {
    margin: 5px 0;
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 75%;
    }

.user {
    background: rgba(20, 91, 93, 0.8);
    color: rgba(255, 255, 255, 1);
    align-self: flex-end;
    }

.user:hover {
    box-shadow: 0px 0px 10px 0.25px rgba(0,0,0,0.2); /* offset-x | offset-y | blur-radius | spread-radius | color */
    }

.bot {
    background: rgba(229, 229, 234, 1);;
    color: rgba(0, 0, 0, 1);
    align-self: flex-start;
}

.bot:hover {
    box-shadow: 0px 0px 10px 0.25px rgba(0,0,0,0.1); /* offset-x | offset-y | blur-radius | spread-radius | color */
    }

/* LA ZONA PARA ESCRIBIR MENSAJES EN EL CONTENEDOR */
#input-area {
    display: flex;
    border-top: 1.5px solid rgba(221, 221, 221, 1);
    height: 50px;
    align-items: stretch; /* hace que los hijos llenen el alto total */
}

#userInput {
    flex: 1;
    border: none;
    border-radius: 0 0 0 1px;
    box-shadow: none;
    color: rgba(12, 12, 12, 1);
    font-size: 14px;
    height: 100%; /* ocupa toda la altura del contenedor */
    display: flex;
    align-items: center;
    padding: 0 10px;
}

#enviarMsg {
    padding: 10px;
    border: none;
    width: 55px;
    background: rgba(20 , 91, 93, 1);
    color: rgba(255, 255, 255, 1);
    border-radius: 0 0 1px 0;
    cursor: pointer;
    font-size: 20px;
}

#enviarMsg:hover {
    background: rgba(20, 91, 93, 0.9);
}