 /* EdgeOne Drive - 网盘 + 图床样式 */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #e0e7ff;
  --primary-glow: rgba(79, 70, 229, 0.15);
  --secondary: #64748b;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-elevated: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --top-bar-height: 68px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html { 
  -webkit-text-size-adjust: 100%; 
  -webkit-tap-highlight-color: transparent;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

#app {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-header {
  padding: 24px 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.logo i {
  font-size: 32px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1 1 auto;
  padding: 16px 12px;
  overflow-x: hidden;
  min-height: 0;
  /* 允许内容区域在需要时滚动 */
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-label {
  display: block;
  padding: 0 12px;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
  transition: height 0.3s ease;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active::before {
  height: 60%;
}

.nav-item i {
  font-size: 20px;
  min-width: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}

.nav-item:hover i {
  transform: scale(1.1);
}

.nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
  background: linear-gradient(180deg, transparent, rgba(79, 70, 229, 0.03));
  flex-shrink: 0;
}

.storage-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.storage-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.storage-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.storage-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  border-radius: 4px;
}

.storage-text {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  margin-left: var(--sidebar-width);
}

/* ===== 顶部栏 ===== */
.top-bar {
  height: var(--top-bar-height);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: relative;
  z-index: 100;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius);
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.breadcrumb-item {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  font-weight: 500;
  position: relative;
}

.breadcrumb-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.breadcrumb-item:not(:last-child)::after {
  content: "/";
  margin-left: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.breadcrumb-item:last-child {
  color: var(--text);
  font-weight: 700;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.search-box input {
  width: 260px;
  padding: 10px 14px 10px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg);
  transition: var(--transition);
  color: var(--text);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: var(--surface);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #4f46e5);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

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

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #f87171);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--primary-light);
  transform: translateY(-1px);
}

.icon-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ===== 内容区域 ===== */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px;
  -webkit-overflow-scrolling: touch;
}

.view {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
  display: block;
}

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

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.view-title h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.file-count {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.view-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== 文件网格 ===== */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.file-grid.list-view {
  grid-template-columns: 1fr;
  gap: 8px;
  flex-grow: 0;
}

.file-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition-bounce);
  position: relative;
  user-select: none;
  overflow: hidden;
}

.file-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(79, 70, 229, 0.03) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.file-item:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
  transform: translateY(-3px);
}

.file-item:hover::before {
  opacity: 1;
}

.file-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-lg);
}

.file-item .file-icon {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--bg), var(--surface-hover));
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
}

.file-item .file-icon i {
  font-size: 52px;
  color: var(--primary);
  opacity: 0.8;
  transition: transform 0.3s ease;
}

.file-item:hover .file-icon i {
  transform: scale(1.05);
}

.file-item .file-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-item:hover .file-icon img {
  transform: scale(1.08);
}

.file-item .file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.file-item .file-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.file-item .file-checkbox {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  transition: var(--transition);
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.file-item.selected .file-checkbox {
  display: flex;
  background: var(--primary);
  border-color: var(--primary);
}

.file-item:hover .file-checkbox {
  display: flex;
}

.file-item .file-checkbox:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* 列表视图样式 */
.file-grid.list-view .file-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-radius: var(--radius);
}

.file-grid.list-view .file-icon {
  width: 44px;
  height: 44px;
  aspect-ratio: auto;
  margin-bottom: 0;
  flex-shrink: 0;
}

.file-grid.list-view .file-icon i {
  font-size: 24px;
}

.file-grid.list-view .file-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.file-grid.list-view .file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0;
}

.file-grid.list-view .file-meta {
  margin-top: 0;
  width: 120px;
  text-align: right;
  flex-shrink: 0;
  font-size: 12px;
}

/* ===== 图片画廊 ===== */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  border: 1.5px solid var(--border);
  transition: var(--transition-bounce);
}

.image-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-light);
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-item:hover img {
  transform: scale(1.08);
}

.image-item .image-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 16px 16px;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.85));
  color: white;
  opacity: 0;
  transition: opacity 0.35s ease;
  backdrop-filter: blur(2px);
}

.image-item:hover .image-overlay {
  opacity: 1;
}

.image-item .image-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 10px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.image-item .image-actions {
  display: flex;
  gap: 8px;
}

.image-item .image-actions button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  font-size: 15px;
}

.image-item .image-actions button:hover {
  background: rgba(255,255,255,0.35);
  transform: translateY(-2px);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 100px 20px;
  color: var(--text-muted);
  animation: fadeIn 0.5s ease;
}

.empty-state i {
  font-size: 72px;
  margin-bottom: 20px;
  opacity: 0.4;
  display: block;
}

.empty-state p {
  font-size: 17px;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state .hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.empty-state .btn {
  margin-top: 8px;
}

/* ===== 统计面板 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.stat-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ===== 设置面板 ===== */
.settings-panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 640px;
  box-shadow: var(--shadow-sm);
}

.setting-group {
  margin-bottom: 28px;
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-group h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-item {
  margin-bottom: 18px;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-item label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.setting-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-inputs input {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg);
  transition: var(--transition);
  color: var(--text);
  font-family: inherit;
}

.setting-inputs input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: var(--surface);
}

.setting-inputs input::placeholder {
  color: var(--text-muted);
}

/* ===== 模态框 ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border);
}

.modal-large {
  max-width: 960px;
}

.modal-small {
  max-width: 420px;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, var(--surface), var(--bg));
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 18px;
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
  transform: rotate(90deg);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

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

/* ===== 上传区域 ===== */
.upload-dropzone {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-bounce);
  background: linear-gradient(135deg, var(--bg), var(--surface));
  position: relative;
  overflow: hidden;
}

.upload-dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-glow), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.01);
}

.upload-dropzone:hover::before,
.upload-dropzone.dragover::before {
  opacity: 1;
}

.upload-dropzone i {
  font-size: 56px;
  color: var(--primary);
  margin-bottom: 16px;
  display: block;
  opacity: 0.8;
  transition: transform 0.3s ease;
}

.upload-dropzone:hover i {
  transform: translateY(-4px);
}

.upload-dropzone p {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.upload-dropzone .hint {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.upload-list {
  margin-top: 20px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 10px;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.upload-item:hover {
  border-color: var(--primary-light);
  background: var(--surface);
}

.upload-item .upload-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-light), var(--surface));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 18px;
  flex-shrink: 0;
}

.upload-item .upload-info {
  flex: 1;
  min-width: 0;
}

.upload-item .upload-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item .upload-size {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.upload-item .upload-progress {
  width: 80px;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.upload-item .upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.upload-item .upload-progress-bar::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 15px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
  border-radius: 3px;
}

.upload-item .upload-status {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 50px;
  text-align: right;
}

/* ===== 预览 ===== */
.preview-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  background: linear-gradient(135deg, var(--bg), var(--surface-hover));
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.preview-container img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.preview-info {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid var(--border-light);
}

.preview-info .info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}

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

.preview-info .info-label {
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
  margin-right: 16px;
}

.preview-info .info-value {
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  color: var(--text);
  text-align: right;
  word-break: break-all;
  font-size: 12px;
}

/* ===== 右键菜单 ===== */
.context-menu {
  display: none;
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  z-index: 999;
  min-width: 200px;
  padding: 6px;
  animation: menuIn 0.15s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.context-menu.active {
  display: block;
}

@keyframes menuIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  color: var(--text-secondary);
}

.menu-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.menu-item i {
  font-size: 18px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.menu-item:hover i {
  color: var(--primary);
}

.menu-item.danger {
  color: var(--danger);
}

.menu-item.danger:hover {
  background: var(--danger-light);
}

.menu-item.danger i {
  color: var(--danger);
}

.menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 6px 0;
}

/* ===== 输入框 ===== */
.input-full {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  transition: var(--transition);
  color: var(--text);
  font-family: inherit;
  background: var(--bg);
}

.input-full:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: var(--surface);
}

.input-full::placeholder {
  color: var(--text-muted);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  font-size: 14px;
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 400px;
  pointer-events: auto;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

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

@keyframes toastIn {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

.toast i {
  font-size: 20px;
  flex-shrink: 0;
}

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

/* ===== 登录页面 ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.4s ease;
  overflow: hidden;
}

.login-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(79, 70, 229, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(129, 140, 248, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.login-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  text-align: center;
  position: relative;
  z-index: 1;
  border: 1px solid var(--border);
}

.login-box .logo {
  justify-content: center;
  margin-bottom: 8px;
  font-size: 26px;
}

.login-box .logo i {
  font-size: 48px;
  -webkit-text-fill-color: var(--primary);
}

.login-box h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: -0.5px;
}

.login-box .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-weight: 500;
}

.login-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--bg);
  margin-bottom: 20px;
  transition: var(--transition);
  color: var(--text);
  font-family: inherit;
}

.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: var(--surface);
}

.login-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius);
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 14px;
  min-height: 20px;
  font-weight: 600;
}

.login-loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

#loginOverlay { display: none; }
#loginOverlay.active { display: flex; }
#app { display: none; }
#app.authenticated { display: flex; }

/* ===== 文本编辑器 ===== */
.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid var(--border-light);
}
.editor-info {
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.editor-info.editable {
  color: var(--success);
  font-weight: 700;
}
.editor-lang {
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 6px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.text-editor {
  width: 100%;
  min-height: 400px;
  max-height: 60vh;
  padding: 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  transition: var(--transition);
}
.text-editor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ===== 移动端遮罩层 ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 150;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sidebar-overlay.active {
  display: block;
}

/* ===== 批量操作栏 ===== */
.batch-actions {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--primary-light), var(--surface));
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1.5px solid var(--primary-light);
  animation: slideDown 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-md);
}

.batch-actions.active {
  display: flex;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.batch-actions span {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-right: auto;
}

.batch-actions .btn {
  padding: 8px 14px;
  font-size: 13px;
}

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

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

/* ===== 上传结果链接 ===== */
.upload-result-links {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.upload-result-links .link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}

.upload-result-links .link-item:last-child {
  border-bottom: none;
}

.upload-result-links .link-label {
  width: 70px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upload-result-links .link-value {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary);
  font-size: 11px;
}

.upload-result-links .link-copy {
  padding: 6px 12px;
  font-size: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  flex-shrink: 0;
}

.upload-result-links .link-copy:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* ===== 拖拽上传提示 ===== */
.drag-active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(79, 70, 229, 0.08);
  border: 3px dashed var(--primary);
  z-index: 999;
  pointer-events: none;
  animation: dragPulse 1.2s ease infinite;
  border-radius: 0;
}

@keyframes dragPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ===== 图片画廊拖拽提示 ===== */
#imagebedView.drag-active .image-gallery::before {
  content: '释放以上传图片';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  padding: 18px 36px;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 700;
  z-index: 1000;
  box-shadow: var(--shadow-xl);
  pointer-events: none;
  animation: fadeIn 0.3s ease;
}

/* ===== 退出按钮 ===== */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  margin-top: 0;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== 响应式适配 ===== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .content-area {
    padding: 20px;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }

  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .search-box input {
    width: 200px;
  }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
  :root {
    --top-bar-height: 60px;
  }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    z-index: 200;
    width: 280px;
    box-shadow: var(--shadow-xl);
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar.open {
    left: 0;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .top-bar {
    padding: 0 16px;
    gap: 10px;
  }

  .search-box {
    display: none;
  }

  .breadcrumb {
    font-size: 13px;
  }

  .breadcrumb-item {
    padding: 6px 8px;
  }

  .top-actions {
    gap: 6px;
  }

  .top-actions .btn span {
    display: none;
  }

  .top-actions .btn {
    padding: 10px 12px;
  }

  .content-area {
    padding: 16px;
  }

  .view-header {
    margin-bottom: 16px;
  }

  .view-title h2 {
    font-size: 20px;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .file-item {
    padding: 14px;
  }

  .file-item .file-icon i {
    font-size: 40px;
  }

  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .image-item .image-actions button {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 18px;
  }

  .stat-value {
    font-size: 24px;
  }

  .modal-content {
    margin: 10px;
    max-height: calc(100vh - 20px);
    border-radius: var(--radius-lg);
  }

  .modal-large {
    max-width: calc(100vw - 20px);
  }

  .modal-small {
    max-width: calc(100vw - 40px);
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 14px 16px;
  }

  .upload-dropzone {
    padding: 32px 20px;
  }

  .upload-dropzone i {
    font-size: 44px;
  }

  .upload-dropzone p {
    font-size: 15px;
  }

  .preview-container {
    min-height: 280px;
  }

  .login-box {
    padding: 32px 24px;
    margin: 16px;
  }

  .login-box .logo {
    font-size: 22px;
  }

  .login-box .logo i {
    font-size: 40px;
  }

  .text-editor {
    min-height: 300px;
    font-size: 13px;
  }

  .batch-actions {
    flex-wrap: wrap;
    padding: 12px;
  }

  .batch-actions span {
    width: 100%;
    margin-bottom: 8px;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    max-width: 100%;
  }

  .context-menu {
    min-width: 180px;
  }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
  .file-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .file-item {
    padding: 12px;
  }

  .file-item .file-icon i {
    font-size: 36px;
  }

  .file-item .file-name {
    font-size: 12px;
  }

  .image-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .view-title h2 {
    font-size: 18px;
  }

  .top-actions .btn {
    padding: 8px 10px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .modal-header h3 {
    font-size: 15px;
  }

  .settings-panel {
    padding: 20px;
  }

  .stat-card {
    padding: 16px;
    gap: 14px;
  }

  .stat-icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .stat-value {
    font-size: 22px;
  }
}

/* Large screens (> 1440px) */
@media (min-width: 1440px) {
  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .content-area {
    padding: 32px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Ultra-wide screens (> 1920px) */
@media (min-width: 1920px) {
  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* iPad specific optimizations */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .sidebar {
    width: 240px;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

/* Landscape iPad */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
  .top-bar {
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
  }

  .content-area {
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
  }

  .toast-container {
    bottom: max(24px, env(safe-area-inset-bottom));
  }
}
