/* ===== Novel Workshop Styles ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.8);
  --border-color: rgba(139, 92, 246, 0.15);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-purple: #8b5cf6;
  --accent-blue: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --gradient-main: linear-gradient(135deg, #8b5cf6, #6366f1);
  --radius: 12px;
}

body {
  font-family: 'Inter', 'Noto Serif SC', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo { font-size: 28px; }

.sidebar-header h2 {
  font-size: 16px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  background: none; border: none; color: var(--text-secondary);
  font-size: 14px; cursor: pointer; text-align: left;
  transition: all 0.2s ease; font-family: inherit;
}

.nav-item:hover { background: rgba(139,92,246,0.1); color: var(--text-primary); }
.nav-item.active { background: rgba(139,92,246,0.15); color: var(--accent-purple); font-weight: 600; }

.nav-icon { font-size: 18px; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.stats-mini { display: flex; gap: 16px; }

.mini-stat { text-align: center; flex: 1; }
.mini-value { font-size: 20px; font-weight: 700; color: var(--accent-purple); display: block; }
.mini-label { font-size: 10px; color: var(--text-muted); }

/* ===== Main Area ===== */
.main-area {
  margin-left: 240px; flex: 1; padding: 32px;
  max-width: 1200px;
}

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== View Header ===== */
.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}

.view-header h1 { font-size: 24px; font-weight: 700; }

/* ===== Buttons ===== */
.btn {
  padding: 8px 18px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.2s ease; font-family: inherit;
}

.btn-primary {
  background: var(--gradient-main); color: white;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(139,92,246,0.3); }

.btn-secondary {
  background: rgba(100,116,139,0.2); color: var(--text-secondary); border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: rgba(100,116,139,0.3); }

/* ===== Project Card ===== */
.novel-project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(10px);
}

.project-empty { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 48px; display: block; margin-bottom: 16px; }
.project-empty h3 { font-size: 18px; margin-bottom: 8px; }
.project-empty p { color: var(--text-muted); font-size: 14px; }

.project-title-bar {
  display: flex; align-items: center; gap: 16px; margin-bottom: 12px;
}

.project-title-bar h2 { font-size: 22px; }

.status-badge {
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
  background: rgba(139,92,246,0.15); color: var(--accent-purple);
}

.project-synopsis { color: var(--text-secondary); font-size: 14px; line-height: 1.7; margin-bottom: 20px; }

.project-stats {
  display: flex; gap: 32px; padding: 16px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.p-stat { text-align: center; }
.p-stat-value { font-size: 24px; font-weight: 700; color: var(--accent-purple); display: block; }
.p-stat-label { font-size: 11px; color: var(--text-muted); }

/* ===== Progress Bar ===== */
.progress-section { margin-bottom: 20px; }

.progress-header {
  display: flex; justify-content: space-between;
  font-size: 13px; margin-bottom: 8px;
}

.progress-bar {
  height: 8px; background: rgba(139,92,246,0.1); border-radius: 4px; overflow: hidden;
}

.progress-fill {
  height: 100%; background: var(--gradient-main); border-radius: 4px;
  transition: width 0.5s ease;
}

/* ===== Progress Table ===== */
.chapter-progress h3 { font-size: 15px; margin-bottom: 12px; }

.progress-table { width: 100%; border-collapse: collapse; }
.progress-table th { text-align: left; padding: 8px 12px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border-color); }
.progress-table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid rgba(99,102,241,0.05); }
.empty-row { text-align: center; color: var(--text-muted); padding: 24px !important; }

/* ===== Quick Actions ===== */
.quick-actions { display: flex; gap: 8px; margin-top: 20px; }

.action-btn {
  padding: 8px 16px; border-radius: 8px;
  background: rgba(139,92,246,0.1); border: 1px solid var(--border-color);
  color: var(--text-secondary); font-size: 13px; cursor: pointer;
  transition: all 0.2s ease; font-family: inherit;
}
.action-btn:hover { background: rgba(139,92,246,0.2); color: var(--text-primary); }

/* ===== Tips Card ===== */
.tips-card {
  margin-top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
}

.tips-card h3 { font-size: 15px; margin-bottom: 12px; }
.tips-card ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tips-card li { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* ===== Chapters List ===== */
.chapters-list { display: flex; flex-direction: column; gap: 8px; }

.chapter-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chapter-item:hover {
  border-color: var(--accent-purple);
  transform: translateX(4px);
}

.chapter-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(139,92,246,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--accent-purple);
  flex-shrink: 0;
}

.chapter-info { flex: 1; }
.chapter-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.chapter-meta { font-size: 12px; color: var(--text-muted); }

.chapter-status {
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 500;
}

.status-draft { background: rgba(245,158,11,0.15); color: var(--accent-amber); }
.status-done { background: rgba(16,185,129,0.15); color: var(--accent-emerald); }

.chapter-actions { display: flex; gap: 4px; }

.chapter-action-btn {
  width: 32px; height: 32px; border-radius: 6px;
  background: none; border: 1px solid var(--border-color);
  color: var(--text-muted); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.chapter-action-btn:hover { background: rgba(139,92,246,0.1); color: var(--text-primary); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 90%; max-width: 600px;
  max-height: 85vh; overflow-y: auto;
}

.modal-lg { max-width: 720px; }

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

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

.modal-close {
  width: 32px; height: 32px; border-radius: 6px;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px;
}
.modal-close:hover { background: rgba(244,63,94,0.1); color: var(--accent-rose); }

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

/* ===== Form ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

input, select, textarea {
  padding: 10px 14px; border-radius: 8px;
  background: rgba(15,23,42,0.6); border: 1px solid var(--border-color);
  color: var(--text-primary); font-size: 14px; font-family: inherit;
  transition: border-color 0.2s ease;
}

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-purple); }
textarea { resize: vertical; line-height: 1.6; }

/* ===== Read Mode ===== */
.read-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  min-height: 400px;
}

.chapter-select {
  padding: 8px 16px; border-radius: 8px;
  background: rgba(15,23,42,0.6); border: 1px solid var(--border-color);
  color: var(--text-primary); font-size: 14px; font-family: inherit;
}

.read-content {
  padding: 40px;
  font-family: 'Noto Serif SC', serif;
  line-height: 2;
  font-size: 16px;
}

.read-content h1 { font-size: 28px; margin-bottom: 8px; }
.read-content .read-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 32px; font-family: 'Inter', sans-serif; }
.read-content p { margin-bottom: 1.5em; text-indent: 2em; }

/* ===== Outline ===== */
.outline-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.outline-tabs { display: flex; gap: 4px; padding: 16px 20px 0; }

.outline-tab {
  padding: 8px 16px; border-radius: 8px 8px 0 0;
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.outline-tab.active { background: rgba(139,92,246,0.15); color: var(--accent-purple); }

.outline-content { padding: 24px; min-height: 300px; }
.outline-content pre { white-space: pre-wrap; font-family: 'Noto Serif SC', serif; line-height: 1.8; font-size: 14px; color: var(--text-secondary); }

/* ===== Versions ===== */
.versions-list { display: flex; flex-direction: column; gap: 8px; }

.version-item {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.version-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-purple); flex-shrink: 0;
}

.version-info { flex: 1; }
.version-title { font-size: 14px; font-weight: 600; }
.version-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h2, .nav-item span:not(.nav-icon), .mini-label { display: none; }
  .sidebar-header { justify-content: center; padding: 16px 0; }
  .nav-item { justify-content: center; padding: 12px; }
  .main-area { margin-left: 60px; padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
