/* 对话页面专用样式 */

/* 基础样式重置和通用类 */
.min-h-screen { min-height: 100vh; }
.bg-base-100 { background-color: #ffffff; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-80 { width: 20rem; }
.w-full { width: 100%; }
.max-w-4xl { max-width: 56rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-4 { padding: 1rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.rounded { border-radius: 0.25rem; }
.rounded-full { border-radius: 9999px; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.font-semibold { font-weight: 600; }
.text-center { text-align: center; }
.resize-none { resize: none; }
.outline-none { outline: 2px solid transparent; outline-offset: 2px; }
.cursor-pointer { cursor: pointer; }
.overflow-y-auto { overflow-y: auto; }
.hidden { display: none; }

/* Navbar 样式 */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  min-height: 4rem;
}
.navbar-start { display: flex; align-items: center; }
.navbar-center { display: flex; align-items: center; flex: 1; justify-content: center; }
.navbar-end { display: flex; align-items: center; }
.bg-base-200 { background-color: #f2f2f2; }
.border-b { border-bottom-width: 1px; }
.border-base-300 { border-color: #e5e7eb; }

/* Button 样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: inherit;
}
.btn-ghost:hover {
  background-color: #f3f4f6;
}
.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
}
.btn-primary {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}
.btn-primary:hover {
  background-color: #2563eb;
  border-color: #2563eb;
}

/* Avatar 样式 */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar .placeholder {
  background-color: #6b7280;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dropdown 样式 */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-end .dropdown-content {
  right: 0;
}
.dropdown-content {
  position: absolute;
  top: 100%;
  z-index: 50;
  background-color: white;
  border-radius: 0.5rem;
  padding: 0.5rem 0;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  min-width: 12rem;
  display: none;
}
.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
  display: block;
}
.menu {
  list-style: none;
  margin: 0;
  padding: 0;
}
.menu li a {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  color: #374151;
  text-decoration: none;
  transition: background-color 0.2s;
}
.menu li a:hover {
  background-color: #f3f4f6;
}

/* 布局样式 */
.h-\[calc\(100vh-64px\)\] {
  height: calc(100vh - 64px);
}

/* 边框和背景色 */
.border-r { border-right-width: 1px; }
.border-t { border-top-width: 1px; }
.bg-base-100 { background-color: #ffffff; }

/* 消息样式 */
.message {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}
.message-user {
  background-color: #eff6ff;
  margin-left: 2rem;
}
.message-assistant {
  background-color: #f9fafb;
  margin-right: 2rem;
}

/* 输入框样式 */
.textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.5;
  resize: none;
}
/* 普通textarea的焦点样式（排除聊天输入框） */
.textarea:not(.message-input):focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}

/* 移动端响应式 */
@media (min-width: 1024px) {
  .lg\:block { display: block; }
}
@media (max-width: 1023px) {
  .lg\:block { display: none; }
}

/* 头像初始字母 */
.avatar-initial {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* 时间戳样式 */
.timestamp {
  color: #6b7280;
  font-size: 0.75rem;
}

/* 消息操作按钮 */
.message-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.message-actions button {
  padding: 0.25rem;
  background: none;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.message-actions button:hover {
  opacity: 1;
  background-color: #f3f4f6;
}

/* 文件上传样式 */
.file-preview-area {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.file-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
}

.file-clear-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
}

.file-clear-btn:hover {
  background-color: #fee2e2;
}

.file-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.file-preview-item {
  display: flex;
  align-items: center;
  background-color: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.75rem;
  position: relative;
  transition: border-color 0.2s;
}

.file-preview-item:hover {
  border-color: #cbd5e1;
}

.file-preview-image {
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  border-radius: 0.25rem;
  overflow: hidden;
}

.file-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-preview-icon {
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f1f5f9;
  border-radius: 0.25rem;
}

.file-preview-icon i {
  width: 1.5rem;
  height: 1.5rem;
  color: #64748b;
}

.file-preview-info {
  flex: 1;
  margin-left: 0.75rem;
  min-width: 0;
}

.file-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.file-remove-btn {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  background-color: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  opacity: 0;
}

.file-preview-item:hover .file-remove-btn {
  opacity: 1;
}

.file-remove-btn:hover {
  background-color: #dc2626;
}

.file-remove-btn i {
  width: 0.75rem;
  height: 0.75rem;
}

/* 输入工具按钮 */
.input-tools {
  display: flex;
  gap: 0.25rem;
  margin-right: 0.5rem;
}

.tool-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: none;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.tool-button:hover {
  background-color: #f1f5f9;
  color: #3b82f6;
}

.tool-button i {
  width: 1rem;
  height: 1rem;
}

/* 拖拽样式 */
.input-section.drag-over {
  background-color: #f0f9ff;
  border-color: #3b82f6;
}

.input-section.drag-over .input-box {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 文件上传toast */
.file-upload-toast {
  max-width: 400px;
  white-space: pre-line;
  text-align: left;
}

/* 消息中的文件附件样式 */
.message-attachments {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
}

.attachment-item {
  margin-bottom: 0.75rem;
}

.image-attachment {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.attachment-image {
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.attachment-image:hover {
  transform: scale(1.02);
  cursor: pointer;
}

.attachment-info {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.attachment-name {
  font-weight: 500;
  color: #374151;
}

.attachment-size {
  color: #9ca3af;
}

.file-attachment {
  display: flex;
  align-items: center;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  max-width: 300px;
  transition: background-color 0.2s;
}

.file-attachment:hover {
  background-color: #f3f4f6;
}

.file-attachment .file-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e0e7ff;
  border-radius: 0.375rem;
  margin-right: 0.75rem;
}

.file-attachment .file-icon i {
  color: #5b21b6;
}

.file-attachment .file-info {
  flex: 1;
  min-width: 0;
}

.file-attachment .file-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.file-attachment .file-size {
  font-size: 0.75rem;
  color: #6b7280;
}

/* 响应式调整 */
@media (max-width: 640px) {
  .file-preview-list {
    grid-template-columns: 1fr;
  }

  .file-preview-item {
    padding: 0.5rem;
  }

  .attachment-image {
    max-width: 150px !important;
    max-height: 100px !important;
  }

  .file-attachment {
    max-width: 250px;
  }
}