/* 全局样式 - Element UI 风格 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #409EFF;
  --primary-light: #66b1ff;
  --primary-dark: #3a8ee6;
  --success: #67c23a;
  --warning: #e6a23c;
  --danger: #f56c6c;
  --info: #909399;
  --text-primary: #303133;
  --text-regular: #606266;
  --text-secondary: #909399;
  --border-base: #dcdfe6;
  --border-light: #e4e7ed;
  --background: #f5f7fa;
  --background-white: #ffffff;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 4px;
  --radius-lg: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--background);
  line-height: 1.5;
}

/* 登录页 */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.login-title {
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 13px;
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 15px;
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
}

.form-input.error {
  border-color: var(--danger);
}

.form-group {
  margin-bottom: 20px;
}

.error-msg {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  min-height: 18px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 0 16px;
  border: 1px solid var(--border-base);
  background: white;
  color: var(--text-regular);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  user-select: none;
  white-space: nowrap;
}

.btn:hover {
  color: var(--primary);
  border-color: var(--primary-light);
  background: #ecf5ff;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: white;
}

.btn-danger {
  color: var(--danger);
  border-color: #fbc4c4;
  background: #fef0f0;
}

.btn-danger:hover {
  color: white;
  background: var(--danger);
  border-color: var(--danger);
}

.btn-text {
  border: none;
  background: transparent;
  color: var(--primary);
  padding: 0 8px;
  height: auto;
}

.btn-text:hover {
  background: transparent;
  color: var(--primary-light);
}

.btn-text.danger {
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
}

.btn-sm {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 头部 */
.header {
  background: white;
  border-bottom: 1px solid var(--border-light);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.storage-info {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.storage-bar {
  width: 100px;
  height: 6px;
  background: var(--background);
  border-radius: 3px;
  overflow: hidden;
}

.storage-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s, background 0.3s;
}

.storage-bar-fill.warn { background: var(--warning); }
.storage-bar-fill.danger { background: var(--danger); }

/* 主容器 */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* 上传区 */
.upload-zone {
  background: white;
  border: 2px dashed var(--border-base);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: #ecf5ff;
}

.upload-zone.compact {
  padding: 16px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 16px;
}

.upload-icon {
  font-size: 48px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.upload-text {
  font-size: 14px;
  color: var(--text-regular);
}

.upload-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* 工具栏 */
.toolbar {
  background: white;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-base);
  background: white;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-regular);
  transition: all 0.2s;
}

.filter-btn:hover {
  color: var(--primary);
  border-color: var(--primary-light);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-count {
  color: var(--text-secondary);
  font-size: 13px;
}

/* 文件列表 */
.file-list {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.file-header,
.file-row {
  display: grid;
  grid-template-columns: 40px 60px 1fr 120px 140px 100px 200px;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

.file-header {
  background: #fafafa;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.file-row {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}

.file-row:hover {
  background: #f5f7fa;
}

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

.file-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.file-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-weight: 600;
  overflow: hidden;
  background: var(--info);
}

.file-icon.image {
  background: transparent;
  padding: 0;
}

.file-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}

.file-icon .file-ext {
  font-size: 10px;
  text-transform: uppercase;
  color: white;
  letter-spacing: 0.5px;
}

.file-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.file-size,
.file-time,
.file-device {
  font-size: 13px;
  color: var(--text-secondary);
}

.file-device {
  font-size: 12px;
}

.file-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

/* 上传进度列表 */
.upload-progress-list {
  background: white;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.upload-progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.upload-progress-name {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-bar {
  width: 200px;
  height: 6px;
  background: var(--background);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-bar-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.2s;
}

.upload-progress-bar-fill.error {
  background: var(--danger);
}

.upload-progress-percent {
  width: 50px;
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Toast 消息 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.3s;
  max-width: 80%;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.toast.warning { background: var(--warning); }

@keyframes slideDown {
  from { transform: translate(-50%, -100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  background: none;
  border: none;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 响应式 */
@media (max-width: 1000px) {
  .file-header,
  .file-row {
    grid-template-columns: 40px 50px 1fr 100px 140px 100px;
  }
  .file-device { display: none; }
  .file-header .col-device { display: none; }
}

@media (max-width: 700px) {
  .file-header,
  .file-row {
    grid-template-columns: 40px 50px 1fr 100px 160px;
  }
  .file-time { display: none; }
  .file-header .col-time { display: none; }
}

@media (max-width: 500px) {
  .file-header,
  .file-row {
    grid-template-columns: 40px 1fr 80px 100px;
  }
  .file-icon-col { display: none; }
  .file-header .col-icon { display: none; }
  .header { padding: 12px 16px; }
  .main { padding: 12px; }
  .storage-info .storage-text { display: none; }
}

/* 加载动画 */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}
