/* ===== 天禹AI平台 — 品牌設計系統 =====
 * 配色：極黑 #0D0D0D / 深咖啡棕 #2B1810 / 純金 #D4AF37 / 香檳金 #C9A876 / 象牙白 #F5EFE6
 * 字體：Noto Serif TC（標題）+ Noto Sans TC（內文）
 * 風格：極簡乾淨、細金線分隔、卡片式區塊、留白多
 * ============================================ */

/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@400;600;700&family=Noto+Sans+TC:wght@300;400;500;600&display=swap');

/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0D0D0D;
  --bg-secondary: #121212;
  --bg-card: #1A1A1A;
  --bg-hover: #222222;
  --border: #2A2A2A;
  --border-light: #3A3A3A;
  --text-primary: #F5EFE6;
  --text-secondary: #C9A876;
  --text-muted: #8A8A8A;
  --accent: #D4AF37;
  --accent-hover: #E0C04A;
  --accent-dim: rgba(212, 175, 55, 0.08);
  --gold: #D4AF37;
  --gold-light: #C9A876;
  --gold-dim: rgba(212, 175, 55, 0.15);
  --success: #22c55e;
  --sidebar-width: 280px;
  --header-height: 0px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 300;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  font-family: 'Noto Serif TC', serif;
  letter-spacing: 1px;
}

.sidebar-logo img { width: 32px; height: 32px; border-radius: 6px; }

.sidebar-logo .gold-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  margin-left: 2px;
}

.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 300;
}

.sidebar-search input:focus { border-color: var(--gold); }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-weight: 300;
  position: relative;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { 
  background: var(--accent-dim); 
  color: var(--gold); 
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.nav-item .icon { width: 20px; text-align: center; font-size: 16px; }
.nav-item .badge {
  margin-left: auto;
  background: var(--border);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-section-title {
  padding: 20px 20px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 8px 28px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 300;
}

.history-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.history-item .more { margin-left: auto; opacity: 0; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.history-item:hover .more { opacity: 1; }
.history-item .more:hover { background: var(--border); }

.sidebar-user {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.sidebar-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--bg-primary);
  font-weight: 600;
}

.sidebar-user .plan-badge {
  margin-left: auto;
  font-size: 10px;
  color: var(--gold);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  padding: 40px 48px;
  max-width: 1200px;
  overflow-y: auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  font-family: 'Noto Serif TC', serif;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.page-header .link {
  color: var(--gold);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
}

.page-header .link:hover { text-decoration: underline; }

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-weight: 300;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* ===== Persona Selector ===== */
.persona-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.persona-btn {
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 300;
}

.persona-btn:hover { border-color: var(--gold); color: var(--text-primary); }
.persona-btn.active { 
  border-color: var(--gold); 
  background: var(--accent-dim); 
  color: var(--gold);
  font-weight: 500;
}
.persona-btn.secondary { 
  color: var(--text-muted); 
  font-size: 12px; 
  border-style: dashed;
}

/* ===== Tab Bar ===== */
.tab-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
  border: 1px solid var(--border);
}

.tab-btn {
  padding: 7px 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 300;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { 
  background: var(--bg-primary); 
  color: var(--gold);
  font-weight: 500;
}
.tab-btn .badge {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* ===== Info Box ===== */
.info-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  font-weight: 300;
}

.info-box strong { color: var(--text-primary); font-weight: 500; }

/* ===== Section Card ===== */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.section-card:hover { border-color: var(--border-light); }

.section-card h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
  font-family: 'Noto Serif TC', serif;
  color: var(--text-primary);
}

.section-card .desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
  font-weight: 300;
}

/* ===== Text Input ===== */
.text-input {
  width: 100%;
  min-height: 100px;
  padding: 14px 18px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  resize: vertical;
  font-family: 'Noto Sans TC', sans-serif;
  line-height: 1.7;
  font-weight: 300;
  transition: border-color 0.2s;
}

.text-input:focus { border-color: var(--gold); }
.text-input::placeholder { color: var(--text-muted); opacity: 0.6; }

.input-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
  padding: 8px 18px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 300;
}

.btn:hover { 
  background: var(--bg-hover); 
  border-color: var(--border-light); 
  color: var(--text-primary);
}

.btn.primary { 
  background: var(--gold); 
  border-color: var(--gold); 
  color: var(--bg-primary);
  font-weight: 500;
}
.btn.primary:hover { 
  background: var(--accent-hover); 
  border-color: var(--accent-hover);
  color: var(--bg-primary);
}
.btn.primary:disabled { 
  opacity: 0.3; 
  cursor: not-allowed; 
  background: var(--border);
  border-color: var(--border);
  color: var(--text-muted);
}

.btn.danger { color: #ef4444; }
.btn.danger:hover { border-color: #ef4444; background: rgba(239,68,68,0.1); }
.btn.small { padding: 4px 10px; font-size: 11px; }

.file-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 300;
}

.distilled-files {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 300;
}

.distilled-files:hover { border-color: var(--border-light); }
.distilled-files .count { color: var(--gold); font-weight: 500; }

/* ===== DNA Tabs ===== */
.dna-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
  border: 1px solid var(--border);
}

.dna-tab {
  padding: 7px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 300;
}

.dna-tab:hover { color: var(--text-primary); }
.dna-tab.active { 
  background: var(--bg-primary); 
  color: var(--gold);
  font-weight: 500;
}

.dna-dimension { display: none; }
.dna-dimension.active { display: block; }

.dna-dimension h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Noto Serif TC', serif;
  color: var(--text-primary);
}

.dna-dimension .clear-btn {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: 'Noto Sans TC', sans-serif;
}

.dna-dimension .clear-btn:hover { color: #ef4444; border-color: #ef4444; }

.dna-entry {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
  font-weight: 300;
  transition: border-color 0.15s;
}

.dna-entry:hover { border-color: var(--border-light); }

.dna-entry .source-btn {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--gold);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: 'Noto Sans TC', sans-serif;
}

.dna-entry .source-btn:hover { text-decoration: underline; }

.dna-entry .source-text {
  display: none;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  border-left: 2px solid var(--gold);
  line-height: 1.6;
}

.dna-entry .source-text.show { display: block; }

.dna-entry .entry-actions {
  float: right;
  display: flex;
  gap: 4px;
}

.dna-entry .entry-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.15s;
}

.dna-entry .entry-actions button:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ===== Memory Section ===== */
.memory-textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px 18px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  resize: vertical;
  font-family: 'Noto Sans TC', sans-serif;
  line-height: 1.7;
  font-weight: 300;
  transition: border-color 0.2s;
}

.memory-textarea:focus { border-color: var(--gold); }
.memory-textarea::placeholder { color: var(--text-muted); opacity: 0.6; }

/* ===== Bottom Actions ===== */
.bottom-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.bottom-actions .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 300;
}

/* ===== Dialog ===== */
.dialog-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.dialog-overlay.show { display: flex; }

.dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 90%;
}

.dialog h2 { 
  font-size: 18px; 
  margin-bottom: 12px; 
  font-family: 'Noto Serif TC', serif;
  color: var(--text-primary);
}
.dialog p { 
  font-size: 13px; 
  color: var(--text-muted); 
  line-height: 1.7; 
  margin-bottom: 20px;
  font-weight: 300;
}
.dialog .btn-group { display: flex; gap: 8px; justify-content: flex-end; }

/* ===== Loading ===== */
.loading {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

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

/* ===== Workshop Canvas ===== */
.workshop-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.workshop-left {
  min-width: 0;
}

.workshop-right {
  min-width: 0;
}

.canvas-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.canvas-area h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  font-family: 'Noto Serif TC', serif;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-area h3 .gold-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.canvas-content {
  flex: 1;
  width: 100%;
  min-height: 300px;
  padding: 14px 18px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  resize: none;
  font-family: 'Noto Sans TC', sans-serif;
  line-height: 1.7;
  font-weight: 300;
}

.canvas-content:focus { border-color: var(--gold); }

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

.canvas-versions {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ===== Workshop Tools Grid ===== */
.workshop-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ===== Coach YAO ===== */
.yao-header {
  text-align: center;
  padding: 20px 0;
}

.yao-header .yao-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.yao-header h2 {
  font-size: 20px;
  font-weight: 700;
  font-family: 'Noto Serif TC', serif;
  color: var(--text-primary);
}

.yao-header p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
  margin-top: 4px;
}

.yao-quick-prompts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.yao-quick-prompts .btn {
  font-size: 12px;
  padding: 6px 14px;
  border-color: var(--border);
  color: var(--text-muted);
}

.yao-quick-prompts .btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ===== Courses ===== */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .workshop-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px; }
  .workshop-tools-grid,
  .courses-grid {
    grid-template-columns: 1fr;
  }
}
