/* wp-auto 前端樣式 */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft JhengHei", "PingFang TC", sans-serif;
  background: #f5f1ea;
  color: #333;
  line-height: 1.6;
  padding: 0;
}

/* Header */
.header {
  background: linear-gradient(135deg, #8bb3d9 0%, #5a7a9a 100%);
  color: white;
  padding: 16px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.header h1 {
  font-size: 1.4em;
  font-weight: 600;
}

.header .nav {
  display: flex;
  gap: 12px;
}

.header .nav a {
  color: white;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  font-size: 0.9em;
  transition: background 0.2s;
}

.header .nav a:hover {
  background: rgba(255,255,255,0.3);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
  color: rgba(255,255,255,0.9);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aaa;
}

.status-dot.online { background: #4caf50; }
.status-dot.offline { background: #e74c3c; }

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.card h2 {
  font-size: 1.1em;
  margin-bottom: 16px;
  color: #5a7a9a;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form */
.form-grid {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: center;
}

.form-row label {
  font-weight: 500;
  color: #555;
  font-size: 0.95em;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95em;
  background: #faf9f6;
  transition: border 0.2s, background 0.2s;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: #8bb3d9;
  background: white;
}

.form-row textarea {
  min-height: 70px;
  font-family: inherit;
  resize: vertical;
}

.form-row .hint {
  font-size: 0.82em;
  color: #999;
  margin-top: 4px;
}

.mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid #eee;
}

.mode-tab {
  padding: 10px 18px;
  cursor: pointer;
  color: #888;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-size: 0.95em;
  font-weight: 500;
}

.mode-tab.active {
  color: #5a7a9a;
  border-bottom-color: #8bb3d9;
}

.mode-content { display: none; }
.mode-content.active { display: block; }

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 500;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, #8bb3d9, #5a7a9a);
  color: white;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-secondary {
  background: #e8dcc5;
  color: #6a5a3a;
}

.btn-secondary:hover { background: #d8cbb0; }

.btn-danger {
  background: #e57373;
  color: white;
}

.btn-danger:hover { background: #d05656; }

.btn-small {
  padding: 5px 10px;
  font-size: 0.82em;
}

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

/* Task list */
.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  background: white;
  border-radius: 10px;
  padding: 14px 18px;
  border-left: 4px solid #ccc;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s;
}

.task-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.task-card.status-待處理 { border-left-color: #aaa; }
.task-card.status-處理中,
.task-card.status-生成文章中,
.task-card.status-生成圖片中,
.task-card.status-上傳中 { border-left-color: #f0b94a; background: #fffaf0; }
.task-card.status-完成 { border-left-color: #4caf50; }
.task-card.status-失敗 { border-left-color: #e57373; background: #fff5f5; }

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.task-title {
  font-weight: 600;
  color: #333;
  flex: 1;
  min-width: 200px;
}

.task-meta {
  font-size: 0.82em;
  color: #888;
  margin: 4px 0;
}

.task-meta span {
  display: inline-block;
  margin-right: 10px;
}

.task-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 500;
  background: #eee;
  color: #666;
}

.task-status.status-處理中,
.task-status.status-生成文章中,
.task-status.status-生成圖片中,
.task-status.status-上傳中 {
  background: #fff3cd;
  color: #856404;
}

.task-status.status-完成 { background: #d4edda; color: #155724; }
.task-status.status-失敗 { background: #f8d7da; color: #721c24; }

.progress-bar {
  height: 4px;
  background: #eee;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8bb3d9, #5a7a9a);
  transition: width 0.3s;
}

.progress-note {
  font-size: 0.88em;
  color: #8b6a0f;
  margin-top: 6px;
  font-style: italic;
}

.task-result {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #eee;
  font-size: 0.9em;
}

.task-result a {
  color: #5a7a9a;
  text-decoration: none;
}

.task-result a:hover { text-decoration: underline; }

.task-error {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fff5f5;
  border-radius: 6px;
  font-size: 0.85em;
  color: #c0392b;
}

.task-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: 16px;
  background: #eee;
  font-size: 0.85em;
  cursor: pointer;
  border: none;
  color: #555;
  transition: all 0.2s;
}

.filter-chip.active {
  background: #5a7a9a;
  color: white;
}

.filter-chip:hover:not(.active) { background: #ddd; }

/* Topics page */
.topic-item {
  background: white;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.topic-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-top: 4px;
}

.topic-content {
  display: grid;
  gap: 4px;
}

.topic-title {
  font-weight: 600;
  font-size: 1.02em;
}

.topic-reason {
  font-size: 0.88em;
  color: #888;
  font-style: italic;
}

.topic-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.topic-tag {
  font-size: 0.78em;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e8dcc5;
  color: #6a5a3a;
}

.topic-tag.keyword { background: #dae8f5; color: #445f7a; }
.topic-tag.type { background: #d4e8d4; color: #3a5a3a; }

.topic-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: end;
}

.batch-bar {
  position: sticky;
  top: 0;
  background: #fffbf0;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #e8dcc5;
  z-index: 10;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #999;
}

.empty-state .icon {
  font-size: 3em;
  opacity: 0.3;
  margin-bottom: 12px;
}

/* Notification */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 18px;
  border-radius: 8px;
  color: white;
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  animation: slideIn 0.3s;
}

.notification.success { background: #4caf50; }
.notification.error { background: #e57373; }
.notification.info { background: #5a7a9a; }

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

/* Responsive */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .form-row label { margin-bottom: -4px; }
  .container { padding: 12px; }
  .header h1 { font-size: 1.1em; }
}
