/* SmashCut 共享 UI 骨架 — 暗色主题，移动优先 */
/* 所有页面统一引入，避免 13 次重复写同一套样式 */

/* ── CSS 变量（核心变量在 shared/css/common.css，此处仅 H5 补充） ── */
:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --tab-height: 56px;
}

/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 8px);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── 通用组件 ── */

/* 卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: background .2s;
}
.card:active { background: var(--bg-card-hover); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { opacity: .8; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; display: flex; }
.btn:disabled { opacity: .4; pointer-events: none; }

/* 底部固定栏 */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 900;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 底部导航 Tab */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 1000;
}
.bottom-nav .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  padding: 4px 0;
  transition: color .2s;
  border: none;
  background: transparent;
}
.bottom-nav .tab .tab-icon { font-size: 20px; line-height: 1; }
.bottom-nav .tab.active { color: var(--accent); }
.bottom-nav .tab:active { opacity: .7; }

/* 表单 */
.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  outline: none;
  transition: border-color .2s;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-muted); }

label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* 分段按钮（Tab 切换） */
.segmented-control {
  display: flex;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.segmented-control .seg-item {
  flex: 1;
  padding: 8px 12px;
  text-align: center;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all .2s;
}
.segmented-control .seg-item.active {
  background: var(--accent);
  color: #fff;
}

/* 徽标/角标 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-processing { background: var(--warn); color: #000; }
.badge-done { background: var(--accent); color: #fff; }
.badge-failed { background: var(--danger); color: #fff; }
.badge-queued { background: var(--blue); color: #fff; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }

/* 弹窗 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 2000;
}
.modal-overlay.active { display: flex; }
.modal-sheet {
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 20px calc(20px + var(--safe-bottom));
  animation: sheetUp .3s ease;
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-sheet .sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-sheet h3 { font-size: 17px; margin-bottom: 12px; }
.modal-sheet p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* 进度条 */
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s;
}
.progress-fill.accent { background: var(--accent); }
.progress-fill.warn { background: var(--warn); }
.progress-fill.danger { background: var(--danger); }

/* 页头 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 100;
}
.page-header h1 { font-size: 20px; color: var(--accent); }
.page-header .header-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-secondary); }

/* 文件卡片 */
.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
}
.file-card .file-icon { font-size: 24px; flex-shrink: 0; }
.file-card .file-info { flex: 1; min-width: 0; }
.file-card .file-info .file-name { font-size: 14px; word-break: break-all; }
.file-card .file-info .file-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.file-card .file-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* 选择复选框（大触控区域） */
.toggle-check {
  width: 24px;
  height: 24px;
  border: 2px solid var(--text-muted);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
  font-size: 14px;
}
.toggle-check.checked { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 隐藏滚动条但可滚动 */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { display: none; }

/* 分隔线 */
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* 标签行 */
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
}

/* 信息行（弹窗内键值对） */
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row .label { color: var(--text-secondary); }
.info-row .value { color: var(--text-primary); text-align: right; }
