/* styles.css */

/* 浏览器重置样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* 定义全局变量，便于统一管理主题 */
:root {
  /* 亮色主题变量 */
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #dbeafe;
  --secondary: #64748b;
  --bg-light: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #334155;
  --text-secondary: #64748b;
  --background-color: #f8fafc;
  --container-background: #ffffff;
  --danger-color: #ef4444;
  --success-color: #10b981;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
  --radius: 1rem;
  --transition-speed: 0.3s;
  --drop-area-hover: #f0f7ff;
  --file-item-hover: #f8fafc;
  --file-icon-bg: #f1f5f9;
  --toast-bg: rgba(255, 255, 255, 0.95);
  --modal-backdrop: rgba(15,23,42,0.8);
  --subtle-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  --info-color: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning-color: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --error-color: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --toast-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0, 0, 0, 0.04);
  --toast-border: 1px solid rgba(0, 0, 0, 0.05);
  --toast-radius: 12px;
  --main-blue: #3b82f6;
  --main-bg: #f8fafc;
  --border-color: #e2e8f0;
  --text-color: #334155;
  --light-text: #94a3b8;
  --card-padding: 32px;
  --btn-bg-light: #f1f5f9; /* 添加浅色按钮背景色 */
  --btn-bg-dark: #334155; /* 添加深色按钮背景色 */
  --btn-text-light: #334155; /* 浅色按钮文字颜色 */
  --btn-text-dark: #e2e8f0; /* 深色按钮文字颜色 */
  --toast-text: #1e293b; /* 消息框文本颜色 */
}

/* 暗色主题变量 */
[data-theme="dark"] {
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --primary-light: #1e40af;
  --secondary: #94a3b8;
  --bg-light: #0f172a;
  --card-bg: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --background-color: #0f172a;
  --container-background: #1e293b;
  --text-color: #e2e8f0;
  --drop-area-hover: #1e40af20;
  --file-item-hover: #1e293b;
  --file-icon-bg: #334155;
  --toast-bg: rgba(30, 41, 59, 0.95);
  --modal-backdrop: rgba(0, 0, 0, 0.8);
  --subtle-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  --toast-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.1);
  --toast-border: 1px solid rgba(255, 255, 255, 0.1);
  --info-color: #60a5fa;
  --success-color: #34d399;
  --warning-color: #fbbf24;
  --error-color: #f87171;
}

/* 确保文件输入框完全隐藏 */
input[type="file"] {
  display: none !important;
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  padding: 0;
  margin: -1px;
  border: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  min-height: 100vh;
  margin: 0;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.main-wrapper {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  overflow-y: auto;
  padding: 15px;
}

.upload-container {
  background: var(--container-background);
  border-radius: var(--radius);
  padding: 2.2rem 2rem;
  box-shadow: var(--shadow);
  transition: background-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  max-height: calc(100vh - 25px);
  border: 1px solid rgba(0,0,0,0.03);
}

.upload-container:hover {
  box-shadow: 0 15px 45px -5px rgba(0, 0, 0, 0.08), 0 10px 15px -6px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 1.5rem;
  width: 100%;
  padding: 0 3rem; /* 添加左右内边距，为主题切换按钮留出空间 */
}

.cloudflare-logo {
  width: 60px; /* 增大 logo 尺寸 */
  height: 93px; /* 保持宽高比 */
  cursor: pointer;
  transition: transform 0.3s ease;
}

.cloudflare-logo:hover {
  transform: scale(1.1);
}

[data-theme="dark"] .cloudflare-logo path {
  fill: #f6821f;
}

/* 修复主题切换按钮在移动端的显示问题 */
.theme-toggle-wrapper {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 100;
  transition: all 0.3s ease;
}

.theme-indicator {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--subtle-shadow);
  overflow: hidden;
}

.theme-indicator:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.theme-indicator:hover:after {
  opacity: 1;
}

.theme-indicator:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.theme-icon {
  width: 20px;
  height: 20px;
  color: var(--text);
  transition: all 0.3s ease;
}

/* 主题图标显示控制 */
.sun-icon {
  display: none;
}

[data-theme="light"] .sun-icon {
  display: block;
}

.moon-icon {
  display: none;
}

[data-theme="dark"] .moon-icon {
  display: block;
}

/* 主题切换动画 */
.theme-indicator:hover .theme-icon {
  transform: rotate(30deg);
}

/* 主题切换动画效果 */
.theme-switching {
  animation: theme-switch-pulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes theme-switch-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* 无障碍焦点样式 */
.theme-indicator:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 改进移动端主题按钮样式 */
@media (max-width: 768px) {
  .theme-toggle-wrapper {
    top: 12px;
    right: 12px;
  }
  
  .theme-indicator {
    width: 34px;
    height: 34px;
  }
  
  .theme-icon {
    width: 18px;
    height: 18px;
  }
  
  .drop-area {
    min-height: 240px;
    border-width: 1.5px;
  }
}

@media (max-width: 480px) {
  .theme-toggle-wrapper {
    top: 10px;
    right: 10px;
  }
  
  .theme-indicator {
    width: 30px;
    height: 30px;
  }
  
  .theme-icon {
    width: 16px;
    height: 16px;
  }
  
  .drop-area {
    min-height: 220px;
    border-width: 1px;
  }
}

/* 添加小屏幕横向布局支持 */
@media (max-height: 480px) and (orientation: landscape) {
  .logo-container {
    padding: 0 2rem;
    margin-bottom: 1rem;
  }
  
  .cloudflare-logo {
    width: 40px;
    height: 62px;
  }
  
  .theme-toggle-wrapper {
    top: 8px;
    right: 8px;
  }
  
  .theme-indicator {
    width: 28px;
    height: 28px;
  }
  
  .theme-icon {
    width: 14px;
    height: 14px;
  }
  
  .drop-area {
    min-height: 130px;
  }
}

.site-title {
  margin: 0;
  margin-bottom: 1.2rem;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--primary);
  transition: color var(--transition-speed) ease;
  text-align: center;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* 修改上传区域，移除动画效果 */
.drop-area {
  border: 2px dashed rgba(59, 130, 246, 0.3);
  border-radius: var(--radius);
  background: linear-gradient(to bottom, var(--container-background), var(--container-background)) padding-box,
              linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.18)) border-box;
  width: 100%;
  flex-grow: 1;
  min-height: 280px;
  position: relative;
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
  transition: border-color 0.3s ease; /* 仅保留边框颜色过渡 */
  overflow: hidden;
  box-shadow: none; /* 移除内阴影 */
}

.drop-area:hover {
  border-color: rgba(59, 130, 246, 0.6);
  background: linear-gradient(to bottom, var(--container-background), var(--container-background)) padding-box,
              linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.35)) border-box;
}

[data-theme="dark"] .drop-area:hover {
  border-color: rgba(96, 165, 250, 0.6);
  background: linear-gradient(to bottom, var(--container-background), var(--container-background)) padding-box,
              linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0.08)) border-box;
}

/* 上传提示区域样式 */
.upload-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background: var(--container-background);
  z-index: 1;
  transition: all 0.3s ease;
  font-size: calc(1.4vh + 0.6vw);
}

.upload-text.has-files {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-20px);
}

/* 调整上传图标，移除动画效果 */
.upload-icon {
  width: 85px;
  height: 85px;
  color: var(--primary);
  opacity: 0.8;
  margin-bottom: 20px;
  min-width: 60px;
  min-height: 60px;
  max-width: 120px;
  max-height: 120px;
  transition: none; /* 移除所有过渡效果 */
  filter: none; /* 移除阴影 */
}

.drop-area:hover .upload-icon {
  color: var(--primary);
  opacity: 0.9;
}

/* 调整上传提示文字尺寸，使其更合理 */
.upload-tip {
  font-size: 17px; /* 调整为固定尺寸 */
  color: var(--text-secondary);
  margin-bottom: 8px;
  min-height: 1.2em;
  transition: color var(--transition-speed) ease;
  max-width: 92%;
  font-weight: 400;
}

/* 调整上传按钮尺寸 */
.upload-action {
  color: #fff;
  background-color: var(--primary);
  font-size: 17px; /* 调整为固定尺寸 */
  font-weight: 500;
  cursor: pointer;
  padding: 10px 24px;
  border-radius: calc(var(--radius) - 0.4rem);
  transition: background-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease; /* 移除transform动画 */
  box-shadow: 0 2px 5px rgba(59, 130, 246, 0.2);
  margin-top: 16px;
}

.upload-action:hover {
  background-color: var(--primary-dark);
  /* 移除transform动画 */
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 修复按钮样式 */
.action-btn {
  position: relative;
  background-color: #f1f5f9; /* 明确设置浅色背景 */
  color: #334155; /* 深色文字 */
  border: 1px solid rgba(0,0,0,0.05); /* 添加边框 */
  border-radius: calc(var(--radius) - 0.2rem);
  padding: 0.95rem 1.7rem;
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* 添加阴影 */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  white-space: nowrap;
  min-width: 125px;
  overflow: hidden;
}

/* 黑暗模式下的按钮样式 */
[data-theme="dark"] .action-btn {
  background-color: #334155; /* 深色背景 */
  color: #e2e8f0; /* 浅色文字 */
  border-color: rgba(255,255,255,0.1);
}

.action-btn:hover {
  background-color: #e2e8f0; /* 悬停时背景更深 */
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

[data-theme="dark"] .action-btn:hover {
  background-color: #475569; /* 深色模式下悬停背景更亮 */
}

.action-btn.primary {
  background: var(--primary);
  color: white;
  font-weight: 600;
  border-color: transparent;
}

.action-btn.primary:hover {
  background: var(--primary-dark); /* 主要按钮悬停颜色更深 */
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

/* 适配移动设备 */
@media (max-width: 768px) {
  .upload-tip {
    font-size: 16px;
  }
  
  .upload-action {
    font-size: 16px;
  }
  
  .action-btn {
    background-color: #f1f5f9; /* 确保在移动设备上背景色一致 */
  }
  
  [data-theme="dark"] .action-btn {
    background-color: #334155;
  }
}

@media (max-width: 480px) {
  .upload-tip {
    font-size: 15px;
  }
  
  .upload-action {
    font-size: 15px;
  }
}

/* 文件列表样式 */
.file-list {
  padding-bottom: 2.5rem; /* 为提示条留出空间 */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 1rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  background: var(--container-background);
  height: 100%;
  max-height: none;
  display: block;
  margin-bottom: 0;
  border: none;
  scrollbar-width: thin;
  scrollbar-color: var(--text-secondary) var(--background-color);
  /* 确保滚动条在信息条上方可见 */
  padding-bottom: 3.5rem;
  box-sizing: border-box;
}

.file-list.has-files {
  opacity: 1;
  transform: translateY(0);
}

.file-list::-webkit-scrollbar {
  width: 8px;
}

.file-list::-webkit-scrollbar-track {
  background: var(--background-color);
}

.file-list::-webkit-scrollbar-thumb {
  background-color: var(--text-secondary);
  border-radius: 20px;
  border: 2px solid var(--background-color);
}

.file-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: background-color 0.2s, transform 0.2s;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.file-item:hover {
  background-color: var(--file-item-hover);
  transform: translateX(2px);
}

.file-item:last-child {
  border-bottom: none;
}

/* 移动端样式优化 */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }
  .main-wrapper {
    padding: 0;
    max-width: 100%;
    max-height: 100vh;
  }
  body {
    height: auto;
    min-height: 100%;
    padding: 8px;
  }
  .upload-container {
    padding: 1.8rem;
    border-radius: 0.75rem;
  }
  .file-list {
    height: 100%;
    max-height: none;
    min-height: auto;
  }
  .file-item {
    padding: 0.6rem;
  }
  .button-group {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.8rem;
    padding: 0 1rem;
    margin-top: 1rem;
    flex-shrink: 0; /* 防止按钮组被压缩 */
  }
  .action-btn {
    flex: 1;
    min-width: 110px;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    min-width: unset;
    height: 48px;
  }
  .action-btn svg {
    width: 18px;
    height: 18px;
    margin-right: 8px !important;
  }
  .upload-text {
    font-size: calc(1.4vh + 0.5vw);
    padding: 1.5rem;
  }
  .upload-icon {
    width: calc(7vh + 1.8vw);
    height: calc(7vh + 1.8vw);
    margin-bottom: calc(1.5vh + 0.4vw);
  }
  .upload-tip {
    font-size: calc(1.2vh + 0.4vw);
    margin-bottom: calc(0.8vh + 0.2vw);
  }
  .upload-action {
    font-size: calc(1.1vh + 0.3vw);
    padding: calc(0.6vh + 0.2vw) calc(1.2vh + 0.3vw);
  }
  .file-name {
    font-size: 0.9rem;
    line-height: 1.3;
  }
  .file-info {
    margin-right: 0.4rem;
  }
  .drop-area {
    min-height: 240px;
    border-width: 1.5px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  .upload-container {
    padding: 1.4rem;
    border-radius: 0.75rem;
  }
  .drop-area {
    min-height: 220px;
    padding: 1.25rem 0.6rem;
    border-width: 1px;
  }
  .file-list {
    height: 100%;
    max-height: none;
    padding: 0.8rem;
  }
  .file-item {
    padding: 0.6rem;
    gap: 0.5rem;
  }
  .button-group {
    flex-direction: column;
    gap: 0.7rem;
    padding: 0 0.5rem;
    margin-top: 0.8rem;
  }
  .action-btn {
    padding: calc(0.5vh + 0.1vw) calc(1vh + 0.2vw);
    font-size: 0.95rem;
    height: 44px;
    border-radius: calc(var(--radius) * 0.8);
  }
  .action-btn svg {
    width: 16px;
    height: 16px;
    margin-right: 6px !important;
  }
  .action-btn.cancel {
    height: 40px;
    background-color: transparent;
    border: 2px solid var(--border);
  }
  .upload-text {
    font-size: calc(1.2vh + 0.4vw);
    padding: 1rem;
  }
  .upload-icon {
    width: calc(6vh + 1.5vw);
    height: calc(6vh + 1.5vw);
    margin-bottom: calc(1.2vh + 0.3vw);
  }
  .upload-tip {
    font-size: clamp(0.9rem, 1.1vh + 0.3vw, 1rem);
    margin-bottom: calc(0.6vh + 0.2vw);
  }
  .upload-action {
    font-size: clamp(0.75rem, 1vh + 0.3vw, 0.9rem);
    padding: calc(0.5vh + 0.1vw) calc(1vh + 0.2vw);
  }
  .more-files-info {
    padding: 0.4rem;
    font-size: 0.8rem;
  }
  .file-name {
    font-size: 0.85rem;
    line-height: 1.2;
  }
  .file-info {
    margin-right: 0.3rem;
  }
  .file-size {
    font-size: 0.75rem;
  }
  .delete-btn {
    padding: 0.2rem;
    width: 24px;
    height: 24px;
    min-width: 24px;
  }
  
  /* 错误提示的移动端适配 */
  #result {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    pointer-events: none;
  }
  
  #result.visible {
    pointer-events: auto;
  }

  /* 清除可能影响的样式 */
  #result::before,
  #result::after {
    display: none !important;
  }
  
  .message-container {
    padding: 12px;
    border-radius: 6px;
  }
  
  .message-title {
    font-size: 0.9rem;
  }
  
  .message-details,
  .message-solution {
    font-size: 0.8rem;
  }
  
  .message-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
  }
  
  .message-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .message-close {
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .button-group {
    gap: 0.5rem;
    padding: 0 0.4rem;
  }
  .action-btn {
    padding: 0.7rem;
    font-size: 0.9rem;
    height: 40px;
  }
  .action-btn svg {
    width: 14px;
    height: 14px;
    margin-right: 4px !important;
  }
  .action-btn.cancel {
    height: 36px;
  }
  .file-name {
    font-size: 0.8rem;
  }
  .file-size {
    font-size: 0.7rem;
  }
  .file-item {
    padding: 0.5rem;
    gap: 0.4rem;
  }
}

@media (max-height: 480px) and (orientation: landscape) {
  .button-group {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0;
    margin-top: 0.8rem;
  }
  .action-btn {
    flex: 1;
    min-width: 120px;
    max-width: calc(50% - 0.3rem);
    height: 40px;
    padding: 0.6rem;
  }
}

.file-select {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 500;
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 0.3rem;
  transition: background-color var(--transition-speed), color var(--transition-speed);
  text-align: center;
}

.file-select:hover {
  background-color: var(--file-item-hover);
  color: var(--primary-dark);
}

.file-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

#fileInput {
  display: none;
}

.button-group {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
  margin-bottom: 1.2rem;
}

.action-btn:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.action-btn:hover:after {
  opacity: 1;
}

.action-btn.primary {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.action-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.action-btn:active {
  transform: translateY(1px);
}

.action-btn.cancel {
  background-color: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  border: 1px solid var(--border);
}

.action-btn.cancel:hover {
  background-color: var(--bg-light);
  color: var(--text-color);
  border-color: var(--text-secondary);
}

.file-icon {
  width: 42px;
  height: 42px;
  margin-right: 1rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--file-icon-bg);
  border-radius: 6px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.7rem;
  overflow: hidden;
  position: relative;
  box-shadow: var(--subtle-shadow);
}

.file-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  max-width: 100%;
  max-height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.file-icon .file-ext {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-info {
  flex-grow: 1;
  overflow: hidden;
  min-width: 0; /* 确保flex子项可以正确收缩 */
  margin-right: 0.5rem;
}

.file-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--text-color);
}

.file-size {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.delete-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: 0.8rem;
  opacity: 0.8;
}

.delete-btn:hover {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--danger-color);
  opacity: 1;
  transform: scale(1.1);
}

.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background-color: var(--primary);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 0 4px 4px 0;
}

/* 消息通知容器样式 - 自适应位置 */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 420px;
  width: auto;
  z-index: 9999;
  pointer-events: none;
  transition: all 0.3s ease;
}

.toast-container * {
  pointer-events: auto;
}

.toast-container[data-position="top"] {
  top: 20px;
  bottom: auto;
}

.toast-container[data-position="bottom"] {
  bottom: 20px;
  top: auto;
}

/* 改进消息容器布局 */
.message-container {
  background-color: var(--toast-bg);
  color: var(--toast-text);
  border-radius: var(--toast-radius, 12px);
  padding: 14px 14px 14px 16px; /* 左侧留出更多空间 */
  margin: 0 0 10px 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-left: 4px solid transparent; 
  display: flex;
  align-items: flex-start;
  position: relative;
  max-width: 100%;
  width: 100%;
  min-width: 280px;
    opacity: 0;
  transform: translateY(20px);
  transition: 
    opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    margin 0.3s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05), 0 0 1px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  overflow: hidden;
  pointer-events: auto;
  z-index: 9999;
}

/* 优化图标对齐方式 */
.message-icon {
  margin-right: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px; /* 稍微增大图标尺寸 */
  height: 22px;
  border-radius: 50%;
  align-self: flex-start;
  margin-top: 1px; /* 微调顶部对齐 */
  position: relative;
  transition: transform 0.2s ease;
}

/* 改进单行消息的图标对齐 */
.message-container .message-content > .message-title:only-child + .message-icon {
  align-self: center;
}

/* 优化图标SVG尺寸和位置 */
.message-icon svg {
  display: block;
  vertical-align: middle;
  margin: auto;
  width: 15px; /* 调整SVG尺寸 */
  height: 15px;
  stroke-width: 2.5px;
  position: relative;
  z-index: 1;
}

/* 改进消息内容与图标的对齐 */
.message-content {
  flex: 1;
  min-width: 0;
  padding-right: 25px;
  display: flex;
  flex-direction: column;
  justify-content: center; /* 在垂直方向上居中内容 */
  min-height: 22px; /* 确保至少与图标一样高 */
}

/* 单行内容优化 */
.message-container .message-content > .message-title:only-child {
  margin-bottom: 0;
  line-height: 1.4;
  padding-top: 0;
}

/* 消息容器动画效果 */
.message-container.show {
    opacity: 1;
    transform: translateY(0);
  animation: message-show 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* 消息显示动画 */
@keyframes message-show {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 消息淡出效果 */
.message-container.fade-out {
  opacity: 0 !important;
  transform: translateY(-10px) !important;
  transition: opacity 0.2s ease-in, transform 0.2s ease-in !important;
}

/* 不同类型消息的样式加强 */
.message-container.success-message {
  border-left-color: #10b981;
  background-color: rgba(16, 185, 129, 0.04);
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.08), 0 0 1px rgba(16, 185, 129, 0.2);
  }

.message-container.error-message {
  border-left-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.04);
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.08), 0 0 1px rgba(239, 68, 68, 0.2);
}

.message-container.warning-message {
  border-left-color: #f59e0b;
  background-color: rgba(245, 158, 11, 0.04);
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.08), 0 0 1px rgba(245, 158, 11, 0.2);
}

.message-container.info-message {
  border-left-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.04);
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.08), 0 0 1px rgba(59, 130, 246, 0.2);
}

/* 相邻消息样式 - 同类型相邻消息边框圆角连接 */
.message-container + .message-container[data-type="error"] {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.message-container[data-type="error"] + .message-container[data-type="error"] {
  border-top-left-radius: 3px;
  margin-top: -6px;
  }

.message-container[data-type="success"] + .message-container[data-type="success"] {
  border-top-left-radius: 3px;
  margin-top: -6px;
    }

.message-container[data-type="warning"] + .message-container[data-type="warning"] {
  border-top-left-radius: 3px;
  margin-top: -6px;
    }

.message-container[data-type="info"] + .message-container[data-type="info"] {
  border-top-left-radius: 3px;
  margin-top: -6px;
}

/* 类型分隔线 */
.message-container[data-type]:not(:first-child):not([data-grouped]) {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 16px;
}

[data-theme="dark"] .message-container[data-type]:not(:first-child):not([data-grouped]) {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* 消息高亮/闪烁效果 */
@keyframes message-flash {
  0% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
  25% { box-shadow: 0 0 0 2px var(--info-color); }
  50% { box-shadow: 0 0 10px 2px var(--info-color); }
  100% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
}

.message-container.message-highlight {
  animation: message-flash 1s ease-out;
  }

.message-container.error-message.message-highlight {
  animation-name: message-flash-error;
}

.message-container.warning-message.message-highlight {
  animation-name: message-flash-warning;
}

.message-container.success-message.message-highlight {
  animation-name: message-flash-success;
}

@keyframes message-flash-error {
  0% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
  25% { box-shadow: 0 0 0 2px var(--error-color); }
  50% { box-shadow: 0 0 10px 2px var(--error-color); }
  100% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
}

@keyframes message-flash-warning {
  0% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
  25% { box-shadow: 0 0 0 2px var(--warning-color); }
  50% { box-shadow: 0 0 10px 2px var(--warning-color); }
  100% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
}

@keyframes message-flash-success {
  0% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
  25% { box-shadow: 0 0 0 2px var(--success-color); }
  50% { box-shadow: 0 0 10px 2px var(--success-color); }
  100% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
}

/* 强制移除消息的过渡效果，用于紧急移除 */
.force-remove {
  transition: none !important;
  display: none !important;
  opacity: 0 !important;
  transform: translateY(-20px) !important;
}

/* 暗色模式优化 */
[data-theme="dark"] .message-container {
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2), 0 0 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .message-title {
  color: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .message-details,
[data-theme="dark"] .message-solution {
  color: rgba(255, 255, 255, 0.75);
}

[data-theme="dark"] .message-solution {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* 富文本消息内容排版 */
.message-details a,
.message-solution a {
  color: var(--main-blue);
  text-decoration: none;
  border-bottom: 1px dotted;
  transition: border-bottom 0.2s, opacity 0.2s;
}

.message-details a:hover,
.message-solution a:hover {
  border-bottom: 1px solid;
  opacity: 0.9;
}

[data-theme="dark"] .message-details a,
[data-theme="dark"] .message-solution a {
  color: #60a5fa;
}

/* 列表样式优化 */
.message-details ul,
.message-solution ul {
  margin: 4px 0;
  padding-left: 20px;
}

.message-details ul li,
.message-solution ul li {
  margin-bottom: 2px;
}

/* 支持简单表格 */
.message-details table,
.message-solution table {
  border-collapse: collapse;
  margin: 5px 0;
  font-size: 12px;
  width: 100%;
}

.message-details table th,
.message-details table td,
.message-solution table th,
.message-solution table td {
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 4px 6px;
  text-align: left;
}

[data-theme="dark"] .message-details table th,
[data-theme="dark"] .message-details table td,
[data-theme="dark"] .message-solution table th,
[data-theme="dark"] .message-solution table td {
  border-color: rgba(255, 255, 255, 0.1);
}

/* 代码片段样式 */
.message-details code,
.message-solution code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 90%;
}

[data-theme="dark"] .message-details code,
[data-theme="dark"] .message-solution code {
  background: rgba(255, 255, 255, 0.1);
}

/* 移动设备适配优化 */
@media (max-width: 768px) {
  .toast-container {
    right: 16px;
    max-width: 380px;
}

  .message-container {
    padding: 14px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    margin-bottom: 8px;
}

  .message-icon {
    width: 22px;
    height: 22px;
    margin-right: 10px;
}

  .message-title {
    font-size: 14px;
}

  .message-details, 
  .message-solution {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .toast-container {
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    align-items: stretch;
  }
  
  .message-container {
    padding: 12px;
    border-radius: 10px;
    border-left-width: 3px;
    width: 100%;
    min-width: 0;
    margin-bottom: 6px;
}

  .message-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

  .message-close {
    width: 20px;
    height: 20px;
    font-size: 16px;
    top: 8px;
    right: 8px;
  }
  
  .message-content {
    padding-right: 20px;
  }
}

/* 添加移动端安全区域适配 */
@supports (-webkit-touch-callout: none) {
  @media (orientation: portrait) {
    .toast-container {
      bottom: max(20px, env(safe-area-inset-bottom, 20px));
      right: max(12px, env(safe-area-inset-right, 12px));
      left: max(12px, env(safe-area-inset-left, 12px));
    }
  }
}

/* 确保通知在模态窗口上方显示 */
.modal-open .toast-container {
  z-index: 10002; /* 高于模态窗口 */
}

/* 定义不同颜色主题的动画效果 */
.message-container.warning-message.show {
  animation-name: message-show-warning;
}

.message-container.success-message.show {
  animation-name: message-show-success;
}

.message-container.error-message.show {
  animation-name: message-show-error;
}

@keyframes message-show-warning {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(245, 158, 11, 0.1), 0 0 1px rgba(245, 158, 11, 0.2);
}
}

@keyframes message-show-success {
  0% {
    opacity: 0;
    transform: translateY(20px);
}
  100% {
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(16, 185, 129, 0.1), 0 0 1px rgba(16, 185, 129, 0.2);
}
}

@keyframes message-show-error {
  0% {
    opacity: 0;
    transform: translateY(20px);
}
  100% {
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.1), 0 0 1px rgba(239, 68, 68, 0.2);
  }
}

/* 消息内容样式 */
.message-content {
  flex: 1;
  min-width: 0;
  padding-right: 25px; /* 为关闭按钮留出更多空间 */
  display: flex;
  flex-direction: column;
}

/* 消息标题样式优化 */
.message-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-color);
  word-wrap: break-word;
  word-break: break-word;
  padding-top: 0; /* 调整顶部填充 */
  letter-spacing: -0.01em; /* 轻微调整字间距 */
}

/* 单行内容消息时的特殊样式 */
.message-container .message-content > .message-title:only-child {
  margin-bottom: 0;
  line-height: 1.5;
  padding-top: 3px; /* 单行时垂直居中调整 */
}

/* 消息详情样式 */
.message-details {
  font-size: 13px;
  line-height: 1.5;
  color: var(--light-text);
  margin-bottom: 4px;
  word-wrap: break-word;
  word-break: break-word;
  margin-top: 2px;
  opacity: 0.85;
  max-width: 100%; /* 确保不会溢出 */
}

/* 消息解决方案样式 */
.message-solution {
  font-size: 13px;
  line-height: 1.5;
  color: var(--light-text);
  word-wrap: break-word;
  word-break: break-word;
  border-top: 1px solid rgba(0,0,0,0.05);
  margin-top: 6px;
  padding-top: 6px;
  opacity: 0.85;
  max-width: 100%; /* 确保不会溢出 */
}

/* 消息行间距优化 */
.message-details p,
.message-solution p {
  margin: 0 0 3px 0;
}

.message-details p:last-child,
.message-solution p:last-child {
  margin-bottom: 0;
}

/* 消息关闭按钮优化 */
.message-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--light-text);
  background: transparent;
  border: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.45; /* 降低默认不透明度 */
  transition: all 0.2s;
  padding: 0;
  border-radius: 50%;
  z-index: 2; /* 确保按钮可点击 */
  touch-action: manipulation; /* 优化移动端触摸体验 */
}

.message-close:hover {
  opacity: 0.85;
  background-color: rgba(0, 0, 0, 0.06);
  transform: scale(1.1);
}

[data-theme="dark"] .message-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* 多消息定位优化 */
.message-container + .message-container {
  margin-top: 8px; /* 消息之间的间距 */
}

/* 成功消息特殊样式 */
.message-container.success-message .message-close {
  color: rgba(16, 185, 129, 0.8); 
}

/* 警告消息特殊样式 */
.message-container.warning-message .message-close {
  color: rgba(245, 158, 11, 0.8);
}

/* 错误消息特殊样式 */
.message-container.error-message .message-close {
  color: rgba(239, 68, 68, 0.8);
}

/* 消息图标SVG优化 */
.message-icon svg {
  display: block;
  vertical-align: middle;
  margin: auto;
  width: 16px;
  height: 16px;
  stroke-width: 2.5px; /* 加粗描边 */
  position: relative;
  z-index: 1;
}

/* 平板设备优化 */
@media (max-width: 768px) and (min-width: 481px) {
  .toast-container {
    right: 16px;
    max-width: 360px;
  }
  
  .message-container {
    padding: 13px 13px 13px 15px;
  }
  
  .message-icon {
    width: 21px;
    height: 21px;
    margin-right: 11px;
  }
  
  .message-icon svg {
    width: 14px;
    height: 14px;
  }
  
  .message-title {
    font-size: 14px;
    line-height: 1.4;
  }
  
  .message-content {
    min-height: 21px;
  }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
  .toast-container {
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
  }
  
  .message-container {
    padding: 12px 12px 12px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
  }
  
  .message-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
  }
  
  .message-icon svg {
    width: 13px;
    height: 13px;
  }
  
  .message-content {
    padding-right: 20px;
    min-height: 20px;
  }
  
  .message-title {
    font-size: 13.5px;
  }
  
  .message-details, 
  .message-solution {
    font-size: 12px;
    line-height: 1.4;
  }
  
  .message-close {
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    font-size: 14px;
  }
}

/* 极小屏幕设备优化 (iPhone SE等) */
@media (max-width: 375px) {
  .toast-container {
    right: 8px;
    left: 8px;
  }
  
  .message-container {
    padding: 11px 11px 11px 13px;
    border-radius: 8px;
    margin-bottom: 6px;
    min-width: 0;
  }
  
  .message-icon {
    width: 18px;
    height: 18px;
    margin-right: 9px;
  }
  
  .message-icon svg {
    width: 12px;
    height: 12px;
  }
  
  .message-content {
    padding-right: 18px;
    min-height: 18px;
  }
  
  .message-title {
    font-size: 13px;
  }
  
  .message-details, 
  .message-solution {
    font-size: 11px;
  }
}

/* 处理横屏模式 */
@media (orientation: landscape) and (max-height: 480px) {
  .toast-container {
    max-width: 320px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    right: 10px;
    bottom: 10px;
  }
  
  .message-container {
    padding: 12px 12px 12px 14px;
    margin-bottom: 6px;
  }
  
  .message-icon {
    width: 20px;
    height: 20px;
  }
  
  .message-title {
    font-size: 13px;
  }
}

/* 提高交互性和可访问性 */
.message-container:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* 鼠标悬停效果 */
.message-container:hover {
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

[data-theme="dark"] .message-container:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25), 0 0 2px rgba(0, 0, 0, 0.3);
}

/* 根据消息类型增强悬停效果 */
.message-container.success-message:hover {
  box-shadow: 0 5px 12px rgba(16, 185, 129, 0.08), 0 0 1px rgba(16, 185, 129, 0.2);
}

.message-container.warning-message:hover {
  box-shadow: 0 5px 12px rgba(245, 158, 11, 0.08), 0 0 1px rgba(245, 158, 11, 0.2);
}

.message-container.error-message:hover {
  box-shadow: 0 5px 12px rgba(239, 68, 68, 0.08), 0 0 1px rgba(239, 68, 68, 0.2);
}

.message-container.info-message:hover {
  box-shadow: 0 5px 12px rgba(59, 130, 246, 0.08), 0 0 1px rgba(59, 130, 246, 0.2);
}

/* 优化触摸交互 */
@media (hover: none) and (pointer: coarse) {
  /* 移动设备触摸优化 */
  .message-close {
    opacity: 0.6; /* 默认更容易看到 */
    padding: 4px; /* 增大点击区域 */
    margin: -4px; /* 补偿增大的内边距 */
    touch-action: manipulation;
  }
  
  .message-container {
    touch-action: manipulation;
  }
}

/* 屏幕阅读器优化 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* 高对比度模式支持 */
@media (forced-colors: active) {
  .message-container {
    border: 1px solid CanvasText;
  }
  
  .message-icon, 
  .message-close {
    border: 1px solid CanvasText;
  }
}

/* 自定义加载动画 */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
}

.message-loading {
  animation: pulse 1.5s infinite ease-in-out;
}

/* 图片预览模态框样式 */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none; /* 禁用浏览器默认触摸行为 */
}

.modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.image-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  will-change: transform; /* 优化性能 */
}

.close-button {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s;
  z-index: 1001;
}

.close-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 添加移动设备支持 */
@media (max-width: 768px) {
  .close-button {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
}



