/* ─────────────────────────────────────────────
   广告创意工作台 — 全站基础样式
   Design: Dark Mode + 霓虹紫蓝渐变
───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  --bg-base: #0a0b0f;
  --bg-panel: #111318;
  --bg-card: #1a1d27;
  --bg-hover: #1f2335;
  --border: #2a2e45;
  --border-bright: #3d4267;
  --accent: #7c63f5;
  --accent-2: #4facfe;
  --accent-glow: rgba(124, 99, 245, 0.35);
  --accent-2-glow: rgba(79, 172, 254, 0.25);
  --text-primary: #e8eaf6;
  --text-secondary: #8892b0;
  --text-muted: #4a5178;
  --success: #43e97b;
  --warning: #f7b731;
  --danger: #fc5c7d;
  --info: #4facfe;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(124, 99, 245, 0.3);
  --transition: all 0.2s ease;
  --sidebar-w: 340px;
  --queue-w: 280px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Noto Sans SC', 'Inter', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

/* ─── 滚动条 ─────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── 顶部导航 ───────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: rgba(10, 11, 15, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.topbar-logo svg { flex-shrink: 0; }
.topbar-spacer { flex: 1; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.credit-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--warning);
  cursor: pointer;
  transition: var(--transition);
}
.credit-badge:hover { border-color: var(--warning); box-shadow: 0 0 10px rgba(247, 183, 49, 0.2); }
.credit-badge .icon { font-size: 14px; }

/* ─── 主布局 ─────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  padding-top: 52px;
}

/* ─── 左侧参数面板 ───────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── 中央展示区 ─────────────────────────── */
.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-base);
  position: relative;
}
.canvas-toolbar {
  height: 50px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 6px;
  flex-shrink: 0;
}
.canvas-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* ─── 右侧队列栏 ─────────────────────────── */
.queue-panel {
  width: var(--queue-w);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.queue-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.queue-scroll { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }

/* ─── 通用卡片 ───────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* ─── 表单元素 ───────────────────────────── */
label.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 72px; }
select option { background: var(--bg-card); }

/* ─── 标签选择组 ─────────────────────────── */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.tag-btn:hover { border-color: var(--accent); color: var(--accent); }
.tag-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ─── 图片上传区 ─────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: var(--bg-base);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(124, 99, 245, 0.05);
}
.upload-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
}
.upload-zone-icon { font-size: 24px; color: var(--text-muted); margin-bottom: 6px; }
.upload-zone-text { font-size: 12px; color: var(--text-muted); }
.upload-zone .preview-img {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  border-radius: 6px;
}

/* ─── 按钮 ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #9b59b6);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-success { background: linear-gradient(135deg, #43e97b, #38f9d7); color: #000; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #f7971e); color: #fff; }
.btn-icon { padding: 7px 10px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); border-radius: 8px; }
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-submit {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  height: 42px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 4px 20px var(--accent-glow);
  width: 100%;
}
.btn-submit:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 28px var(--accent-glow); }

/* ─── 工具栏按钮（展示区顶部） ──────────── */
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.toolbar-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(124,99,245,0.1); }
.toolbar-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(124,99,245,0.15); }
.toolbar-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.tool-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

/* ─── 队列任务卡片 ───────────────────────── */
.queue-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.queue-item:hover { border-color: var(--border-bright); background: var(--bg-hover); }
.queue-item.active { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.queue-item-thumb {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-base);
  margin-bottom: 8px;
}
.queue-item-type-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,0.7);
  color: var(--accent-2);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.queue-item-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.pending  { background: var(--text-muted); }
.status-dot.processing { background: var(--warning); animation: pulse 1.2s infinite; }
.status-dot.done    { background: var(--success); }
.status-dot.failed  { background: var(--danger); }
.queue-item-prompt { font-size: 11px; color: var(--text-muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

/* ─── 主展示区状态 ───────────────────────── */
.canvas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  height: 100%;
  text-align: center;
  pointer-events: none;
}
.canvas-empty-icon { font-size: 56px; opacity: 0.2; }
.canvas-empty-title { font-size: 18px; font-weight: 600; opacity: 0.3; }
.canvas-empty-sub { font-size: 13px; opacity: 0.2; }

.canvas-image-wrap {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.canvas-image-wrap img {
  max-width: 100%;
  max-height: calc(100vh - 102px);
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.multi-images-grid {
  display: grid;
  gap: 8px;
  padding: 16px;
  height: 100%;
  width: 100%;
  align-items: center;
}
.multi-images-grid img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.multi-images-grid img:hover { transform: scale(1.02); box-shadow: var(--shadow-glow); }

/* ─── 生成进度遮罩 ───────────────────────── */
.generating-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 15, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.generating-text {
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ─── 蒙版工具栏（浮动）─────────────────── */
.inpaint-toolbar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 19, 24, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-bright);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  white-space: nowrap;
}
.inpaint-size-slider { width: 80px; accent-color: var(--accent); }
.inpaint-prompt-wrap {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 90%);
  background: rgba(17, 19, 24, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 12px;
  z-index: 20;
  display: flex;
  gap: 8px;
  box-shadow: 0 0 24px var(--accent-glow);
}
.inpaint-prompt-wrap textarea {
  flex: 1;
  min-height: 52px;
  max-height: 100px;
  font-size: 13px;
}

/* ─── 蒙版 canvas ────────────────────────── */
#inpaint-canvas {
  position: absolute;
  top: 0; left: 0;
  cursor: crosshair;
  opacity: 0.7;
  border-radius: var(--radius);
}

/* ─── 弹窗/Modal ─────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: min(600px, 95vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow), 0 0 40px var(--accent-glow);
  animation: slideUp 0.2s ease;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.modal-close { margin-left: auto; background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; line-height: 1; transition: var(--transition); }
.modal-close:hover { color: var(--danger); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─── 风格选择网格弹窗 ───────────────────── */
.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.style-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
}
.style-card:hover { border-color: var(--accent); transform: scale(1.02); }
.style-card.selected { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.style-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: linear-gradient(135deg, var(--bg-base), var(--bg-card));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-muted);
}
.style-card-name { padding: 6px 8px; font-size: 12px; font-weight: 500; text-align: center; }

/* ─── 预设广告参数弹窗 ─────────────────── */
.preset-list { display: flex; flex-direction: column; gap: 8px; }
.preset-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--transition);
}
.preset-item:hover { border-color: var(--accent); background: rgba(124,99,245,0.05); }
.preset-item-name { font-weight: 500; font-size: 13px; margin-bottom: 3px; }
.preset-item-prompt { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* ─── 气泡提示 ───────────────────────────── */
.bubble-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px var(--accent-glow);
  animation: bounce 1s ease infinite;
  pointer-events: none;
  z-index: 50;
}
.bubble-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--accent);
}
@keyframes bounce { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-4px); } }

/* ─── Toast 通知 ─────────────────────────── */
#toast-container {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
  pointer-events: none;
  max-width: 300px;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.info { border-color: var(--info); color: var(--info); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── 规格选择行 ─────────────────────────── */
.spec-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.spec-select {
  padding: 6px 8px;
  font-size: 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-primary);
  cursor: pointer;
}
.spec-select:focus { border-color: var(--accent); outline: none; }

/* ─── Tip 文字 ───────────────────────────── */
.tip-text { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* ─── 响应式 ─────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 260px; --queue-w: 200px; }
  .style-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .queue-panel { display: none; }
  :root { --sidebar-w: 100vw; }
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; max-height: 45vh; }
  .canvas-area { flex: 1; }
}
