/* AI Assistant Styles */

/* 模态框样式 - 全屏 */
#modalAI .modal-dialog {
  max-width: 100%;
  margin: 0;
  height: 100vh;
}

#modalAI .modal-content {
  border-radius: 0;
  height: 100vh;
  max-height: 100vh;
  border: none;
}

#modalAI .modal-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
}

#modalAI .modal-header .ai-blog-title {
  font-size: 0.75rem;
  color: #999;
  flex-shrink: 0;
  margin-right: 0.75rem;
}

#modalAI .modal-header .modal-title {
  font-size: 1.1rem;
  margin: 0;
  flex: 1;
  text-align: center;
}

#modalAI .modal-header .ai-header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 0.75rem;
}

#modalAI .modal-header .ai-esc-hint {
  font-size: 0.7rem;
  color: #999;
  margin-right: 0.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

#modalAI .modal-header .ai-esc-hint:hover {
  color: #666;
}

#modalAI .modal-body {
  padding: 1rem;
  height: calc(100vh - 60px);
  max-height: calc(100vh - 60px);
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

/* 温馨提示文字 */
.ai-tip-text {
  font-size: 10px;
  color: #999;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.ai-tip-text .tip-label {
  color: #e67e22;
  font-weight: 600;
}

.ai-tip-text a {
  color: #999;
  text-decoration: underline;
}

.ai-tip-text a:hover {
  color: #e67e22;
}

/* 输入区域 */
.ai-input-area {
  margin-bottom: 1rem;
}

.ai-input-area textarea {
  resize: vertical;
  min-height: 80px;
  max-height: 150px;
}

/* 发送按钮 */
#ai-submit {
  font-size: 0.875rem;
}

#ai-submit i {
  margin-right: 4px;
}

/* 结果容器 - 占满剩余空间 */
#ai-result {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 结果内部容器 - 占满剩余高度 */
.ai-result-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#ai-result::-webkit-scrollbar {
  width: 6px;
}

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

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

#ai-result::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* 结果头部 - 标题和按钮在同一行 */
.ai-result-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  margin-bottom: 0.5rem;
}

/* 问题标题 - 自适应换行 */
.ai-result-header .ai-question-title {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.4;
}

/* 操作按钮组 - 固定宽度始终可见 */
.ai-result-header .ai-result-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  flex-shrink: 0;
  margin-left: 0.75rem;
}

/* 操作按钮组 */
.ai-action-btn {
  position: relative;
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.4rem;
}

.ai-action-btn:first-child {
  margin-left: 0;
}

.ai-action-btn svg {
  display: block;
}

.ai-action-btn.copied {
  color: #28a745;
  background: #e8f5e9;
  border-color: #28a745;
}

/* 灰色分割线 */
.ai-divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 0 0 1rem 0;
}

/* 回复卡片 - 占满剩余空间 */
.ai-response-card {
  border: 1px solid #e0e0e0;
  padding: 1rem;
  background: #fafafa;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* AI 响应区域 */
.ai-response {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

.ai-response .ai-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9rem;
}

.ai-response .ai-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.ai-response .ai-content::-webkit-scrollbar {
  width: 6px;
}

.ai-response .ai-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.ai-response .ai-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.ai-response .ai-content::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Markdown 内容样式 - 字体稍小 */
.markdown-content {
  font-size: 0.75rem;
  line-height: 1.6;
  color: #333;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.markdown-content h3 {
  font-size: 0.95rem;
}

.markdown-content h4 {
  font-size: 0.875rem;
}

.markdown-content h5 {
  font-size: 0.8rem;
}

.markdown-content p {
  margin-bottom: 0.75rem;
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.markdown-content li {
  margin-bottom: 0.25rem;
}

.markdown-content .code-block {
  background: #f6f8fa;
  border-radius: 6px;
  padding: 0.75rem;
  margin: 0.75rem 0;
  overflow-x: auto;
}

.markdown-content .code-block code {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.7rem;
  line-height: 1.5;
}

.markdown-content .inline-code {
  background: #f0f0f0;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.7rem;
  color: #e83e8c;
}

.markdown-content a {
  color: #0366d6;
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

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

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

.markdown-content del {
  color: #999;
}

.markdown-content blockquote {
  border-left: 3px solid #ddd;
  padding-left: 0.75rem;
  margin: 0.5rem 0;
  color: #666;
  font-style: italic;
}

.markdown-content table,
.markdown-content .ai-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.7rem;
  display: block;
  overflow-x: auto;
}

.markdown-content table th,
.markdown-content table td,
.markdown-content .ai-table th,
.markdown-content .ai-table td {
  border: 1px solid #ddd;
  padding: 0.4rem 0.6rem;
  text-align: left;
  white-space: nowrap;
}

.markdown-content table th,
.markdown-content .ai-table th {
  background: #f6f8fa;
  font-weight: 600;
}

.markdown-content table tr:nth-child(even),
.markdown-content .ai-table tr:nth-child(even) {
  background: #fafafa;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 1rem 0;
}

.markdown-content img {
  max-width: 100%;
  border-radius: 4px;
}

/* 加载动画 */
.spinner-border {
  width: 2rem;
  height: 2rem;
}

/* 暗色模式适配 */
.dark-mode #modalAI .modal-content {
  background: #1e1e1e;
  border-color: #333;
}

.dark-mode #modalAI .modal-header {
  border-bottom-color: #333;
}

.dark-mode #modalAI .modal-header .modal-title {
  color: #e0e0e0;
}

.dark-mode #modalAI .modal-header .close {
  color: #e0e0e0;
}

.dark-mode .ai-result-header {
  border-bottom-color: #333;
}

.dark-mode .ai-result-header .ai-question {
  color: #aaa;
}

.dark-mode .ai-result-header .ai-question strong {
  color: #e0e0e0;
}

.dark-mode .ai-response-card {
  border-color: #444;
  background: #2a2a2a;
}

.dark-mode .ai-response-card .ai-copy-icon {
  color: #888;
}

.dark-mode .ai-response-card .ai-copy-icon:hover {
  color: #ccc;
  background: #3a3a3a;
}

.dark-mode .ai-response .ai-content::-webkit-scrollbar-track {
  background: #2a2a2a;
}

.dark-mode .ai-response .ai-content::-webkit-scrollbar-thumb {
  background: #555;
}

.dark-mode .ai-response .ai-content::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.dark-mode .markdown-content {
  color: #d4d4d4;
}

.dark-mode .markdown-content .code-block {
  background: #2d2d2d;
}

.dark-mode .markdown-content .inline-code {
  background: #2d2d2d;
  color: #f06292;
}

.dark-mode .markdown-content a {
  color: #58a6ff;
}

.dark-mode .markdown-content blockquote {
  border-left-color: #555;
  color: #aaa;
}

.dark-mode .markdown-content table th,
.dark-mode .markdown-content .ai-table th {
  background: #333;
}

.dark-mode .markdown-content table tr:nth-child(even),
.dark-mode .markdown-content .ai-table tr:nth-child(even) {
  background: #2a2a2a;
}

.dark-mode .markdown-content hr {
  border-top-color: #444;
}

/* 响应式调整 */
@media (max-width: 576px) {
  #modalAI .modal-body {
    height: 60vh;
    max-height: 60vh;
  }

  .ai-result-container {
    flex: 1;
    min-height: 0;
  }

  .ai-response-card {
    flex: 1;
    min-height: 0;
  }
}
