::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2f2f2f; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* Sidebar */
#sidebar {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

#sidebar.ready {
  transition: width 0.15s ease, transform 0.15s ease;
}

@media (min-width: 1024px) {
  #sidebar {
    width: 260px;
  }
  #sidebar.collapsed {
    width: 0;
  }
}

@media (max-width: 1023px) {
  #sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 50;
    transform: translateX(-100%);
  }
  #sidebar.mobile-open {
    transform: translateX(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fade-in 0.2s ease-out;
}

@keyframes dot-bounce {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.thinking-dot {
  animation: dot-bounce 1.4s infinite ease-in-out both;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

#prompt-input {
  min-height: 24px;
}

/* Product search */
.product-result-item + .product-result-item {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.product-search-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #10a37f;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Markdown content in assistant messages */
.markdown-content > *:first-child { margin-top: 0; }
.markdown-content > *:last-child { margin-bottom: 0; }

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-weight: 600;
  margin: 1.25em 0 0.5em;
  line-height: 1.35;
  color: #fff;
}
.markdown-content h1 { font-size: 1.4em; }
.markdown-content h2 { font-size: 1.2em; }
.markdown-content h3 { font-size: 1.05em; }

.markdown-content p { margin: 0.6em 0; }

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

.markdown-content blockquote {
  border-left: 3px solid rgba(255, 255, 255, 0.15);
  padding: 0.4em 1em;
  margin: 0.75em 0;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 8px 8px 0;
}
.markdown-content blockquote p { margin: 0.25em 0; }

.markdown-content ul,
.markdown-content ol {
  padding-left: 1.5em;
  margin: 0.6em 0;
}
.markdown-content ul { list-style-type: disc; }
.markdown-content ol { list-style-type: decimal; }
.markdown-content li { margin: 0.2em 0; }
.markdown-content li > ul,
.markdown-content li > ol { margin: 0.2em 0; }

.markdown-content hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 1.5em 0;
}

.markdown-content code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

.markdown-content pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1em;
  overflow-x: auto;
  margin: 0.75em 0;
}
.markdown-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.85em;
  line-height: 1.6;
}

.markdown-content .table-wrapper {
  overflow-x: auto;
  margin: 0.75em 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875em;
  line-height: 1.5;
}
.markdown-content table th,
.markdown-content table td {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5em 0.75em;
  text-align: left;
}
.markdown-content table th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  color: #fff;
}
.markdown-content table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.markdown-content a {
  color: #10a37f;
  text-decoration: underline;
  text-decoration-color: rgba(16, 163, 127, 0.3);
}
.markdown-content a:hover {
  text-decoration-color: #10a37f;
}

/* Conversation / Trainer delete button: gradient fade on the left so text doesn't look clipped */
.conv-item .conv-delete-btn,
.trainer-item .trainer-delete-btn {
  pointer-events: none;
}
.conv-item:hover .conv-delete-btn,
.trainer-item:hover .trainer-delete-btn {
  pointer-events: auto;
}

/* Trainer entry pairs: visual separator between Q&A pairs */
.entry-pair + .entry-pair {
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Datasets: stepper chevron rotation */
.trainer-chevron {
  transition: transform 0.15s ease;
}

/* Datasets: JSONL viewer */
.jsonl-viewer {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

.jsonl-line-num {
  user-select: none;
  min-width: 2.5rem;
}
