body {
  font-family: Arial, sans-serif;
  margin: 20px;
}

button {
  cursor: pointer;
}

.hidden {
  display: none;
}

.chat-window {
  position: fixed;
  bottom: 20px;
  right: 20px;

  width: 420px;    
  height: 520px; 

  min-width: 320px;
  min-height: 400px;

  background-color: #fff;

  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);

  display: flex;          
  flex-direction: column; 

  overflow: hidden; 
  resize: both;
  z-index: 1000;
}

.chat-header {
  flex-shrink: 0;
  background-color: #007bff;
  color: white;
  padding: 10px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header button {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
}

.chat-body {
  flex: 1;
  overflow-y: auto; 
  padding: 10px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-content {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Mensajes */
.user-message {
  align-self: flex-end;
  background-color: #007bff;
  color: white;
  padding: 8px 10px;
  border-radius: 10px 10px 0 10px;
  max-width: 80%;
  word-wrap: break-word;
}

.bot-message {
  align-self: flex-start;
  background-color: #e5e5ea;
  color: black;
  padding: 8px 10px;
  border-radius: 10px 10px 10px 0;
  max-width: 80%;
  word-wrap: break-word;
  /*margin: 6px 0;*/
  margin: 0.4em 0;
  white-space: pre-line;
}

.bot-message ul,
.bot-message ol {
  margin: 0.4em 0;
  padding-left: 1.2em; /* reduce sangría */
}

.bot-message li {
  margin: 0.25em 0;
}

.chat-body textarea {
  width: 90%;
  height: 60px;
  resize: none;
  border-radius: 5px;
  padding: 5px;
  border: 1px solid #ccc;
  display: inline;
}

.chat-actions {
  text-align: right;
  margin-top: 5px;
}

.chat-actions button {
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid #ccc;
  background-color: #f0f0f0;
}

.chat-actions button:hover {
  background-color: #ddd;
}

/* Botón para asistente de voz */
.mic-toggle {
  position: relative;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background-color: rgb(11, 3, 116);
  margin-bottom:0;
  flex-shrink: 0;
}

.mic-toggle:after,
.mic-toggle:before {
  --pad: 0rem;
  content: '';
  display: block;
  position: absolute;
  z-index: 0;
  background-color: rgba(39, 194, 255, 0.2);
  top: var(--pad);
  left: var(--pad);
  right: var(--pad);
  bottom: var(--pad);
  border-radius: 50%;
}

.mic-toggle:after {
  transition: 0.4s;
}

.mic-toggle:before {
  transition: 0.2s;
}

.mic-toggle:hover:before {
  --pad: -1rem;
}

.mic-toggle:hover:after {
  --pad: -2rem;
}

.mic-toggle span {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 2rem;
}

.mic-toggle.is-recording:after {
  animation: smoothPadAfter 0.6s ease-in alternate-reverse forwards infinite;
}

.mic-toggle.is-recording:before {
  animation: smoothPadBefore 0.6s ease-in alternate-reverse forwards infinite;
}

@keyframes smoothPadAfter {
  0% {
    top: -2rem;
    left: -2rem;
    right: -2rem;
    bottom: -2rem;
  }

  100% {
    top: -1rem;
    left: -1rem;
    right: -1rem;
    bottom: -1rem;
  }
}

@keyframes smoothPadBefore {
  0% {
    top: -1rem;
    left: -1rem;
    right: -1rem;
    bottom: -1rem;
  }

  100% {
    top: -0.5rem;
    left: -0.5rem;
    right: -0.5rem;
    bottom: -0.5rem;
  }
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 10px;
  border-top: 1px solid #ddd;
  background: #fff;
}

.input-row textarea {
  flex: 1;      
  height: 60px;
  width: 100%;
  resize: none;
}

.send-inline {
  padding: 10px 15px;
  height: 45px;
}

.voice-bar {
  width: 100%;
  height: 20px;
  background: linear-gradient(to right, #0d6efd, #4dd0e1);
  border-radius: 10px;
  transition: height 0.1s ease;
}

.hidden {
  display: none !important;
}

.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 22px;
  padding: 8px 12px;
  opacity: 0.7;
}

.typing .dot {
  width: 7px;
  height: 7px;
  background-color: #555;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.typing .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0% { opacity: .2; }
  20% { opacity: 1; }
  100% { opacity: .2; }
}

.password-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-modal.hidden {
  display: none;
}

.password-box {
  background: #fff;
  width: 260px;
  padding: 16px;
  border-radius: 6px;
}
