/*
//
// Tencent is pleased to support the open source community by making trpc-agent-go available.
//
// Copyright (C) 2025 Tencent.  All rights reserved.
//
// trpc-agent-go is licensed under the Apache License Version 2.0.
//
*/

:root {
  color-scheme: dark;
  --copilot-kit-background-color: #141414;
  --copilot-kit-primary-color: #024a76;
  --copilot-kit-contrast-color: #ffffff;
  --copilot-kit-secondary-contrast-color: #ffffff;
  --copilot-kit-separator-color: rgba(255, 255, 255, 0.12);
  /* Custom event color palette. */
  --agui-custom-event-bg: #3a250f; /* dark amber background. */
  --agui-custom-event-border: #f59e0b; /* amber 500 border. */
  --agui-custom-event-label: #fbbf24; /* amber 400 label. */
  --agui-custom-event-body: #fde68a; /* amber 200 body text. */
  /* Tool call color palette. */
  --agui-tool-call-bg: #0f1f2a; /* dark cyan slate. */
  --agui-tool-call-border: #38bdf8; /* sky 400. */
  --agui-tool-call-label: #7dd3fc; /* sky 300. */
  --agui-tool-call-body: #bae6fd; /* sky 200. */
  /* Tool result color palette. */
  --agui-tool-result-bg: #0f251a; /* dark emerald. */
  --agui-tool-result-border: #34d399; /* emerald 400. */
  --agui-tool-result-label: #86efac; /* emerald 300. */
  --agui-tool-result-body: #bbf7d0; /* emerald 200. */
}

html,
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #141414;
  color: #ffffff;
  min-height: 100vh;
  height: 100%;
  overflow: hidden;
}

main.agui-chat {
  height: 100vh;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.agui-chat__panel {
  flex: 1;
  margin: 0;
  background: #141414;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.copilotKitChat,
.copilotKitMessages,
.copilotKitMessagesContainer,
.copilotKitMessagesFooter {
  background: #141414 !important;
}

.copilotKitChat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.copilotKitChat .copilotKitMessages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.copilotKitChat .copilotKitMessagesContainer {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.copilotKitChat .copilotKitMessagesFooter {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  background: #141414;
  z-index: 5;
}

.tool-message {
  margin: 0.75rem 0 0.75rem 1.5rem;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  background: #303030;
  border-left: 3px solid #4c6f8e;
  color: #ffffff;
  font-size: 0.95rem;
  display: inline-block;
  max-width: min(680px, 80%);
  width: fit-content;
}

.tool-message__label {
  display: block;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: inherit;
  margin-bottom: 0.5rem;
}

.tool-message__body {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: inherit;
  background: transparent;
}

@media (max-width: 768px) {
  .agui-chat__panel {
    border-radius: 0;
    border-width: 0;
  }

  .tool-message {
    margin: 0.75rem 0;
    max-width: 100%;
  }
}


.copilotKitMessage {
  color: #ffffff;
  padding: 0.9rem 1.1rem;
  border-radius: 18px;
  max-width: min(720px, 85%);
  line-height: 1.6;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.agui-chat .copilotKitMessage.copilotKitUserMessage {
  background: #024a76;
  margin-left: auto;
  margin-right: 1.5rem;
  color: #ffffff;
}

.agui-chat .copilotKitMessage.copilotKitAssistantMessage {
  background: #303030;
  margin-right: auto;
  margin-left: 1.5rem;
  padding: 1rem 1.2rem;
  max-width: min(760px, 90%);
  color: #ffffff;
}

.agui-chat .copilotKitMessage.copilotKitAssistantMessage * {
  color: inherit;
}

.agui-chat .copilotKitMessage code {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.agui-chat .copilotKitMessage pre {
  background: #1b1b1b;
  padding: 1rem;
  border-radius: 12px;
  overflow-x: auto;
}

.agui-chat .copilotKitMessage pre code {
  background: transparent;
  padding: 0;
}

.agui-chat .copilotKitMessageControls {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.35rem;
}

.agui-chat .copilotKitMessageControlButton {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 999px;
  color: #ffffff;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agui-chat .copilotKitMessageControlButton:hover {
  background: rgba(255, 255, 255, 0.22);
}

.copilotKitInputContainer {
  background: #141414;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: center;
}

.copilotKitInput {
  background: #1d1d1d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  width: min(720px, 95%);
  box-sizing: border-box;
}

.copilotKitInput textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.6;
  font-family: inherit;
  padding: 0.35rem 0.1rem;
  align-self: stretch;
  min-height: 1.8rem;
}

.copilotKitInput textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* Remove generic overrides to allow per-kind colors to show. */

/* Custom event specific styling. */
.tool-message--custom,
.tool-message[data-message-kind="custom"] {
  background: #303030 !important;
  box-shadow: none !important;
  border-left-color: var(--agui-custom-event-border) !important;
  border-left-width: 3px !important;
  border-left-style: solid !important;
}

.tool-message--custom .tool-message__label,
.tool-message[data-message-kind="custom"] .tool-message__label {
  color: inherit !important;
  position: static;
}

.tool-message--custom .tool-message__body,
.tool-message[data-message-kind="custom"] .tool-message__body {
  color: inherit !important;
}

.tool-message--custom .tool-message__label::before {
  content: "";
}

/* Tool call/result unified styling. */
.tool-message--tool-call,
.tool-message--tool-result,
.tool-message[data-message-kind="tool-call"],
.tool-message[data-message-kind="tool-result"] {
  background: #303030 !important;
  box-shadow: none !important;
  border-left-color: var(--agui-tool-call-border) !important;
  border-left-width: 3px !important;
  border-left-style: solid !important;
}

.tool-message--tool-call .tool-message__label,
.tool-message--tool-result .tool-message__label,
.tool-message[data-message-kind="tool-call"] .tool-message__label,
.tool-message[data-message-kind="tool-result"] .tool-message__label {
  color: inherit !important;
}

.tool-message--tool-call .tool-message__body,
.tool-message--tool-result .tool-message__body,
.tool-message[data-message-kind="tool-call"] .tool-message__body,
.tool-message[data-message-kind="tool-result"] .tool-message__body {
  color: inherit !important;
}

.report-document {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem;
  background: rgba(2, 74, 118, 0.1);
  backdrop-filter: blur(6px);
}

.report-document__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.report-document__label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  opacity: 0.7;
}

.report-document__title {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
}

.report-document__status {
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(52, 211, 153, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.45);
}

.report-document__status[data-open="false"] {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(147, 197, 253, 0.5);
}

.report-document__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 0.85rem;
}

.report-document__content {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.95rem;
}

.report-document--closed {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.report-document__close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  cursor: pointer;
  margin-left: auto;
}

.report-document-attachment {
  margin: 0.5rem 0 0.75rem 1.5rem;
  display: flex;
  justify-content: flex-start;
}

.report-document-attachment__button {
  width: auto;
  max-width: min(520px, 90%);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  color: inherit;
}

.report-document-attachment__icon {
  font-size: 1.6rem;
}

.report-document-attachment__details {
  flex: 1;
  text-align: left;
}

.report-document-attachment__label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  opacity: 0.7;
}

.report-document-attachment__title {
  margin: 0.15rem 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.report-document-attachment__meta {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  opacity: 0.7;
}

.report-document-attachment__state {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #9ca3af;
}

.report-document-attachment__state::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9ca3af;
}

.report-document-attachment__state--pending::before {
  background: #facc15;
  animation: attachmentPulse 1.2s ease-in-out infinite;
}

.report-document-attachment__state--ready::before {
  background: #34d399;
}

.report-document-attachment__action {
  font-size: 0.85rem;
  font-weight: 600;
  color: #7dd3fc;
}

.agui-chat-layout {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 1.5rem;
  align-items: stretch;
  overflow: hidden;
}

.agui-chat-layout__messages {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  overflow: hidden;
}

.agui-chat-layout__messages .copilotKitMessages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.agui-chat-layout__messages .copilotKitMessagesContainer {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1.2rem;
}

.agui-chat-layout__messages .copilotKitMessagesFooter {
  flex: 0 0 auto;
  background: #141414;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.document-side-panel {
  flex: 0 0 0;
  max-width: 0;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition:
    flex-basis 0.3s ease,
    max-width 0.3s ease,
    opacity 0.2s ease;
  overflow: hidden;
  padding: 0;
}

.document-side-panel--open {
  flex-basis: 40%;
  max-width: 40%;
  opacity: 1;
  pointer-events: auto;
  background: rgba(20, 20, 20, 0.95);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.35);
}

.document-side-panel__content {
  height: 100%;
  overflow-y: auto;
  padding: 1.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
