/*
 * 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.
 */

/* KaTeX stylesheet for math rendering */
@import url("https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css");
/* KaTeX overflow handling for chat messages */
.markdown-content .katex {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

.markdown-content .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  margin: 1em 0;
}

/* Ensure KaTeX formulas don't break out of chat bubbles */
.markdown-content .katex .base {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
/* Markdown content styling for chat messages */
.markdown-content {
  line-height: 1.6;
  overflow-wrap: break-word;
    word-wrap: break-word;
}

.markdown-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #333;
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
}
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.25;
}

.markdown-content h1 {
  font-size: 2rem;
    color: #1f2937;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
    margin-bottom: 20px;
    margin-top: 0;
}

.markdown-content h2 {
  font-size: 1.5rem;
    color: #374151;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 5px;
}

.markdown-content h3 {
  font-size: 1.25rem;
    color: #4b5563;
    margin-top: 25px;
    margin-bottom: 10px;
}

.markdown-content h4 {
  font-size: 1.1rem;
    color: #6b7280;
    margin-top: 20px;
    margin-bottom: 8px;
}

.markdown-content h5 {
  font-size: 0.875em;
}

.markdown-content h6 {
  font-size: 0.75em;
}

.markdown-content p {
  margin: 10px 0;
}

.markdown-content ul {
  margin: 10px 0;
    padding-left: 20px;
  list-style-type: disc;
}

.markdown-content ol {
  margin: 10px 0;
    padding-left: 20px;
  list-style-type: decimal;
}

.markdown-content li {
  margin: 5px 0;
  display: list-item;
}

/* Nested lists */
.markdown-content ul ul {
  list-style-type: circle;
  margin-top: 0.25em;
  margin-bottom: 0.25em;
}

.markdown-content ul ul ul {
  list-style-type: square;
}

.markdown-content ol ol {
  list-style-type: lower-alpha;
  margin-top: 0.25em;
  margin-bottom: 0.25em;
}

.markdown-content ol ol ol {
  list-style-type: lower-roman;
}

/* Mixed nested lists */
.markdown-content ul ol,
.markdown-content ol ul {
  margin-top: 0.25em;
  margin-bottom: 0.25em;
}

.markdown-content blockquote {
  border-left: 4px solid #e5e7eb;
  padding-left: 1em;
  margin: 1em 0;
  color: #6b7280;
  font-style: italic;
}

.markdown-content code {
  background-color: #f3f4f6;
  padding: 0.125em 0.25em;
  border-radius: 0.25em;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875em;
}

.markdown-content pre {
  background-color: #f3f4f6;
  padding: 1em;
  border-radius: 0.5em;
  overflow-x: auto;
  margin: 1em 0;
}

.markdown-content pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

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

.markdown-content a:hover {
  color: #1d4ed8;
}

.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid #d1d5db;
  padding: 0.5em 0.75em;
  text-align: left;
}

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

.markdown-content hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 2em 0;
}

.markdown-content strong {
  font-weight: 600;
  color: #1f2937;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content del {
  text-decoration: line-through;
  color: #6b7280;
}

.markdown-content mark {
  background-color: #fef3c7;
  padding: 0.125em 0.25em;
  border-radius: 0.25em;
}

/* Custom pagination styling for better UX */
.pagination-wrapper .pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.pagination-wrapper .pagination a,
.pagination-wrapper .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  /* border: 1px solid #d1d5db; */
  border-radius: 0.375rem;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.pagination-wrapper .pagination a {
  color: #374151;
  background-color: #ffffff;
}

.pagination-wrapper .pagination a:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.pagination-wrapper .pagination .current {
  background-color: #3b82f6 !important;
  color: #ffffff !important;
  border-color: #3b82f6 !important;
  font-weight: 600;
}

.pagination-wrapper .pagination .disabled {
  color: #9ca3af;
  background-color: #f9fafb;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

.pagination-wrapper .pagination .gap {
  color: #6b7280;
  border: none;
  background: none;
}

/* Beating logo animation for chat loading */
@keyframes heartbeat {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }

  100% {
    transform: scale(1);
    opacity: 0.6;
  }
}

.beating-logo {
  animation: heartbeat 1.5s ease-in-out infinite;
}

.loading-animation {
  backdrop-filter: blur(2px);
  transition: opacity 0.3s ease-in-out;
}

.loading-animation.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Smaller pulsing dots for the connecting bubble */
.chat-connecting-dot {
  /* blank to leave default size */
  font-size: 0.625rem;
  /* 10px */
  line-height: 1;
  display: inline-block;
}
/* Chat message overflow handling */
.chat-message-bubble {
  overflow-x: auto;
  overflow-y: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
/* Make table itself scrollable */
.chat-message-bubble .markdown-content table {
  max-width: 1043px;
  display: block;
  overflow-x: auto;
}
/* Ensure inline KaTeX formulas are properly contained */
.markdown-content .katex-inline {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  vertical-align: baseline;
}

/* Global button cursor styling */
button:not(:disabled),
input[type="submit"]:not(:disabled),
input[type="button"]:not(:disabled),
input[type="reset"]:not(:disabled) {
  cursor: pointer;
}

button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled,
input[type="reset"]:disabled {
  cursor: not-allowed;
}
