/* ============================================
   Qian Site - Base Styles
   全站基础样式 + CSS Variables（浅/深色主题）
   ============================================ */

/* CSS Variables - Light Theme (Default) */
:root {
  /* Background Colors */
  --bg: #f8f9fc;
  --bg-secondary: #f1f3f9;
  --card: #ffffff;
  
  /* Text Colors */
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  
  /* Border & Divider */
  --border: #e5e7eb;
  --divider: #f0f0f0;
  
  /* Accent Colors */
  --accent: #5e6ad2;
  --accent-hover: #4f5bc4;
  --accent-light: rgba(94, 106, 210, 0.1);
  
  /* Status Colors */
  --status-open: #3b82f6;
  --status-accepted: #f59e0b;
  --status-doing: #8b5cf6;
  --status-done: #10b981;
  --status-archived: #6b7280;
  
  /* Type Badge Colors */
  --type-widget: #3b82f6;
  --type-framework: #8b5cf6;
  --type-bug: #ef4444;
  --type-integration: #10b981;
  --type-ui: #f59e0b;
  --type-performance: #06b6d4;
  --type-other: #6b7280;
  
  /* Toast Colors */
  --toast-success: #10b981;
  --toast-error: #ef4444;
  --toast-info: #6b7280;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-drawer: -4px 0 24px rgba(0, 0, 0, 0.1);
  
  /* Spacing & Sizing */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  
  /* Transitions */
  --transition-fast: 100ms ease;
  --transition: 150ms ease;
  --transition-slow: 200ms ease;
  
  /* Layout */
  --header-height: 56px;
  --column-width: 300px;
  --drawer-width: 420px;
}

/* CSS Variables - Dark Theme */
@media (prefers-color-scheme: dark) {
  :root {
    /* Background Colors */
    --bg: #0d0d0f;
    --bg-secondary: #161618;
    --card: #1f1f23;
    
    /* Text Colors */
    --text: #ececf1;
    --text-secondary: #8b8b9a;
    --text-muted: #5c5c66;
    
    /* Border & Divider */
    --border: #2d2d30;
    --divider: #232326;
    
    /* Accent Colors */
    --accent: #8b8eff;
    --accent-hover: #a5a8ff;
    --accent-light: rgba(139, 142, 255, 0.15);
    
    /* Shadows (darker for dark theme) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-drawer: -4px 0 24px rgba(0, 0, 0, 0.4);
  }
}

/* ============================================
   Reset & Base Styles
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

p {
  color: var(--text-secondary);
}

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

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

/* ============================================
   Form Elements
   ============================================ */

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

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

/* ============================================
   Button Group
   ============================================ */

.btn-group {
  display: inline-flex;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.btn-group .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border);
}

.btn-group .btn:last-child {
  border-right: none;
}

.btn-group .btn.active {
  background: var(--accent);
  color: #fff;
}

/* ============================================
   Utilities
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ============================================
   Document Page Layout
   ============================================ */

/* Document Navigation */
.doc-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.doc-nav__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 16px;
}

.doc-nav__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.doc-nav__brand:hover {
  color: var(--accent);
}

.doc-nav__brand svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.doc-nav__links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.doc-nav__link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.doc-nav__link:hover,
.doc-nav__link.active {
  color: var(--accent);
}

/* Document Main Content */
.doc-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

/* Document Header */
.doc-header {
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.doc-header__title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.doc-header__subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.doc-header__meta {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Document Sections */
.doc-section {
  margin-bottom: 48px;
}

.doc-section__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.doc-section__subtitle {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-top: 24px;
  margin-bottom: 12px;
}

/* Document Content Typography */
.doc-content p {
  margin-bottom: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.doc-content ul,
.doc-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.doc-content li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.doc-content li ul,
.doc-content li ol {
  margin-top: 8px;
  margin-bottom: 0;
}

.doc-content strong {
  color: var(--text);
  font-weight: 600;
}

/* Inline Code */
.doc-code,
.doc-content code {
  display: inline;
  background: var(--bg-secondary);
  color: var(--text);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 0.9em;
}

/* Code Block */
.doc-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.doc-content pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* FAQ Styles */
.doc-faq {
  margin-bottom: 16px;
}

.doc-faq__item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.doc-faq__question {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.doc-faq__question::before {
  content: 'Q';
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.doc-faq__answer {
  padding: 0 16px 16px 52px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.doc-faq__answer p {
  margin-bottom: 8px;
}

.doc-faq__answer p:last-child {
  margin-bottom: 0;
}

/* Permission List */
.doc-permission {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 16px;
}

.doc-permission__name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-permission__name code {
  background: var(--accent-light);
  color: var(--accent);
}

.doc-permission__desc {
  color: var(--text-secondary);
  line-height: 1.6;
}

.doc-permission__desc ul {
  margin-top: 8px;
  margin-bottom: 0;
  padding-left: 20px;
}

/* Alert/Note Box */
.doc-note {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px;
  margin-bottom: 16px;
}

.doc-note p {
  margin-bottom: 0;
  color: var(--text);
}

/* Quick Start Steps */
.doc-steps {
  counter-reset: step;
}

.doc-steps__item {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.doc-steps__item::before {
  counter-increment: step;
  content: counter(step);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 50%;
}

.doc-steps__content {
  flex: 1;
  padding-top: 4px;
}

.doc-steps__title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.doc-steps__desc {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Link Cards */
.doc-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.doc-link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all var(--transition);
}

.doc-link-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.doc-link-card__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius);
}

.doc-link-card__icon svg {
  width: 20px;
  height: 20px;
}

.doc-link-card__text {
  flex: 1;
}

.doc-link-card__title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.doc-link-card__desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* Document Footer */
.doc-footer {
  border-top: 1px solid var(--border);
  padding: 32px 20px;
  margin-top: 48px;
}

.doc-footer__inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.doc-footer__links {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.doc-footer__link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.doc-footer__link:hover {
  color: var(--accent);
}

.doc-footer__copyright {
  font-size: 13px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .doc-nav__inner {
    flex-direction: column;
    height: auto;
    padding: 12px 16px;
    gap: 12px;
  }

  .doc-nav__links {
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .doc-main {
    padding: 32px 16px 60px;
  }

  .doc-header__title {
    font-size: 24px;
  }

  .doc-section__title {
    font-size: 18px;
  }

  .doc-faq__answer {
    padding-left: 16px;
  }

  .doc-steps__item {
    flex-direction: column;
    gap: 12px;
  }

  .doc-footer__links {
    gap: 16px;
  }
}
