:root {
  --chat-border: #d9e3ef;
  --chat-shadow: rgba(26, 41, 58, 0.08);
}

.chat-prompt {
  min-height: 120px;
  resize: vertical;
}

.chat-section + .chat-section {
  margin-top: 0.45rem;
}

.chat-response-card {
  border-color: var(--chat-border);
}

.ia-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: #4a5f76;
}

.ia-loading-hint {
  font-size: 0.8rem;
  color: #6c757d;
}

.ia-loading-hint.is-hidden {
  display: none;
}

.ia-loading.is-hidden {
  display: none;
}

.ia-textarea {
  min-height: 180px;
  resize: vertical;
  border-color: var(--chat-border);
  box-shadow: inset 0 0.08rem 0.25rem rgba(26, 41, 58, 0.05);
}

.chat-context-info {
  margin-top: 0.6rem;
  font-size: 0.92rem;
}

.chat-history-header .chat-context-info {
  margin-top: 0;
  white-space: nowrap;
}

.chat-history-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chat-history {
  min-height: 260px;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.chat-history-empty {
  color: #6c757d;
}

.chat-history-error {
  color: #842029;
  background-color: #f8d7da;
  border: 1px solid #f1aeb5;
  border-radius: 0.6rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.86rem;
  line-height: 1.3;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-history-info {
  color: #495057;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.6rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.3;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-history-error.is-fading-out {
  opacity: 0;
  transform: translateY(-4px);
}

.chat-history-message {
  max-width: 86%;
  border: 1px solid var(--chat-border);
  border-radius: 0.75rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-history-user {
  align-self: flex-start;
  background-color: #f8fafc;
}

.chat-history-assistant {
  align-self: flex-end;
  background-color: #eef5ff;
  border-color: #cfe0ff;
}

.chat-history-role {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: #4f5e70;
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.chat-history-note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: #6c757d;
  line-height: 1.3;
}

.chat-history-note-trimmed {
  color: #b02a37;
}

.chat-history-overflow {
  color: #b02a37;
}

.chat-context-info {
  color: #b02a37;
}

.chat-history-turn-separator {
  align-self: center;
  width: 100%;
  text-align: center;
  font-size: 0.72rem;
  color: #7a8694;
  letter-spacing: 0.02em;
  margin: 0.1rem 0;
  position: relative;
}

.chat-history-turn-separator::before,
.chat-history-turn-separator::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 36%;
  border-top: 1px solid #e4ebf3;
}

.chat-history-turn-separator::before {
  left: 0;
}

.chat-history-turn-separator::after {
  right: 0;
}

@media (max-width: 767px) {
  .chat-section + .chat-section {
    margin-top: 0.38rem;
  }

  .ia-textarea {
    min-height: 160px;
  }

  .chat-history {
    max-height: 320px;
  }

  .chat-history-header .chat-context-info {
    white-space: normal;
  }

  .chat-history-tools {
    justify-content: flex-start;
  }
}

.btn-cerrar {
  color: #fff;
  background-color: #0b5ed7;
  border-color: #0a58ca;
}

.btn-cerrar:hover,
.btn-cerrar:focus-visible {
  color: #fff;
  background-color: #094eb3;
  border-color: #084aa8;
}

.btn-cerrar:focus-visible {
  box-shadow: 0 0 0 0.25rem rgba(49, 132, 253, 0.5);
}

.btn-reiniciar {
  color: #b02a37;
  border-color: #d97a83;
}

.btn-reiniciar:hover,
.btn-reiniciar:focus-visible {
  color: #fff;
  background-color: #bb2d3b;
  border-color: #b02a37;
}

.btn-reiniciar:focus-visible {
  box-shadow: 0 0 0 0.25rem rgba(176, 42, 55, 0.35);
}

.chat-cooldown-note {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
  color: #b02a37;
  font-weight: 500;
}

.chat-cooldown-note.is-hidden {
  display: none;
}
