/* ================================================================
   AI 抠图 Web 版 - 共享样式
   ================================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #121212;
  --bg-secondary: #1E1E1E;
  --bg-tertiary: #2A2A2A;
  --text-primary: #E0E0E0;
  --text-secondary: #888888;
  --text-muted: #666666;
  --accent: #007AFF;
  --accent-glow: rgba(0, 122, 255, 0.15);
  --border: #2A2A2A;
  --danger: #FF3B30;
  --success: #34C759;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
}

/* ============ Upload Page ============ */
.upload-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.header {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow: auto;
  gap: 16px;
}

/* Cutout Stats */
.cutout-stats {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.stats-number {
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
}

/* Upload Area */
.upload-area {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  max-height: 70vh;
  border: 2px dashed #444;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-area.has-image {
  border-style: solid;
  border-color: #333;
  cursor: default;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.upload-icon {
  width: 56px; height: 56px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}

.icon-plus-h, .icon-plus-v {
  position: absolute;
  background: var(--accent);
  border-radius: 2px;
}
.icon-plus-h { width: 28px; height: 3px; }
.icon-plus-v { width: 3px; height: 28px; }

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

/* Preview (inside upload area) */
.upload-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 12px;
  gap: 10px;
}

.preview-image {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #1A1A1A;
}

.btn-reselect {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 18px;
  border: 1px solid #444;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-reselect:hover { border-color: #666; color: #aaa; }

/* Bottom Bar */
.bottom-bar {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Model Selector */
.model-selector {
  position: relative;
  margin-bottom: 12px;
}

.model-current {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.model-current:hover { background: #333; }

.model-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: 8px;
}

.model-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.model-arrow {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-secondary);
  transition: transform 0.2s;
}
.model-arrow.up { transform: rotate(180deg); }

.model-list {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  z-index: 10;
}
.model-list.expanded { max-height: 200px; opacity: 1; }

.model-item {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: background 0.15s;
}
.model-item:hover { background: rgba(255,255,255,0.05); }
.model-item.active { background: var(--accent-glow); }

.model-item-name {
  font-size: 14px;
  font-weight: 500;
}
.model-item.active .model-item-name { color: var(--accent); }

.model-item-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Buttons */
.btn-start {
  width: 100%;
  height: 48px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: opacity 0.15s;
}
.btn-start:hover { opacity: 0.9; }
.btn-start:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-demo {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 0 0;
  cursor: pointer;
  transition: color 0.15s;
}
.btn-demo:hover { color: var(--text-secondary); }

/* ============ Loading Overlay ============ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.loading-overlay.hidden { display: none; }

.progress-panel {
  width: 80%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.progress-title {
  font-size: 15px;
  font-weight: 500;
  min-height: 22px;
}

.progress-bar-track {
  width: 100%;
  height: 4px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-steps {
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #444;
  transition: background 0.3s;
}
.progress-step.active .step-dot { background: var(--accent); }

.step-label {
  font-size: 10px;
  color: var(--text-muted);
  transition: color 0.3s;
}
.progress-step.active .step-label { color: #aaa; }

.btn-cancel {
  padding: 8px 32px;
  border: 1px solid #555;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #aaa;
  background: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-cancel:hover { border-color: #888; color: #ccc; }

.time-estimate, .tip-text {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  min-height: 18px;
}

/* ============ Privacy Dialog ============ */
.privacy-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.privacy-overlay.hidden { display: none; }

.privacy-dialog {
  width: 85%;
  max-width: 380px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.privacy-title {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

.privacy-content {
  max-height: 200px;
  overflow-y: auto;
  background: #252525;
  border-radius: var(--radius-md);
  padding: 14px;
}

.privacy-text {
  font-size: 13px;
  color: #aaa;
  line-height: 1.8;
  margin-bottom: 8px;
}
.privacy-text:last-child { margin-bottom: 0; }

.privacy-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  cursor: pointer;
}

.privacy-checkbox {
  width: 20px; height: 20px;
  border: 2px solid #555;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  font-size: 14px;
  color: #fff;
  font-weight: 700;
}
.privacy-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.privacy-check-label {
  font-size: 13px;
  color: #ccc;
}

.privacy-buttons {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.privacy-btn {
  flex: 1;
  height: 42px;
  border-radius: 21px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.privacy-btn:hover { opacity: 0.85; }

.privacy-btn-disagree {
  background: var(--bg-tertiary);
  color: #aaa;
}
.privacy-btn-agree {
  background: var(--accent);
  color: #fff;
}
.privacy-btn-agree:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 3000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
