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

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --accent: #a78bfa;
  --bg: #0f0f1a;
  --bg-deep: #0a0a14;
  --bg-card: #161625;
  --bg-card-hover: #1c1c30;
  --bg-input: #1a1a2e;
  --text: #e8e8f0;
  --text-dim: #8888a8;
  --text-muted: #5a5a78;
  --border: #2a2a42;
  --border-light: #3a3a55;
  --success: #34d399;
  --success-bg: #064e3b;
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-bg: #7f1d1d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --glow: 0 0 30px rgba(99,102,241,0.15);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99,102,241,0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(167,139,250,0.08), transparent);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ========== HEADER ========== */
.header {
  text-align: center;
  padding: 48px 0 36px;
  position: relative;
}
.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}
.header h1 {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #818cf8, #a78bfa, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}
.header p {
  color: var(--text-dim);
  font-size: 15px;
  max-width: 500px;
  margin: 0 auto;
}

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 6px;
  margin: 28px 0 28px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 5px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.tab-btn {
  flex: 1;
  padding: 12px 10px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.25s ease;
  position: relative;
}
.tab-btn:hover {
  color: var(--text);
  background: rgba(99,102,241,0.08);
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 12px rgba(99,102,241,0.35);
}

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-light); }
.card h3 {
  font-size: 17px;
  margin-bottom: 20px;
  color: var(--text);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px;
}

/* ========== FORM ========== */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 7px;
  font-weight: 500;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-group textarea { min-height: 180px; resize: vertical; line-height: 1.7; }
.form-group select { cursor: pointer; 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 fill='%238888a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-group select option { background: var(--bg-card); color: var(--text); }

/* ========== BUTTONS ========== */
.btn {
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99,102,241,0.45);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-sm { padding: 7px 16px; font-size: 12px; border-radius: 8px; }
.btn-success { background: var(--success); color: #064e3b; font-weight: 600; }
.btn-success:hover { background: #6ee7b7; }
.btn-danger { background: var(--danger); color: white; font-weight: 600; }
.btn-danger:hover { background: #fca5a5; }
.btn-warning { background: var(--warning); color: #422006; font-weight: 600; }
.btn-warning:hover { background: #fde68a; }

/* ========== PROGRESS ========== */
.progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.progress-bar {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin: 14px 0;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.progress-text { font-size: 13px; color: var(--text-dim); }

/* ========== INSTRUCTIONS ========== */
.instructions {
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(167,139,250,0.04));
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
}
.instructions h4 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--primary-light);
  font-weight: 600;
}
.instructions ol {
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-dim);
}
.instructions li { margin-bottom: 5px; }

/* ========== BLOG LIST ========== */
.blog-list { display: grid; gap: 14px; }
.blog-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}
.blog-item:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.blog-item-info h4 {
  font-size: 15px;
  margin-bottom: 4px;
  font-weight: 600;
}
.blog-item-info p {
  font-size: 12px;
  color: var(--text-dim);
}
.blog-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ========== CHAT ========== */
.chat-container {
  height: 420px;
  display: flex;
  flex-direction: column;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}
.chat-msg {
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.chat-msg.user {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
  max-width: 75%;
}
.chat-msg.bot {
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-right: auto;
  border-bottom-left-radius: 4px;
  max-width: 80%;
}
.chat-msg.system {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  max-width: 100%;
  padding: 8px;
}
.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-input-row input {
  flex: 1;
  padding: 11px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.chat-input-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-pending { background: #1e293b; color: var(--text-dim); }
.badge-running { background: #1e3a5f; color: #60a5fa; }
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.empty-state .emoji { font-size: 36px; display: block; margin-bottom: 12px; }

/* ========== SPINNER ========== */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
  .container { padding: 12px 14px 40px; }
  .header { padding: 32px 0 24px; }
  .header h1 { font-size: 24px; }
  .card { padding: 20px; }
  .progress-card { padding: 18px 20px; }
  .chat-container { height: 320px; }
  .tabs { flex-wrap: wrap; }
  .tab-btn { font-size: 12px; padding: 10px 6px; }
  .blog-item { flex-direction: column; align-items: flex-start; gap: 12px; }
  .blog-item-actions { width: 100%; }
  .blog-item-actions .btn { flex: 1; justify-content: center; }
  .chat-msg.user { max-width: 85%; }
  .chat-msg.bot { max-width: 90%; }
}

/* ========== ANIMATIONS ========== */
.tab-content { animation: fadeIn 0.25s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== OUTPUT MODE TOGGLE ========== */
.mode-toggle {
  display: flex;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.mode-toggle input[type="radio"] { display: none; }
.mode-toggle label {
  flex: 1;
  padding: 11px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-input);
  cursor: pointer;
  transition: all 0.2s;
}
.mode-toggle input:checked + label {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}
.mode-toggle label:hover:not(:has(input:checked)) {
  background: var(--bg-card-hover);
  color: var(--text);
}
