/* EWSV2 - 电商套图批量生成系统 */
/* 纯原生 CSS，无框架依赖 */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== 布局 ========== */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== 顶部导航 ========== */
.navbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 60px;
  gap: 24px;
}

.navbar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand:hover { text-decoration: none; }

.navbar-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius);
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* ========== 页面标题 ========== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }

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

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

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-outline {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

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

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

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-label .optional {
  color: var(--gray-400);
  font-weight: 400;
  font-size: 12px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-800);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

.form-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ========== 卡片 ========== */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  font-size: 16px;
  color: var(--gray-800);
}

.card-body {
  padding: 20px;
}

/* ========== 表格 ========== */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 14px;
}

th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
}

tr:hover td { background: var(--gray-50); }

/* ========== 徽章 ========== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-default { background: var(--gray-200); color: var(--gray-600); }

/* ========== 提示消息 ========== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 20px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  max-width: 400px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

/* ========== 模态框 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--gray-700); }

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--gray-900);
}

.login-subtitle {
  text-align: center;
  color: var(--gray-500);
  margin-bottom: 32px;
  font-size: 14px;
}

.login-card .form-group {
  margin-bottom: 24px;
}

.login-card .btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 16px;
}

/* ========== 上传区域 ========== */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--gray-50);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone.has-image {
  border-style: solid;
  border-color: var(--success);
  padding: 12px;
}

.upload-zone img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius);
}

.upload-zone .upload-icon {
  font-size: 48px;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.upload-zone .upload-text {
  color: var(--gray-500);
  font-size: 14px;
}

/* ========== 变体列表 ========== */
.variant-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}

.variant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.variant-number {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-700);
}

.variant-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius);
}

.variant-remove:hover { background: #fee2e2; }

/* ========== 任务详情 ========== */
.detail-section {
  margin-bottom: 24px;
}

.detail-section:last-child { margin-bottom: 0; }

.detail-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  color: var(--gray-800);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.image-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

/* ========== 加载状态 ========== */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  color: var(--gray-400);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

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

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-state .empty-text {
  font-size: 16px;
}

/* ========== 操作栏 ========== */
.action-bar {
  display: flex;
  gap: 8px;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .navbar-inner { gap: 12px; }
  .navbar-brand { font-size: 16px; }
  .nav-link { padding: 6px 10px; font-size: 13px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .action-bar { flex-wrap: wrap; }
  .login-card { padding: 24px; }
}
