/* V.03 interaction and reading polish */

.ai-message .content {
  font-size: 15.5px;
  line-height: 1.78;
}

.ai-message .content > :first-child {
  margin-top: 0;
}

.ai-message .content > :last-child {
  margin-bottom: 0;
}

.ai-message .content p {
  margin: 0.72em 0;
}

.ai-message .content h1,
.ai-message .content h2,
.ai-message .content h3,
.ai-message .content h4 {
  margin: 1.05em 0 0.52em;
  color: var(--text-color);
  line-height: 1.34;
  font-weight: 760;
}

.ai-message .content h1 {
  font-size: 1.35em;
}

.ai-message .content h2 {
  font-size: 1.22em;
}

.ai-message .content h3 {
  font-size: 1.1em;
}

.ai-message .content ul,
.ai-message .content ol {
  margin: 0.72em 0;
  padding-left: 1.45em;
}

.ai-message .content li {
  margin: 0.32em 0;
  padding-left: 0.1em;
}

.ai-message .content li::marker {
  color: var(--muted-text-color);
}

.ai-message .content blockquote {
  margin: 0.9em 0;
  padding: 0.2em 0 0.2em 1em;
  border-left: 3px solid rgba(0, 122, 255, 0.35);
  color: var(--muted-text-color);
}

.ai-message .content a {
  color: var(--primary-color);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ai-message .content hr {
  height: 1px;
  margin: 1.2em 0;
  border: 0;
  background: var(--hairline);
}

.ai-message .content table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1em 0;
  overflow-x: auto;
  border-collapse: collapse;
  border: 1px solid var(--hairline);
  border-radius: 12px;
}

.ai-message .content th,
.ai-message .content td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  white-space: nowrap;
}

.ai-message .content th {
  background: rgba(118, 118, 128, 0.08);
  font-weight: 720;
}

.ai-message .content :not(pre) > code {
  padding: 0.16em 0.42em;
  border: 1px solid rgba(118, 118, 128, 0.16);
  border-radius: 7px;
  background: rgba(118, 118, 128, 0.12);
  color: #d6336c;
  font-size: 0.92em;
}

[data-theme="dark"] .ai-message .content :not(pre) > code {
  color: #ff8ab3;
}

.code-block-container {
  margin: 1em 0;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: #f6f8fa;
  overflow: hidden;
  box-shadow: none;
}

[data-theme="dark"] .code-block-container {
  background: #111827;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(118, 118, 128, 0.08);
}

[data-theme="dark"] .code-block-header {
  background: rgba(255, 255, 255, 0.06);
}

.code-language {
  color: var(--muted-text-color);
  font-size: 12px;
  font-weight: 720;
  text-transform: lowercase;
}

.copy-code-btn {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-color);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  opacity: 1;
}

[data-theme="dark"] .copy-code-btn {
  background: rgba(255, 255, 255, 0.08);
}

.copy-code-btn:hover,
.copy-code-btn.copied {
  display: inline-flex;
  border-color: rgba(0, 122, 255, 0.28);
  background: rgba(0, 122, 255, 0.12);
  color: var(--primary-color);
}

.code-block-container:hover .copy-code-btn {
  display: inline-flex;
}

.code-block-container pre,
.ai-message .code-block-container pre {
  margin: 0;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow-x: auto;
}

.code-block-container code {
  display: block;
  min-width: max-content;
  padding: 0;
  background: transparent;
  color: inherit;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.72;
  tab-size: 2;
  white-space: pre;
}

.sidebar.collapsed .session-item {
  position: relative;
  width: 44px;
  min-height: 44px;
  justify-content: center;
  padding: 0;
  margin: 6px auto;
  border-radius: 16px;
}

.sidebar.collapsed .session-item::before {
  content: attr(data-short);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: rgba(118, 118, 128, 0.12);
  color: var(--text-color);
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
}

.sidebar.collapsed .session-item.active::before {
  background: var(--primary-color);
  color: #fff;
}

.sidebar.collapsed .session-item.active::after {
  content: "";
  position: absolute;
  right: 3px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 2px var(--surface-solid);
}

@media (max-width: 760px) {
  .sidebar.collapsed .session-item::before,
  .sidebar.collapsed .session-item.active::after {
    display: none;
  }
}
