/* OpenDraft User Manual - Stylesheet */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-sidebar: #f1f5f9;
  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --code-bg: #f1f5f9;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --radius: 8px;
  --sidebar-width: 280px;
  --header-height: 60px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

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

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}

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

.header-search {
  flex: 1;
  max-width: 480px;
  margin: 0 32px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 8px 16px 8px 40px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  background: var(--bg-alt);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.header-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-lighter);
  font-size: 14px;
}

.header-search .search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-lighter);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

.header-nav {
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.header-nav a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.header-nav a:hover {
  color: var(--primary);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 50;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-lighter);
  padding: 8px 20px 4px;
}

.sidebar-link {
  display: block;
  padding: 6px 20px 6px 28px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}

.sidebar-link.active {
  color: var(--primary);
  background: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar-link .sidebar-icon {
  display: inline-block;
  width: 20px;
  margin-right: 4px;
  text-align: center;
}

/* Hamburger for mobile */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  padding: 4px 8px;
  margin-right: 8px;
}

/* Main content */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.content {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 48px 80px;
}

/* Typography */
h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 18px;
  color: var(--text-light);
  margin-bottom: 32px;
  font-weight: 400;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text);
}

h4 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
}

p {
  margin-bottom: 16px;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

li {
  margin-bottom: 6px;
}

li > ul, li > ol {
  margin-top: 6px;
  margin-bottom: 0;
}

/* Keyboard shortcuts */
kbd {
  display: inline-block;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 7px;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  line-height: 1.6;
}

/* Code */
code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

/* Callout boxes */
.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 15px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.callout-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.callout-content {
  flex: 1;
}

.callout-content p:last-child {
  margin-bottom: 0;
}

.callout-tip {
  background: #f0fdf4;
  border-left: 4px solid var(--success);
}

.callout-info {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
}

.callout-warning {
  background: #fefce8;
  border-left: 4px solid var(--warning);
}

.callout-danger {
  background: #fef2f2;
  border-left: 4px solid var(--danger);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 15px;
}

th {
  text-align: left;
  padding: 10px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-light);
}

td {
  padding: 10px 16px;
  border: 1px solid var(--border);
}

tr:hover td {
  background: var(--bg-alt);
}

/* Screenshot placeholder */
.screenshot {
  border-radius: var(--radius);
  text-align: center;
  margin: 20px 0;
}

.screenshot img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.screenshot .screenshot-label {
  margin-top: 8px;
  font-style: italic;
}

/* Step-by-step instructions */
.steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.steps li {
  counter-increment: step;
  padding: 12px 0 12px 52px;
  position: relative;
  border-left: 2px solid var(--border);
  margin-left: 16px;
  margin-bottom: 0;
}

.steps li:last-child {
  border-left-color: transparent;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: -16px;
  top: 10px;
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  text-align: center;
  line-height: 30px;
  font-size: 14px;
  font-weight: 700;
}

/* Feature cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0 28px;
}

.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  display: block;
}

.feature-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-1px);
}

.feature-card-icon {
  font-size: 28px;
  margin-bottom: 10px;
}

.feature-card h3 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 16px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 0;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 13px;
  color: var(--text-lighter);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--text-lighter);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .sep {
  margin: 0 6px;
}

/* Search results overlay */
.search-results {
  position: fixed;
  top: var(--header-height);
  left: 50%;
  transform: translateX(-50%);
  width: 560px;
  max-height: 420px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  z-index: 200;
  display: none;
  margin-top: 4px;
}

.search-results.visible {
  display: block;
}

.search-result-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: var(--text);
}

.search-result-item:hover {
  background: var(--bg-alt);
  text-decoration: none;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

.search-result-section {
  font-size: 12px;
  color: var(--text-lighter);
}

.search-result-snippet {
  font-size: 13px;
  color: var(--text-light);
}

.search-result-snippet mark {
  background: #fef08a;
  color: var(--text);
  border-radius: 2px;
  padding: 0 1px;
}

.search-no-results {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-lighter);
  font-size: 14px;
}

/* Page navigation (prev/next) */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  gap: 16px;
}

.page-nav a {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s;
  min-width: 160px;
}

.page-nav a:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.page-nav .nav-label {
  font-size: 12px;
  color: var(--text-lighter);
  margin-bottom: 4px;
}

.page-nav .nav-title {
  font-weight: 600;
  color: var(--text);
}

.page-nav .nav-next {
  text-align: right;
  margin-left: auto;
}

/* On-this-page (right sidebar) */
.toc-sidebar {
  position: fixed;
  top: var(--header-height);
  right: 0;
  width: 220px;
  padding: 24px 16px;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-height));
  font-size: 13px;
}

.toc-sidebar-title {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-lighter);
  margin-bottom: 12px;
}

.toc-sidebar a {
  display: block;
  padding: 3px 0 3px 12px;
  color: var(--text-light);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.toc-sidebar a:hover {
  color: var(--primary);
}

.toc-sidebar a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 500;
}

.toc-sidebar a.indent {
  padding-left: 24px;
  font-size: 12px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  text-align: center;
  font-size: 13px;
  color: var(--text-lighter);
}

/* Responsive */
@media (max-width: 1200px) {
  .toc-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 150;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }

  .menu-toggle {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .content {
    padding: 24px 20px 60px;
  }

  h1 { font-size: 26px; }
  h2 { font-size: 20px; }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .header-search {
    margin: 0 12px;
  }

  .header-nav {
    display: none;
  }

  .page-nav {
    flex-direction: column;
  }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 140;
}

.sidebar-overlay.visible {
  display: block;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Print */
@media print {
  .header, .sidebar, .toc-sidebar, .search-results, .page-nav, .menu-toggle, .sidebar-overlay {
    display: none !important;
  }
  .main {
    margin-left: 0;
  }
  .content {
    max-width: 100%;
    padding: 0;
  }
}
