/* ============================================
   WorkBuddy 自学网站 — 全局样式
   ============================================ */

/* ---- CSS Variables (Light Theme) ---- */
:root {
  --bg: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-card: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #666;
  --text-muted: #999;
  --border: #e5e7eb;
  --accent: #378ADD;
  --accent-light: #e8f2fd;
  --accent-hover: #2b6fc4;
  --success: #1D9E75;
  --warning: #EF9F27;
  --purple: #7F77DD;
  --header-bg: rgba(255,255,255,0.92);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
  --bg: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #1f2b47;
  --text: #e4e6eb;
  --text-secondary: #b0b3b8;
  --text-muted: #6c757d;
  --border: #2d3748;
  --accent: #5a9fd4;
  --accent-light: #1a2740;
  --accent-hover: #72b8e0;
  --header-bg: rgba(26,26,46,0.92);
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.4);
}

/* ---- Reset ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.header-nav a:hover { color: var(--text); }
.header-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s;
}
.theme-toggle:hover {
  background: var(--bg-secondary);
}

/* ---- Hero ---- */
.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 24px 48px;
  text-align: center;
}
.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 32px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--bg-secondary);
}

/* ---- Route Cards ---- */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 48px;
}
.section-title {
  text-align: center;
  margin-bottom: 32px;
}
.section-title h2 { margin-bottom: 8px; }
.section-title p { color: var(--text-secondary); }

.route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.route-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all 0.3s;
  cursor: pointer;
}
.route-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.route-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}

.route-card h3 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}
.route-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.route-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Color variants for icons */
.icon-blue { background: var(--accent-light); color: var(--accent); }
.icon-purple { background: #eeedfe; color: #7F77DD; }
.icon-green { background: #e1f5ee; color: #1D9E75; }
.icon-orange { background: #faeeda; color: #EF9F27; }
.icon-pink { background: #fbeaf0; color: #D4537E; }

/* ---- Tutorial Content ---- */
.tutorial {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}
.tutorial-breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.tutorial-breadcrumb a { color: var(--accent); }

.tutorial h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}
.tutorial-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
  display: flex;
  gap: 16px;
}

.tutorial h2 {
  margin-top: 40px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.tutorial h3 {
  margin-top: 28px;
  margin-bottom: 8px;
  color: var(--accent);
}

.tutorial p {
  margin-bottom: 14px;
}

/* ---- Prompt Box ---- */
.prompt-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 20px 0;
  position: relative;
}
.prompt-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.prompt-box-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.copy-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.copy-btn.copied { background: var(--success); color: #fff; border-color: var(--success); }

.prompt-box code {
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Tip Box ---- */
.tip-box {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 0.9rem;
}
.tip-box strong { color: var(--accent); }

/* ---- Step List ---- */
.step {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.step-body { flex: 1; }
.step-body h4 { margin-bottom: 4px; }
.step-body p { color: var(--text-secondary); font-size: 0.9rem; margin: 0; }

/* ---- Quiz ---- */
.quiz {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 32px;
}
.quiz h3 { color: var(--text); margin-top: 0; margin-bottom: 16px; }
.quiz-item { margin-bottom: 18px; }
.quiz-item p { font-weight: 600; margin-bottom: 8px; }
.quiz-option {
  display: block;
  padding: 8px 12px;
  margin-bottom: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}
.quiz-option:hover { background: var(--bg-secondary); }

.quiz-check-btn {
  margin-top: 12px;
}

/* ---- Next/Prev Nav ---- */
.tutorial-nav {
  max-width: 800px;
  margin: 0 auto 40px;
  padding: 0 24px;
  display: flex;
  gap: 16px;
}
.tutorial-nav a {
  flex: 1;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tutorial-nav a:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.tutorial-nav .nav-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.tutorial-nav .nav-title {
  font-weight: 600;
  font-size: 0.95rem;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---- Prompt Library ---- */
.prompt-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  justify-content: center;
}
.filter-tag {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
  color: var(--text-secondary);
}
.filter-tag:hover { border-color: var(--accent); color: var(--accent); }
.filter-tag.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.prompt-list {
  max-width: 800px;
  margin: 0 auto;
}

/* ---- Search ---- */
.search-trigger {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
  color: var(--text-secondary);
}
.search-trigger:hover {
  background: var(--bg-secondary);
  color: var(--accent);
  border-color: var(--accent);
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.search-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.search-modal {
  width: 90vw;
  max-width: 600px;
  max-height: 70vh;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.search-icon { font-size: 18px; color: var(--text-muted); }
.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.05rem;
  background: transparent;
  color: var(--text);
  font-family: inherit;
}
.search-input::placeholder { color: var(--text-muted); }
.search-kbd {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-family: monospace;
}

.search-results {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}
.search-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-result-item {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s;
  border: 1px solid transparent;
  outline: none;
}
.search-result-item:hover,
.search-result-item:focus {
  background: var(--accent-light);
  border-color: var(--accent);
}
.search-result-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.search-result-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.search-result-route {
  color: var(--text-muted);
  font-size: 0.75rem;
}
.search-no-result {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-results mark {
  background: #fff3bf;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}
[data-theme="dark"] .search-results mark {
  background: #5c4a1f;
}

/* ---- Content Lock Overlay ---- */
.wb-lock-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.wb-lock-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 40px 32px; text-align: center; max-width: 420px;
  width: 90vw; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.wb-lock-icon { font-size: 48px; margin-bottom: 16px; }
.wb-lock-card h2 { font-size: 1.15rem; margin-bottom: 8px; }
.wb-lock-card p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }
.wb-lock-actions { display: flex; flex-direction: column; gap: 10px; }
.wb-lock-actions .btn { width: 100%; justify-content: center; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .route-grid { grid-template-columns: 1fr; }
  .header-nav { gap: 12px; }
  .header-nav a { font-size: 0.8rem; }
  .tutorial-nav { flex-direction: column; }
}
