@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap");

:root {
  --primaryColor: #ba6d55; /* Default color */
  --messageTitleColor: #ba6d55; /* Default message title color */
  --botName: "Expert"; /* Default bot name */
}

html,
body {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
  padding: 0;
}

#agent700-chat-aside {
  width: 100%;
  height: 100%;
  background-color: white;
  display: flex;
  flex-direction: column;
}

/* --- Start Chat Header --- */
#agent-header {
  background-color: #ffffff;
  width: 100%;
  height: 80px;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  padding: 0 5%;
  position: relative;
}

#agent-header-avatar {
  width: auto;
  height: 46px;
  display: block;
  margin-right: 16px;
}

#agent-header-avatar img {
  max-width: 46px;
}

#agent-header-title {
  font-size: 20px;
  font-weight: 500;
  margin: 0;
  padding: 0;
  color: #3e3c3b;
}
#agent-header-info{
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
#agent-header-status {
  font-size: 13px;
  margin: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.agent-header-status-indicator.online {
  width: 6px;
  height: 6px;
  background-color: #24ac05;
  border-radius: 50%;
  margin-right: 8px;
}
/* --- Finish Chat Header --- */

#agent-footer {
  width: 100%;
  background-color: #f5f4ed;
  padding: 5%;
  padding-bottom: 16px;
}

#chatBox {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.agent-chat-content {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primaryColor) #f0f0f0;
  padding: 0 5%;
  flex: 1;
  background-color: #f5f4ed;
}

.agent-chat-content::-webkit-scrollbar {
  width: 8px;
}

.agent-chat-content::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 8px;
}

.agent-chat-content::-webkit-scrollbar-thumb {
  background-color: var(--primaryColor);
  border-radius: 8px;
  border: 2px solid var(--primaryColor);
}

.agent-chat-content::-webkit-scrollbar-thumb:hover {
  background-color: var(--primaryColor);
  cursor: pointer;
}

#inputContainer {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

#inputText {
  width: 100%;
  font-size: 14px;
  color: #9b9595;
  resize: none;
  border: none;
  line-height: 48px;
  padding-left: 10px;
  overflow: hidden;
  padding-right: 50px;
}

#inputText:focus-visible {
  border: none;
  outline: none;
}

#sendButton {
  background-image: url("../assets/send-btn-icon.svg");
  background-repeat: no-repeat;
  background-size: 24px;
  background-position: center;
  width: 40px;
  height: 40px;
  background-color: var(--primaryColor);
  border: none;
  position: absolute;
  top: 7px;
  right: 5px;
  cursor: pointer;
}

#sendButton:focus {
  border: none;
  outline: none;
}

#sendButton.disabled {
  background-color: #DEDEDE;
	cursor: default;
}

.userMessage {
  background-color: #ffffff;
  padding: 10px;
  margin: 16px 10px 0 10%;
  border-radius: 6px 6px 0 6px;
  text-align: left;
  font-size: 14px;
  color: #3e3c3b;
  line-height: 140%;
  position: relative;
}

.userMessage::before {
  content: "You";
  display: block;
  color: var(--messageTitleColor);
  font-size: 13px;
  font-weight: 500;
  line-height: 140%;
}

.botResponse {
  background-color: #ffffff;
  color: #155724;
  font-size: 14px;
  padding: 10px;
  margin: 16px 10% 0 10px;
  border-radius: 6px 6px 6px 0;
  text-align: left;
  line-height: 140%;
  position: relative;
}

.botResponse::before {
  content: var(--botName);
  display: block;
  color: var(--messageTitleColor);
  font-size: 13px;
  font-weight: 500;
  line-height: 140%;
}

.userMessage span,
.botResponse span {
  display: block;
  width: 80%;
}

.userMessage .timestamp,
.botResponse .timestamp {
  font-size: 12px;
  color: #9b9595;
  display: block;
  text-align: right;
  position: absolute;
  bottom: 9px;
  right: 8px;
}

/* Styles for links in bot responses */
.botResponse a {
  color: #0066cc;
  text-decoration: underline;
  word-break: break-all;
}

.botResponse a:hover {
  color: #003366;
  text-decoration: underline;
}

.botResponse a:visited {
  color: #660099;
}

/* Enhanced Markdown Typography */
.botResponse {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: #2c3e50;
}

/* Headings */
.botResponse h1, .botResponse h2, .botResponse h3, 
.botResponse h4, .botResponse h5, .botResponse h6 {
  margin: 1.5em 0 0.5em 0;
  font-weight: 600;
  line-height: 1.25;
  color: #1a202c;
}

.botResponse h1 { font-size: 1.5em; }
.botResponse h2 { font-size: 1.3em; }
.botResponse h3 { font-size: 1.1em; }
.botResponse h4 { font-size: 1em; }
.botResponse h5 { font-size: 0.9em; }
.botResponse h6 { font-size: 0.8em; }

/* Paragraphs and spacing */
.botResponse p {
  margin: 0.75em 0;
  line-height: 1.6;
}

/* Bold and Italic */
.botResponse strong {
  font-weight: 600;
  color: #1a202c;
}

.botResponse em {
  font-style: italic;
}

.botResponse del {
  text-decoration: line-through;
  color: #718096;
}

/* Thinking indicator styles */
.botResponse.thinking {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  min-height: 60px;
  display: flex;
  align-items: center;
}

.thinking-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.thinking-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 12px;
}

.thinking-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6c757d;
  animation: thinking-pulse 1.4s ease-in-out infinite both;
}

.thinking-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes thinking-pulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Code styling */
.botResponse code {
  background-color: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.125em 0.25em;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875em;
  color: #e53e3e;
}

/* Code blocks */
.botResponse pre {
  background-color: #2d3748;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
  position: relative;
  border: 1px solid #4a5568;
}

.botResponse pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: 0.875em;
  line-height: 1.5;
}

/* Copy button for code blocks */
.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #4a5568;
  padding: 0.5rem 1rem;
  border-radius: 8px 8px 0 0;
  margin: 1rem 0 0 0;
  font-size: 0.75em;
  color: #e2e8f0;
}

.code-block-header .copy-button {
  background-color: #718096;
  color: white;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75em;
  transition: background-color 0.2s;
}

.code-block-header .copy-button:hover {
  background-color: #a0aec0;
}

.code-block-header .copy-button.copied {
  background-color: #48bb78;
}

/* Collapsible code blocks */
.code-block-wrapper {
  margin: 1rem 0;
}

.code-block-wrapper.collapsible pre {
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.code-block-wrapper.collapsible.expanded pre {
  max-height: none;
}

.code-block-wrapper .expand-button {
  background-color: #4a5568;
  color: white;
  border: none;
  padding: 0.5rem;
  width: 100%;
  cursor: pointer;
  font-size: 0.75em;
  border-radius: 0 0 8px 8px;
  transition: background-color 0.2s;
}

.code-block-wrapper .expand-button:hover {
  background-color: #718096;
}

/* Blockquotes */
.botResponse blockquote {
  border-left: 4px solid var(--primaryColor);
  margin: 1rem 0;
  padding: 0.5rem 0 0.5rem 1rem;
  background-color: #f7fafc;
  border-radius: 0 4px 4px 0;
  font-style: italic;
  color: #4a5568;
}

.botResponse blockquote p {
  margin: 0.5em 0;
}

/* Lists */
.botResponse ul, .botResponse ol {
  margin: 0.75em 0;
  padding-left: 1.5em;
}

.botResponse li {
  margin: 0.25em 0;
  line-height: 1.6;
}

.botResponse ul li {
  list-style-type: disc;
}

.botResponse ol li {
  list-style-type: decimal;
}

/* Nested lists */
.botResponse ul ul, .botResponse ol ol, 
.botResponse ul ol, .botResponse ol ul {
  margin: 0.25em 0;
}

/* Tables */
.botResponse table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.botResponse th, .botResponse td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.botResponse th {
  background-color: #f7fafc;
  font-weight: 600;
  color: #2d3748;
}

.botResponse tr:hover {
  background-color: #f7fafc;
}

/* Horizontal rules */
.botResponse hr {
  border: none;
  border-top: 2px solid #e2e8f0;
  margin: 2rem 0;
}

/* Product recommendation cards */
.li-product-card {
  background: white;
  border: 2px solid transparent;
  border-radius: 12px;
  margin: 1rem 0;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.li-product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primaryColor, #ba6d55), #d4a574);
}

.li-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.li-card-header {
  font-weight: 600;
  font-size: 1.1em;
  color: #2d3748;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.li-card-body {
  color: #4a5568;
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: 0.95em;
}

.li-card-footer {
  text-align: center;
}

.li-card-footer a {
  display: inline-block;
  background: linear-gradient(135deg, var(--primaryColor, #ba6d55), #d4a574);
  color: white;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9em;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.li-card-footer a:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #a05a44, #c19a6b);
}

/* Link previews */
.link-preview {
  background-color: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin: 1rem 0;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s;
}

.link-preview:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.link-preview-image {
  width: 100%;
  height: 200px;
  background-color: #f7fafc;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.link-preview-content {
  padding: 1rem;
}

.link-preview-title {
  font-weight: 600;
  font-size: 1em;
  color: #2d3748;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.link-preview-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.link-preview-title a:hover {
  color: var(--primaryColor, #ba6d55);
  text-decoration: underline;
}

.link-preview-description {
  color: #718096;
  font-size: 0.875em;
  line-height: 1.5;
  margin: 0 0 0.5rem 0;
}

.link-preview-url {
  color: #a0aec0;
  font-size: 0.75em;
  text-decoration: none;
  word-break: break-all;
}

.link-preview-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Loading skeleton for link previews */
.link-preview-skeleton .link-preview-image {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.link-preview-skeleton .link-preview-title,
.link-preview-skeleton .link-preview-description {
  height: 1em;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
  margin: 0.5rem 0;
}

.link-preview-skeleton .link-preview-title {
  width: 80%;
}

.link-preview-skeleton .link-preview-description {
  width: 100%;
}

/* Fallback link styling */
.link-fallback {
  display: inline-flex;
  align-items: center;
  background-color: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: #4a5568;
  font-size: 0.875em;
  transition: all 0.2s;
}

.link-fallback:hover {
  background-color: #edf2f7;
  border-color: #cbd5e0;
  color: #2d3748;
}

.link-fallback::before {
  content: "🔗";
  margin-right: 0.5rem;
  font-size: 1em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .botResponse pre {
    font-size: 0.75em;
    padding: 0.75rem;
  }
  
  .link-preview-image {
    height: 150px;
  }
  
  .botResponse table {
    font-size: 0.875em;
  }
  
  .botResponse th, .botResponse td {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  #agent-header {
    max-width: 340px;
  }

  #agent-container {
    max-width: 348px;
    padding: 0 12px 12px;
  }

  #agent-container #inputContainer {
    max-width: 340px;
  }
}