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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 220px;
  background: #001529;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.nav-item.active {
  color: #fff;
  background: #1890ff;
  border-left-color: #1890ff;
}

.nav-icon {
  margin-right: 10px;
  font-size: 16px;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-header {
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 500;
}

#page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar-left {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  gap: 4px;
}

.btn-primary {
  background: #1890ff;
  color: #fff;
}
.btn-primary:hover { background: #40a9ff; }

.btn-success {
  background: #52c41a;
  color: #fff;
}
.btn-success:hover { background: #73d13d; }

.btn-danger {
  background: #ff4d4f;
  color: #fff;
}
.btn-danger:hover { background: #ff7875; }

.btn-warning {
  background: #faad14;
  color: #fff;
}
.btn-warning:hover { background: #ffc53d; }

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

/* ===== Table ===== */
.data-table {
  width: 100%;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}

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

.data-table th {
  background: #fafafa;
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  color: #666;
  border-bottom: 1px solid #e8e8e8;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.data-table tr:hover td {
  background: #f5f9ff;
}

.data-table .actions {
  display: flex;
  gap: 6px;
}

/* ===== Image Grid ===== */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.image-card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
  position: relative;
}

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

.image-card .info {
  padding: 8px 10px;
  font-size: 12px;
  color: #666;
}

.image-card .info .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.image-card .card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.image-card:hover .card-actions {
  opacity: 1;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: #fff;
  border-radius: 8px;
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
}

.modal.wide {
  width: 720px;
}

.modal.xwide {
  width: 95vw;
  max-width: 1400px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #e8e8e8;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.modal-close:hover { color: #333; }

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

/* ===== Form ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  color: #333;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 12px 24px;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  z-index: 2000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
}

.toast.success { background: #52c41a; }
.toast.error { background: #ff4d4f; }
.toast.info { background: #1890ff; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Upload Zone ===== */
.upload-zone {
  border: 2px dashed #d9d9d9;
  border-radius: 6px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #1890ff;
  background: #f0f7ff;
}

.upload-zone p {
  font-size: 14px;
  color: #999;
  margin-top: 8px;
}

.upload-zone .upload-icon {
  font-size: 48px;
  color: #d9d9d9;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ===== Status Badge ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.badge.active, .badge.created { background: #e6f7ff; color: #1890ff; }
.badge.generating { background: #fff7e6; color: #fa8c16; }
.badge.completed { background: #f6ffed; color: #52c41a; }
.badge.deleted { background: #fff2f0; color: #ff4d4f; }
.badge.failed { background: #fff2f0; color: #ff4d4f; }
.badge.paused { background: #fffbe6; color: #d4b106; }
.badge.stopped { background: #f0f0f0; color: #666; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .nav-icon { margin-right: 0; }
  .sidebar .nav-item span:not(.nav-icon) { display: none; }
  .sidebar-header h1 { font-size: 14px; text-align: center; }
}

/* ===== SKU Tags in Group ===== */
.sku-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sku-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0f5ff;
  border: 1px solid #d6e4ff;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  color: #1890ff;
}

.sku-tag .remove {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.sku-tag .remove:hover { color: #ff4d4f; }

/* ===== Image preview in modal ===== */
.image-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.image-preview-list img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e8e8e8;
}

.file-info {
  font-size: 12px;
  color: #999;
  margin-top: 8px;
}

/* ===== Pagination / Count ===== */
.table-info {
  padding: 12px 16px;
  background: #fafafa;
  font-size: 13px;
  color: #999;
  border-top: 1px solid #e8e8e8;
}
