/* Modern Studio Glassmorphism Design for Postcard Agent Console */
:root {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-color: rgba(148, 163, 184, 0.15);
  --border-focus: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --font-sans: 'Plus Jakarta Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部 Header */
.app-header {
  height: 70px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 28px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.logo-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.btn-text {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-text:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.3);
}

/* 主布局 */
.app-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  padding: 24px 32px;
  flex: 1;
  max-width: 1720px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 1200px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
}

/* 左侧配置面板 */
.config-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f1f5f9;
}

.step-num {
  width: 22px;
  height: 22px;
  background: var(--accent-blue);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.label-tip {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
}

.textarea-wrapper textarea,
.form-input,
.form-select {
  width: 100%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s;
}

.textarea-wrapper textarea:focus,
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.textarea-wrapper textarea {
  resize: vertical;
  line-height: 1.6;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
}

.chip-label {
  font-size: 11px;
  color: var(--text-muted);
}

.chip {
  background: rgba(51, 65, 85, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.agent-prompt-bar {
  margin-bottom: 8px;
}

.prompt-analysis-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 12px;
  margin-bottom: 14px;
  color: #cbd5e1;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: #60a5fa;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.style-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.style-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(148, 163, 184, 0.4);
}

.style-card.selected {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.style-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 2px;
}

.style-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 {
  flex: 1;
}

.toggle-group {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  flex: 1;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  text-align: left;
}

.toggle-btn strong {
  display: block;
  font-size: 12px;
  color: #e2e8f0;
}

.toggle-btn .sub {
  font-size: 10px;
  color: var(--text-muted);
}

.toggle-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-blue);
  color: #60a5fa;
}

.advanced-settings {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 16px 0;
  font-size: 12px;
}

.advanced-settings summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
  font-weight: 500;
}

.advanced-body {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

/* 按钮规范 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: rgba(51, 65, 85, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.btn-secondary:hover {
  background: rgba(71, 85, 105, 0.8);
  border-color: rgba(148, 163, 184, 0.4);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
}

.btn-lg {
  font-size: 15px;
  padding: 14px 20px;
}

.btn-block {
  width: 100%;
}

/* 右侧预览面板 */
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 工作流步骤条 */
.workflow-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 24px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.45;
  transition: all 0.3s;
}

.step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.step-text {
  font-size: 12px;
  font-weight: 600;
}

.step-line {
  flex: 1;
  height: 2px;
  background: rgba(148, 163, 184, 0.2);
  margin: 0 12px;
}

.step-item.active {
  opacity: 1;
  color: #60a5fa;
}

.step-item.active .step-circle {
  border-color: #3b82f6;
  background: #3b82f6;
  color: white;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.step-item.done {
  opacity: 0.9;
  color: #34d399;
}

.step-item.done .step-circle {
  border-color: #10b981;
  background: #10b981;
  color: white;
}

/* 预览主视窗 */
.preview-container {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.preview-tabs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.6);
}

.preview-tabs {
  display: flex;
  gap: 6px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.15);
}

.overlay-toggles {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.ctrl-label {
  color: var(--text-muted);
}

.chk-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #cbd5e1;
}

.preview-stage {
  min-height: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  position: relative;
  overflow: hidden;
}

.empty-state {
  text-align: center;
  max-width: 400px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 54px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}

.empty-state h3 {
  color: #f1f5f9;
  margin-bottom: 8px;
  font-size: 16px;
}

.empty-state p {
  font-size: 13px;
  line-height: 1.6;
}

/* 加载动效 */
.loading-state {
  text-align: center;
  color: #e2e8f0;
}

.sonar-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

.tab-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.postcard-wrapper {
  position: relative;
  border-radius: 6px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  max-width: 90%;
  max-height: 480px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.postcard-wrapper:hover {
  transform: translateY(-4px) scale(1.01);
}

.postcard-img {
  max-width: 100%;
  max-height: 460px;
  display: block;
  object-fit: contain;
}

.view-caption {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* 印前校样图 */
.proof-wrapper {
  position: relative;
  max-width: 90%;
  max-height: 500px;
  background: white;
  padding: 6px;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.proof-img {
  max-width: 100%;
  max-height: 460px;
  display: block;
}

/* 3D 翻转卡片 */
.scene-3d {
  perspective: 1200px;
  width: 500px;
  height: 338px;
}

.card-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
}

.card-3d.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.card-front img,
.card-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-back {
  transform: rotateY(180deg);
  background: #fdfdfd;
}

/* 参数速查条 */
.specs-bar {
  display: flex;
  border-top: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.85);
}

.spec-cell {
  flex: 1;
  padding: 12px 14px;
  border-right: 1px solid var(--border-color);
  text-align: center;
}

.spec-cell:last-child {
  border-right: none;
}

.spec-title {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.spec-val {
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
}

.text-success {
  color: #34d399 !important;
}

/* 交付下载专区 */
.download-section {
  padding: 24px;
  border-top: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.95);
}

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

.download-header h3 {
  font-size: 15px;
  color: #f8fafc;
  margin-bottom: 4px;
}

.download-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.download-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.download-card:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
}

.highlight-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(59, 130, 246, 0.5);
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.highlight-card:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.35), rgba(30, 41, 59, 0.9));
  border-color: #3b82f6;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.3);
}

.dl-icon {
  font-size: 26px;
}

.dl-info {
  flex: 1;
}

.dl-info strong {
  display: block;
  font-size: 13px;
  color: #f8fafc;
  margin-bottom: 2px;
}

.dl-info p {
  font-size: 11px;
  color: var(--text-muted);
}

.dl-action {
  font-size: 12px;
  font-weight: 600;
  color: #60a5fa;
  margin-top: 8px;
}

.highlight-card .dl-action {
  margin-top: 0;
  background: #2563eb;
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
}

/* 弹窗 Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 550px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.5);
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}

.history-item:hover {
  background: rgba(51, 65, 85, 0.6);
}
