/* 全局样式 */
:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --success-color: #10b981;
  --success-dark: #059669;
  --danger-color: #ef4444;
  --danger-dark: #dc2626;
  --warning-color: #f59e0b;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-light: #9ca3af;
  --background-light: #f9fafb;
  --background-white: #ffffff;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.375rem;
  --border-radius-lg: 0.5rem;
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--background-light);
}

/* 通用组件样式 */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  transition: all var(--transition-fast);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

input, textarea {
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

input:focus, textarea:focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 导航栏样式 */
nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

nav.scrolled {
  box-shadow: var(--shadow-md);
}

/* 文件上传区域样式 */
#dropZone {
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

#dropZone.active {
  border-color: var(--primary-color);
  background-color: rgba(37, 99, 235, 0.05);
}

#dropZone:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* 文件列表项样式 */
.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background-color: var(--background-light);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.file-item:hover {
  background-color: rgba(37, 99, 235, 0.05);
  border-color: var(--primary-light);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-grow: 1;
}

.file-icon {
  font-size: 1.5rem;
  color: var(--primary-light);
}

.file-details {
  flex-grow: 1;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.remove-file {
  color: var(--danger-color);
  background: none;
  border: none;
  padding: 0.25rem;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.remove-file:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-dark);
}

/* 进度条样式 */
#transferProgress {
  animation: fadeIn var(--transition-normal);
}

#progressBar {
  transition: width var(--transition-normal);
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  animation: progressAnimation 2s infinite linear;
  background-size: 200% 100%;
}

@keyframes progressAnimation {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* 复选框样式 */
input[type="checkbox"] {
  accent-color: var(--primary-color);
  width: 1rem;
  height: 1rem;
}

/* 提示信息样式 */
#toast {
  z-index: 2000;
  animation: slideIn var(--transition-normal), fadeIn var(--transition-normal);
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 链接容器样式 */
#fileLinkContainer,
#textLinkContainer {
  animation: fadeIn var(--transition-normal);
}

/* 响应式样式调整 */
@media (max-width: 768px) {
  .container {
    padding: 0 0.75rem;
  }
  
  h1 {
    font-size: 1.25rem !important;
  }
  
  h2 {
    font-size: 1.5rem !important;
  }
  
  .file-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .file-info {
    width: 100%;
  }
  
  .file-details {
    min-width: 0;
  }
  
  #dropZone {
    padding: 4rem 1rem;
  }
  
  .fa-cloud-upload {
    font-size: 3rem !important;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.5rem;
  }
  
  main {
    padding: 1rem 0.5rem;
  }
  
  section {
    padding: 1.5rem !important;
  }
  
  #dropZone {
    padding: 3rem 0.75rem;
  }
  
  .fa-cloud-upload {
    font-size: 2.5rem !important;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-light: #9ca3af;
    --background-light: #111827;
    --background-white: #1f2937;
    --border-color: #374151;
  }
  
  nav {
    background-color: #1e3a8a;
  }
  
  #mobileMenu {
    background-color: #1e40af;
  }
  
  footer {
    background-color: #111827;
  }
  
  .file-item {
    background-color: #1f2937;
  }
  
  #fileLinkContainer,
  #textLinkContainer {
    background-color: #1f2937;
  }
  
  input,
  textarea {
    background-color: #374151;
    color: #f3f4f6;
  }
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 平滑过渡效果 */
section {
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 工具提示 */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-primary);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 100;
}

.tooltip:hover::after {
  opacity: 1;
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 打印样式 */
@media print {
  nav,
  footer,
  #toast,
  button {
    display: none !important;
  }
  
  body {
    background-color: white;
    color: black;
  }
  
  section {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}