/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Chat-specific styles */
.thinking {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Thinking dots animation */
.thinking-dots {
  display: flex;
  align-items: center;
  space-x: 1px;
}

.thinking-dots .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #9ca3af;
  margin: 0 1px;
  animation: thinking 1.4s infinite ease-in-out both;
}

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

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

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

.message-wrapper {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scrollbar styling for messages container */
#messages::-webkit-scrollbar {
  width: 6px;
}

#messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

#messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

#messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Markdown content styling */
.prose {
  color: inherit;
}

/* Message content styling */
.message-wrapper .prose {
  color: #ffffff;
}

.message-wrapper .prose h1,
.message-wrapper .prose h2,
.message-wrapper .prose h3,
.message-wrapper .prose h4,
.message-wrapper .prose h5,
.message-wrapper .prose h6 {
  color: #ffffff;
}

.message-wrapper .prose p {
  color: #ffffff;
}

.message-wrapper .prose li {
  color: #ffffff;
}

.message-wrapper .prose strong {
  color: #ffffff;
}

.message-wrapper .prose em {
  color: #ffffff;
}

.message-wrapper .prose blockquote {
  color: #e5e7eb;
  border-left-color: #9ca3af;
}

.message-wrapper .prose a {
  color: #93c5fd;
}

.message-wrapper .prose a:hover {
  color: #dbeafe;
}

/* Glass container prose styling */
.backdrop-blur-md .prose {
  color: #ffffff;
}

.backdrop-blur-md .prose h1,
.backdrop-blur-md .prose h2,
.backdrop-blur-md .prose h3,
.backdrop-blur-md .prose h4,
.backdrop-blur-md .prose h5,
.backdrop-blur-md .prose h6 {
  color: #ffffff;
}

.backdrop-blur-md .prose p {
  color: #ffffff;
}

.backdrop-blur-md .prose li {
  color: #ffffff;
}

.backdrop-blur-md .prose strong {
  color: #ffffff;
}

.backdrop-blur-md .prose em {
  color: #ffffff;
}

.backdrop-blur-md .prose blockquote {
  color: #e5e7eb;
  border-left-color: #9ca3af;
}

.backdrop-blur-md .prose a {
  color: #93c5fd;
}

.backdrop-blur-md .prose a:hover {
  color: #dbeafe;
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  color: inherit;
  font-weight: 600;
  margin-top: 1em;
  margin-bottom: 0.5em;
}

.prose h1 { font-size: 1.25em; }
.prose h2 { font-size: 1.125em; }
.prose h3 { font-size: 1em; }

.prose p {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.prose code {
  background-color: #f3f4f6;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

.prose pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.prose pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

.prose ul, .prose ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.prose li {
  margin: 0.25rem 0;
}

.prose blockquote {
  border-left: 4px solid #d1d5db;
  padding-left: 1rem;
  margin: 0.5rem 0;
  font-style: italic;
  color: #6b7280;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
}

.prose th, .prose td {
  border: 1px solid #d1d5db;
  padding: 0.5rem;
  text-align: left;
}

.prose th {
  background-color: #f9fafb;
  font-weight: 600;
}

.prose a {
  color: #3b82f6;
  text-decoration: underline;
}

.prose a:hover {
  color: #1d4ed8;
}

.prose strong {
  font-weight: 600;
}

.prose em {
  font-style: italic;
}

/* Streaming content updates */
.streaming-content {
  transition: none; /* Remove transitions during streaming for smoother morphing */
}

/* Smooth content updates during streaming */
[id$="_content"] {
  /* Remove opacity transition to prevent flashing during morphing */
  transition: none;
}

/* Smooth morphing for Turbo */
[data-turbo-morph] {
  transition: none !important;
}

/* Cursor effect for streaming text */
.streaming-cursor::after {
  content: '▋';
  animation: blink 1s infinite;
  color: #3b82f6;
  margin-left: 1px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Prism.js Tomorrow Night Theme */
/* Based on https://github.com/chriskempson/tomorrow-theme */

code[class*="language-"],
pre[class*="language-"] {
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  font-size: 1em;
  text-align: left;
  white-space: pre-wrap;
  word-spacing: normal;
  word-break: break-word;
  word-wrap: break-word;
  line-height: 1.5;
  -moz-tab-size: 4;
  -o-tab-size: 4;
  tab-size: 4;
  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
  color: #ccc;
  background: none;
}

/* Code blocks */
pre[class*="language-"] {
  padding: 1em;
  margin: .5em 0;
  overflow: auto;
  border-radius: 0.375rem;
  background: #2d2d2d;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
  padding: .1em .3em;
  border-radius: .3em;
  white-space: normal;
  background: #2d2d2d;
}

.token.comment,
.token.block-comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #999;
}

.token.punctuation {
  color: #ccc;
}

.token.tag,
.token.attr-name,
.token.namespace,
.token.deleted {
  color: #e2777a;
}

.token.function-name {
  color: #6196cc;
}

.token.boolean,
.token.number,
.token.function {
  color: #f08d49;
}

.token.property,
.token.class-name,
.token.constant,
.token.symbol {
  color: #f8c555;
}

.token.selector,
.token.important,
.token.atrule,
.token.keyword,
.token.builtin {
  color: #cc99cd;
}

.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.variable {
  color: #7ec699;
}

.token.operator,
.token.entity,
.token.url {
  color: #67cdcc;
}

/* Prose overrides */
.prose pre {
  background-color: #2d2d2d !important;
  color: #ccc !important;
}

.prose code {
  background-color: #2d2d2d !important;
  color: #ccc !important;
  padding: 0.125rem 0.25rem !important;
  border-radius: 0.25rem !important;
  font-size: 0.875em !important;
}

.prose pre code {
  background-color: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  font-size: inherit !important;
}

.streaming-content pre[class*="language-"],
.message-wrapper pre[class*="language-"] {
  background: #2d2d2d !important;
  border-radius: 0.375rem;
  margin: 0.5rem 0;
}

.streaming-content code[class*="language-"],
.message-wrapper code[class*="language-"] {
  color: #ccc !important;
}

/* Common token styles */
.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

.token.inserted {
  color: green;
}
