/**
 * 叁数花-智影工厂 v5.0 - 样式系统
 * 
 * 特性：
 * 1. CSS 变量系统
 * 2. 响应式设计（移动端优先）
 * 3. 暗色模式支持
 * 4. 组件化样式
 * 5. 过渡动画
 */

/* ===== CSS 变量 ===== */
:root {
  /* 品牌色 */
  --color-primary: #667eea;
  --color-primary-dark: #5a6fd6;
  --color-primary-light: #8da2f0;
  --color-secondary: #764ba2;
  --color-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --color-gradient-h: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  
  /* 功能色 */
  --color-success: #52c41a;
  --color-warning: #faad14;
  --color-error: #ff4d4f;
  --color-info: #1890ff;
  
  /* 文本色 */
  --color-text: #262626;
  --color-text-secondary: #595959;
  --color-text-hint: #8c8c8c;
  --color-text-disabled: #bfbfbf;
  
  /* 背景色 */
  --color-bg: #f0f2f5;
  --color-bg-white: #ffffff;
  --color-bg-card: #ffffff;
  --color-bg-hover: #f5f5f5;
  --color-bg-active: #e6f7ff;
  --color-bg-overlay: rgba(0, 0, 0, 0.45);
  
  /* 边框色 */
  --color-border: #e8e8e8;
  --color-border-light: #f0f0f0;
  --color-border-focus: #667eea;
  
  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-round: 50%;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
  
  /* 字体 */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 32px;
  
  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* 布局 */
  --max-width: 1200px;
  --sidebar-width: 220px;
  --header-height: 56px;
}

/* ===== v32 premium workbench refresh ===== */
:root {
  --color-primary: #1f4fd8;
  --color-primary-dark: #173da8;
  --color-secondary: #0f766e;
  --color-gradient: linear-gradient(135deg, #111827 0%, #1f4fd8 100%);
  --color-gradient-h: linear-gradient(90deg, #1f4fd8 0%, #0f766e 100%);
  --color-success: #0f9f6e;
  --color-warning: #b7791f;
  --color-error: #d92d20;
  --color-info: #1f4fd8;
  --color-text: #111827;
  --color-text-secondary: #4b5563;
  --color-text-hint: #8a94a6;
  --color-bg: #f5f7fb;
  --color-bg-white: #ffffff;
  --color-bg-card: #ffffff;
  --color-border: #e2e8f0;
  --color-border-light: #eef2f7;
  --color-border-focus: #1f4fd8;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 26px 70px rgba(15, 23, 42, 0.18);
}

body {
  background:
    linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
  color: #111827;
  letter-spacing: 0;
}

.container.app-shell {
  max-width: 1280px;
  padding: 18px 22px 48px;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  padding: 12px 0;
  background: rgba(248, 250, 252, 0.9);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(14px);
}

.nav-brand {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.16);
}

.nav-brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  color: #111827;
  letter-spacing: 0;
}

.nav-brand p {
  margin-top: 4px;
  font-size: 12px;
  color: #667085;
}

.nav-actions {
  gap: 8px;
}

.nav-user {
  border: 1px solid #dbe3ef;
  background: #ffffff;
  border-radius: 8px;
  color: #344054;
  box-shadow: var(--shadow-sm);
}

.nav-credits {
  color: #0f766e;
  font-weight: 700;
}

.recharge-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #0b1b5a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.recharge-link:hover {
  background: #1437a8;
}

.btn,
.generate-btn {
  border-radius: 8px;
  letter-spacing: 0;
}

.btn-primary,
.generate-btn {
  background: #111827;
  border-color: #111827;
  box-shadow: 0 12px 22px rgba(17, 24, 39, 0.18);
}

.btn-primary:hover,
.generate-btn:hover {
  background: #1f2937;
  border-color: #1f2937;
  transform: translateY(-1px);
}

.btn-ghost {
  color: #344054;
  border: 1px solid #dbe3ef;
  background: #ffffff;
}

.btn-secondary {
  color: #344054;
  border: 1px solid #dbe3ef;
  background: #ffffff;
}

.studio-main {
  display: block;
}

.studio-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 360px;
  align-items: stretch;
  gap: 18px;
  margin: 18px 0;
  min-height: 260px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 34px;
  border: 1px solid #dde5ef;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255,255,255,0.94), rgba(255,255,255,0.72)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='360' viewBox='0 0 900 360'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%23111827' stop-opacity='.14'/%3E%3Cstop offset='1' stop-color='%230f766e' stop-opacity='.10'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='900' height='360' fill='%23f8fafc'/%3E%3Cpath d='M0 270 C160 210 260 300 410 236 C560 170 645 230 900 120 L900 360 L0 360 Z' fill='url(%23g)'/%3E%3Cg fill='none' stroke='%23111827' stroke-opacity='.09'%3E%3Cpath d='M80 65h220M80 105h310M80 145h170'/%3E%3Cpath d='M640 60c55 0 100 45 100 100s-45 100-100 100-100-45-100-100 45-100 100-100z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: var(--shadow-md);
}

.eyebrow,
.modal-kicker,
.step-badge {
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hero-copy h2 {
  max-width: 680px;
  margin: 10px 0 10px;
  color: #111827;
  font-size: 36px;
  line-height: 1.18;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  color: #475467;
  font-size: 16px;
  line-height: 1.7;
}

.hero-preview {
  border-radius: 8px;
  border: 1px solid #dde5ef;
  background: #111827;
  box-shadow: var(--shadow-md);
  padding: 18px;
  overflow: hidden;
}

.preview-frame {
  position: relative;
  height: 100%;
  min-height: 224px;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(31, 79, 216, .18), rgba(15, 118, 110, .18)),
    radial-gradient(circle at 50% 30%, rgba(255,255,255,.18), transparent 34%),
    #172033;
  border: 1px solid rgba(255,255,255,.12);
}

.preview-silhouette {
  position: absolute;
  left: 50%;
  top: 24px;
  width: 118px;
  height: 168px;
  transform: translateX(-50%);
  border-radius: 58px 58px 20px 20px;
  background: linear-gradient(180deg, #ffffff, #ccd6e6);
  box-shadow: 0 22px 50px rgba(0,0,0,.25);
}

.preview-caption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  justify-content: space-between;
  color: #ffffff;
  font-size: 12px;
}

.preview-caption strong {
  color: #8be0cc;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.workspace-primary {
  display: grid;
  gap: 18px;
}

.panel,
.card,
.section {
  border-radius: 8px;
}

.panel {
  padding: 22px;
  background: #ffffff;
  border: 1px solid #dde5ef;
  box-shadow: var(--shadow-sm);
}

.section {
  margin-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-bottom: 16px;
}

.section-heading p {
  max-width: 360px;
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.6;
  text-align: right;
}

.section-title {
  margin: 4px 0 0;
  color: #111827;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}

.upload-area {
  min-height: 238px;
  border: 1px dashed #b7c4d6;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fbfcff, #f5f8fc);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #1f4fd8;
  background: #f7faff;
  box-shadow: 0 0 0 4px rgba(31, 79, 216, 0.08);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
}

.upload-text {
  color: #111827;
  font-size: 17px;
  font-weight: 800;
}

.upload-hint {
  margin-top: 8px;
  color: #667085;
  font-size: 13px;
}

.upload-image-grid {
  gap: 10px;
}

.form-control {
  min-height: 42px;
  border: 1px solid #d8e1ed;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  box-shadow: none;
}

.form-control:focus {
  border-color: #1f4fd8;
  box-shadow: 0 0 0 4px rgba(31, 79, 216, 0.09);
}

textarea.form-control {
  min-height: 132px;
  line-height: 1.65;
}

.option-group {
  margin-top: 18px;
}

.option-group-title {
  color: #344054;
  font-weight: 800;
  margin-bottom: 10px;
}

.option-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-card {
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  font-size: 13px;
  transition: all .18s ease;
}

.option-card:hover {
  border-color: #1f4fd8;
  color: #1f4fd8;
  background: #f7faff;
}

.option-card.selected {
  border-color: #111827;
  background: #111827;
  color: #ffffff;
}

.prompt-toolbar {
  align-items: center;
  gap: 10px;
}

.prompt-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#promptCharCount {
  color: #98a2b3;
  font-size: 12px;
}

.inline-loading,
.progress-detail {
  margin-top: 8px;
  color: #1f4fd8;
  font-size: 12px;
}

.sticky-panel {
  position: sticky;
  top: 92px;
}

.model-desc {
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
  font-size: 13px;
}

.model-tip {
  margin-bottom: 14px;
  color: #667085;
  font-size: 12px;
  line-height: 1.5;
}

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

.param-group label,
.form-group label {
  margin-bottom: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.model-info-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.model-info-item {
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
}

.model-info-item.highlight {
  border-color: rgba(15, 118, 110, 0.35);
  background: #f1fbf8;
}

.model-info-value {
  color: #111827;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.model-info-label {
  margin-top: 4px;
  color: #8a94a6;
  font-size: 12px;
}

.generate-btn {
  width: 100%;
  margin-top: 16px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 800;
}

.info-bar {
  border-radius: 8px;
  color: #667085;
  background: #f8fafc;
}

.error-message {
  border-radius: 8px;
}

.history-section {
  margin-top: 18px;
}

.history-stats {
  gap: 10px;
}

.history-stat-card,
.history-table,
.history-table th,
.history-table td {
  border-color: #dbe3ef;
}

.history-table {
  border-radius: 8px;
  overflow: hidden;
}

.progress-modal,
.result-modal {
  backdrop-filter: blur(10px);
}

.progress-content,
.result-content {
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.55);
  box-shadow: var(--shadow-xl);
}

.progress-content h3,
.result-content h3 {
  margin-top: 6px;
  color: #111827;
  letter-spacing: 0;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #e8eef7;
}

.progress-fill {
  border-radius: 999px;
  background: linear-gradient(90deg, #1f4fd8, #0f766e);
}

.video-preview {
  border-radius: 8px;
  background: #0b1020;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

@media (max-width: 980px) {
  .studio-hero,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .hero-preview {
    display: none;
  }

  .sticky-panel {
    position: static;
  }

  .section-heading {
    display: block;
  }

  .section-heading p {
    margin-top: 8px;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .container.app-shell {
    padding: 12px 12px 32px;
  }

  .nav {
    align-items: flex-start;
    gap: 12px;
  }

  .nav-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .hero-copy {
    padding: 22px;
  }

  .hero-copy h2 {
    font-size: 27px;
  }

  .panel {
    padding: 16px;
  }

  .model-info-card {
    grid-template-columns: 1fr;
  }

  .prompt-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .prompt-actions {
    justify-content: flex-start;
  }
}

/* ===== 暗色模式 ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --color-text: #e8e8e8;
    --color-text-secondary: #a0a0a0;
    --color-text-hint: #666;
    --color-bg: #1a1a2e;
    --color-bg-white: #16213e;
    --color-bg-card: #1a1a2e;
    --color-bg-hover: #252545;
    --color-bg-active: #1a2744;
    --color-border: #333355;
    --color-border-light: #252545;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

/* ===== 基础重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-gradient);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 布局 ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--color-bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

/* ===== 顶部导航 ===== */
.nav {
  background: var(--color-gradient);
  color: white;
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-brand h1 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.nav-brand p {
  font-size: var(--font-size-sm);
  opacity: 0.85;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
}

.nav-credits {
  background: rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-size-sm);
}

/* ===== 按钮系统 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

.btn-secondary {
  background: var(--color-bg-hover);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

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

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

.btn-ghost {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--font-size-md);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--font-size-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-round);
}

/* ===== 主要内容区域 ===== */
.main {
  padding: var(--space-xl);
}

.section {
  margin-bottom: var(--space-xl);
}

.section-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.section-title .icon {
  font-size: var(--font-size-xl);
}

/* ===== 卡片 ===== */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  font-size: var(--font-size-md);
  font-weight: 600;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}

/* ===== 上传区域 ===== */
.upload-area {
  border: 3px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--color-bg-hover);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-area:hover {
  border-color: var(--color-primary);
  background: #f0f7ff;
}

.upload-area.dragover {
  border-color: var(--color-primary);
  background: #e6f7ff;
  transform: scale(1.02);
}

.upload-area.has-images {
  padding: var(--space-md);
  background: var(--color-bg-white);
  min-height: auto;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.upload-text {
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.upload-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-hint);
}

.upload-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-md);
}

/* ===== 图片卡片 ===== */
.image-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-hover);
  border: 2px solid transparent;
  transition: all var(--transition-fast);
  cursor: move;
}

.image-card:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.image-card.uploaded {
  border-color: var(--color-success);
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-card .status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: var(--font-size-xs);
  padding: var(--space-xs);
  text-align: center;
}

.image-card .status.error {
  background: var(--color-error);
}

.image-card .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(0,0,0,0.6);
  color: white;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  z-index: 2;
  transition: background var(--transition-fast);
}

.image-card .remove:hover {
  background: var(--color-error);
}

.image-card .image-order {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  background: rgba(24,144,255,0.9);
  color: white;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: bold;
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
  font-weight: 500;
  font-size: var(--font-size-sm);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background: var(--color-bg-white);
  color: var(--color-text);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
  color: var(--color-text-disabled);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%238c8c8c'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ===== 参数选择器 ===== */
.params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.param-group {
  margin-bottom: var(--space-md);
}

.param-group label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

/* ===== 风格选择卡片 ===== */
.style-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-sm);
}

.style-card {
  padding: var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.style-card:hover {
  border-color: var(--color-primary-light);
  background: #f0f7ff;
}

.style-card.selected {
  border-color: var(--color-primary);
  background: #e6f7ff;
  box-shadow: 0 0 0 1px var(--color-primary);
}

.style-card .style-icon {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-xs);
}

.style-card .style-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.style-card .style-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-hint);
  margin-top: 2px;
}

/* ===== 提示词选项 ===== */
.option-group {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.option-group-title {
  font-size: var(--font-size-xs);
  color: var(--color-text-hint);
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

.option-card {
  padding: var(--space-xs) var(--space-sm);
  margin: 2px 0;
  font-size: var(--font-size-xs);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  background: var(--color-bg-hover);
  color: var(--color-text-secondary);
}

.option-card:hover {
  background: var(--color-bg-active);
  color: var(--color-primary);
}

.option-card.selected {
  background: var(--color-bg-active);
  color: var(--color-primary);
  font-weight: 600;
}

/* ===== 模型信息卡 ===== */
.model-info-card {
  background: var(--color-gradient);
  color: white;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
}

.model-info-item {
  text-align: center;
}

.model-info-value {
  font-size: var(--font-size-md);
  font-weight: 600;
}

.model-info-label {
  font-size: var(--font-size-xs);
  opacity: 0.85;
  margin-top: 2px;
}

/* ===== 进度条 ===== */
.progress-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.progress-modal.show {
  opacity: 1;
  pointer-events: all;
}

.progress-content {
  background: var(--color-bg-white);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 90%;
  max-width: 480px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-lg) 0;
}

.progress-fill {
  height: 100%;
  background: var(--color-gradient);
  border-radius: var(--radius-md);
  transition: width var(--transition-normal);
}

.progress-percent {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-primary);
}

.progress-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-sm);
}

/* ===== 结果模态框 ===== */
.result-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.result-modal.show {
  opacity: 1;
  pointer-events: all;
}

.result-content {
  background: var(--color-bg-white);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.video-preview {
  width: 100%;
  border-radius: var(--radius-lg);
  background: #000;
  max-height: 500px;
}

.video-info {
  padding: var(--space-md) 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

/* ===== 历史记录 ===== */
.history-section {
  margin-top: var(--space-xl);
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-item {
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  color: white;
  text-align: center;
}

.stat-item .stat-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
}

.stat-item .stat-label {
  font-size: var(--font-size-xs);
  opacity: 0.85;
  margin-top: var(--space-xs);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.history-table th {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  background: var(--color-bg-hover);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-secondary);
  font-weight: 600;
}

.history-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.history-table tr:hover td {
  background: var(--color-bg-hover);
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding: var(--space-md);
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  z-index: 10000;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* ===== 错误信息 ===== */
.error-message {
  color: var(--color-error);
  font-size: var(--font-size-sm);
  padding: var(--space-sm) var(--space-md);
  background: #fff2f0;
  border-radius: var(--radius-md);
  border: 1px solid #ffccc7;
  margin-top: var(--space-sm);
  display: none;
}

.error-message.show {
  display: block;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.success-message {
  color: var(--color-success);
  font-size: var(--font-size-sm);
  padding: var(--space-sm) var(--space-md);
  background: #f6ffed;
  border-radius: var(--radius-md);
  border: 1px solid #b7eb8f;
  margin-top: var(--space-sm);
  display: none;
}

.success-message.show {
  display: block;
}

/* ===== 信息提示 ===== */
.info-bar {
  font-size: var(--font-size-sm);
  color: var(--color-text-hint);
  padding: var(--space-sm) 0;
}

/* ===== 上传限制警告 ===== */
.upload-limit-warning {
  color: var(--color-warning);
  font-size: var(--font-size-sm);
  margin-top: var(--space-sm);
  display: none;
}

.upload-limit-warning.show {
  display: block;
}

/* ===== 生成按钮 ===== */
.generate-section {
  text-align: center;
  padding: var(--space-lg) 0;
}

.generate-btn {
  padding: 16px 48px;
  font-size: var(--font-size-lg);
  font-weight: 600;
  background: var(--color-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md);
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.generate-btn:active:not(:disabled) {
  transform: translateY(0);
}

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

/* ===== 加载骨架屏 ===== */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg-hover) 25%, var(--color-border-light) 50%, var(--color-bg-hover) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--space-sm);
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: var(--space-md);
}

.skeleton-image {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}

/* ===== 登录页 ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.login-box {
  background: var(--color-bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  padding: var(--space-2xl);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo h1 {
  color: var(--color-primary);
  font-size: var(--font-size-2xl);
  font-weight: 700;
}

.login-logo p {
  color: var(--color-text-hint);
  font-size: var(--font-size-sm);
  margin-top: var(--space-sm);
}

.login-tabs {
  display: flex;
  margin-bottom: var(--space-xl);
  border-bottom: 2px solid var(--color-border-light);
}

.login-tab {
  flex: 1;
  text-align: center;
  padding: var(--space-sm) 0;
  cursor: pointer;
  color: var(--color-text-hint);
  transition: all var(--transition-fast);
  font-weight: 500;
}

.login-tab.active {
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  margin-bottom: -2px;
}

.login-form {
  display: none;
}

.login-form.active {
  display: block;
}

.password-strength {
  margin-top: var(--space-xs);
  display: flex;
  gap: var(--space-xs);
}

.strength-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border-light);
  transition: background var(--transition-fast);
}

.strength-bar.weak { background: var(--color-error); }
.strength-bar.medium { background: var(--color-warning); }
.strength-bar.strong { background: var(--color-success); }

/* ===== 管理后台布局 ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg);
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: #001529;
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar .logo {
  padding: var(--space-lg);
  font-size: var(--font-size-md);
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-menu-item {
  padding: 12px var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: rgba(255,255,255,0.65);
}

.admin-menu-item:hover,
.admin-menu-item.active {
  background: var(--color-info);
  color: white;
}

.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: var(--space-lg);
}

.admin-header {
  background: var(--color-bg-white);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.admin-stat-card {
  background: var(--color-bg-white);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.admin-stat-title {
  font-size: var(--font-size-sm);
  color: var(--color-text-hint);
  margin-bottom: var(--space-sm);
}

.admin-stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--color-text);
}

/* ===== 确认对话框 ===== */
.confirm-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.confirm-dialog.show {
  opacity: 1;
  pointer-events: all;
}

.confirm-content {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.confirm-content h3 {
  margin-bottom: var(--space-md);
}

.confirm-content p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

.confirm-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
}

.site-footer {
  width: 100%;
  max-width: 1180px;
  margin: 20px auto 0;
  padding: 18px 16px 24px;
  text-align: center;
  color: rgba(52, 64, 84, 0.72);
  font-size: var(--font-size-sm);
  line-height: 1.7;
}

.site-footer .icp-link {
  color: inherit;
  text-decoration: none;
}

.site-footer .icp-link:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.auth-site-footer {
  margin-top: -28px;
  color: rgba(255, 248, 239, 0.72);
}

.auth-site-footer .icp-link:hover {
  color: #fff8ef;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  :root {
    --space-xl: 20px;
    --space-2xl: 32px;
  }
  
  body {
    padding: var(--space-sm);
  }
  
  .container {
    border-radius: var(--radius-lg);
  }
  
  .nav {
    padding: var(--space-md);
    flex-direction: column;
    text-align: center;
  }
  
  .nav-brand h1 {
    font-size: var(--font-size-lg);
  }
  
  .main {
    padding: var(--space-md);
  }
  
  .params-grid {
    grid-template-columns: 1fr;
  }
  
  .style-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .upload-image-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .model-info-card {
    grid-template-columns: repeat(2, 1fr);
    padding: var(--space-md);
  }
  
  .progress-content {
    width: 95%;
    padding: var(--space-lg);
  }
  
  .result-content {
    width: 95%;
    padding: var(--space-md);
  }
  
  /* 管理后台移动端 */
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
  
  .admin-main {
    margin-left: 0;
  }
  
  .admin-layout {
    flex-direction: column;
  }
  
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .history-table {
    font-size: var(--font-size-xs);
  }
  
  .history-table th,
  .history-table td {
    padding: 4px var(--space-xs);
  }
}

@media (max-width: 480px) {
  .nav-actions {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .style-cards {
    grid-template-columns: 1fr 1fr;
  }
  
  .generate-btn {
    padding: 14px 32px;
    font-size: var(--font-size-base);
  }
}

/* ===== 打印样式 ===== */
@media print {
  body {
    background: white;
    padding: 0;
  }
  
  .container {
    box-shadow: none;
    border-radius: 0;
  }
  
  .nav,
  .btn,
  .generate-section,
  .upload-area,
  .progress-modal,
  .result-modal {
    display: none !important;
  }
  
  .main {
    padding: 0;
  }
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-hint); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-primary { color: var(--color-primary); }
.font-bold { font-weight: 600; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
