/* ============================================
   Uplift Documentation System
   Extends site.css with docs-specific styles
   ============================================ */

/* ============================================
   Docs Layout
   ============================================ */

.docs-container {
  display: grid;
  grid-template-columns: 260px 1fr 200px;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 140px);
}

/* Overlay is for mobile only - position absolute to remove from grid flow */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
  display: none;
  pointer-events: none;
}

.sidebar-overlay.active {
  display: block;
  pointer-events: auto;
}

/* Landing page without TOC sidebar */
.docs-container.no-toc {
  grid-template-columns: 260px 1fr;
}

.docs-container.no-toc .docs-toc {
  display: none;
}

/* ============================================
   Search (in nav area)
   ============================================ */

.search-container {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,122,26,0.15);
}

.search-shortcut {
  position: absolute;
  right: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 10px;
  font-family: 'SF Mono', 'Monaco', monospace;
  pointer-events: none;
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  display: none;
  z-index: 200;
}

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

.search-results-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: background var(--transition-fast);
}

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

.search-result-item:hover,
.search-result-item.active {
  background: rgba(255,255,255,0.03);
}

.search-result-category {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-strong);
  margin-bottom: 4px;
}

.search-result-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.search-result-excerpt {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.search-result-excerpt mark {
  background: rgba(255,122,26,0.2);
  color: var(--accent-strong);
  padding: 1px 3px;
  border-radius: 3px;
}

/* ============================================
   Sidebar
   ============================================ */

.docs-sidebar {
  padding: 24px 16px 24px 0;
  border-right: 1px solid var(--border-subtle);
  position: sticky;
  top: 24px;
  height: fit-content;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.docs-sidebar::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Sidebar Home Link */
.sidebar-home {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-home-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  background: rgba(255,255,255,0.03);
}

.sidebar-home-link:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.sidebar-home-link svg {
  color: var(--accent);
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  position: sticky;
  top: 24px;
  height: fit-content;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

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

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.sidebar-section-title::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav-item {
  margin-bottom: 2px;
}

.sidebar-nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.sidebar-nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.sidebar-nav-link.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

/* Sidebar Tags Filter */
.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px;
  margin-bottom: 20px;
}

.sidebar-tag {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-tag:hover {
  border-color: var(--accent);
  color: var(--text);
}

.sidebar-tag.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ============================================
   Main Content
   ============================================ */

.docs-main {
  padding: 24px 48px;
  min-width: 0;
}

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  margin-bottom: 32px;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.breadcrumb .separator {
  color: var(--muted);
  opacity: 0.5;
}

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

.doc-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.doc-category {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.doc-title {
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.doc-description {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}

.doc-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Doc Body Typography */
.doc-content {
  color: var(--text);
  line-height: 1.8;
  font-size: 15px;
  max-width: 720px;
}

.doc-content h1 {
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.doc-content .doc-lead {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 32px;
}

.doc-content h2 {
  font-size: 22px;
  font-weight: 600;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: -0.01em;
}

.doc-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.doc-content h4 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
}

.doc-content p {
  margin-bottom: 16px;
}

.doc-content ul,
.doc-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

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

.doc-content li::marker {
  color: var(--accent);
}

.doc-content code {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-family: 'SF Mono', 'Fira Code', 'Monaco', monospace;
  font-size: 13px;
  color: var(--accent-strong);
}

.doc-content pre {
  margin-bottom: 24px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.doc-content pre code {
  padding: 0;
  background: none;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.doc-content blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

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

.doc-content img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  margin: 24px 0;
}

.doc-content table {
  width: 100%;
  margin-bottom: 24px;
  border-collapse: collapse;
  font-size: 14px;
}

.doc-content th,
.doc-content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.doc-content th {
  font-weight: 600;
  background: var(--bg-elevated);
}

.doc-content tr:hover td {
  background: rgba(255,255,255,0.02);
}

.doc-content a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.doc-content hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 32px 0;
}

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

/* Callout Boxes */
.callout {
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border-left: 3px solid;
}

.callout-info {
  background: rgba(79, 139, 255, 0.08);
  border-color: #4f8bff;
}

.callout-warning {
  background: rgba(255, 204, 0, 0.08);
  border-color: #ffcc00;
}

.callout-success {
  background: rgba(43, 210, 127, 0.08);
  border-color: #2bd27f;
}

.callout-title {
  font-weight: 600;
  margin-bottom: 8px;
}

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

/* Navigation Footer */
.doc-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle);
}

.doc-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.doc-nav-link:hover {
  border-color: var(--accent);
  background: rgba(255,255,255,0.02);
}

.doc-nav-link.next {
  text-align: right;
}

.doc-nav-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.doc-nav-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

/* ============================================
   Table of Contents
   ============================================ */

.docs-toc {
  padding: 24px 16px 24px 24px;
  border-left: 1px solid var(--border-subtle);
  position: sticky;
  top: 24px;
  height: fit-content;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.docs-toc h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 16px;
}

.docs-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-toc li {
  margin-bottom: 2px;
}

.docs-toc a {
  display: block;
  padding: 6px 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition: color var(--transition-fast);
  line-height: 1.4;
}

.docs-toc a:hover {
  color: var(--accent-strong);
}

.docs-toc a::before {
  content: "•";
  color: var(--accent);
  margin-right: 8px;
}

/* Legacy toc classes */
.toc-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 16px;
}

.toc-nav {
  list-style: none;
}

.toc-nav-item {
  margin-bottom: 4px;
}

.toc-nav-link {
  display: block;
  padding: 5px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.toc-nav-link:hover {
  color: var(--text);
}

.toc-nav-link.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.toc-nav-link.h3 {
  padding-left: 24px;
  font-size: 11px;
}

/* ============================================
   Docs Home (Index)
   ============================================ */

.docs-home-header {
  text-align: left;
  max-width: 700px;
  margin: 0 0 40px;
}

.docs-home-header h1 {
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.docs-home-header p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
}

.docs-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.docs-category-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  transition: all var(--transition-fast);
}

.docs-category-card:hover {
  border-color: rgba(255,122,26,0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-subtle);
}

.docs-category-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 20px;
  margin-bottom: 14px;
}

.docs-category-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.docs-category-card p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.6;
}

.docs-category-links {
  list-style: none;
}

.docs-category-links li {
  margin-bottom: 6px;
}

.docs-category-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.docs-category-links a::before {
  content: "→";
  color: var(--accent);
  font-size: 12px;
  transition: transform var(--transition-fast);
}

.docs-category-links a:hover {
  color: var(--accent-strong);
}

.docs-category-links a:hover::before {
  transform: translateX(3px);
}

/* Popular Articles */
.popular-articles {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--border-subtle);
}

.popular-articles h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.popular-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.popular-item:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02);
}

.popular-item-icon {
  font-size: 18px;
}

.popular-item-text {
  flex: 1;
  min-width: 0;
}

.popular-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.popular-item-category {
  font-size: 11px;
  color: var(--muted);
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 1100px) {
  .docs-container {
    grid-template-columns: 240px 1fr;
  }
  
  .docs-toc {
    display: none;
  }
}

@media (max-width: 800px) {
  .docs-container,
  .docs-container.no-toc {
    grid-template-columns: 1fr;
  }
  
  .docs-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg);
    border-right: 1px solid var(--border-subtle);
    padding: 20px 16px;
    z-index: 100;
    box-shadow: var(--shadow-soft);
  }
  
  .docs-sidebar.open {
    display: block;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .docs-main {
    padding: 20px;
  }
  
  .doc-nav {
    grid-template-columns: 1fr;
  }
  
  .search-container {
    max-width: none;
  }
  
  .search-shortcut {
    display: none;
  }
}

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: rgba(255,255,255,0.05);
}

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

.docs-sidebar::-webkit-scrollbar,
.docs-toc::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
  width: 6px;
}

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

.docs-sidebar::-webkit-scrollbar-thumb,
.docs-toc::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.docs-sidebar::-webkit-scrollbar-thumb:hover,
.docs-toc::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   Docs Landing Page - Features Grid
   ============================================ */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.feature-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  text-align: center;
  transition: all var(--transition-fast);
}

.feature-card:hover {
  border-color: rgba(255,122,26,0.25);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ============================================
   Docs Landing Page - Documentation Sections
   ============================================ */

.docs-section {
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border-subtle);
}

.docs-section:last-of-type {
  border-bottom: none;
}

.docs-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.docs-section > p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

.docs-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.doc-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.doc-link:hover {
  border-color: rgba(255,122,26,0.3);
  transform: translateX(4px);
}

.doc-link-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.doc-link:hover .doc-link-title {
  color: var(--accent-strong);
}

.doc-link-desc {
  font-size: 12px;
  color: var(--muted);
}

/* ============================================
   Docs Landing Page - Help Section
   ============================================ */

.docs-help-section {
  margin-top: 48px;
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, rgba(255,122,26,0.05) 0%, transparent 60%);
}

.docs-help-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
}

.help-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.help-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.help-card:hover {
  border-color: rgba(255,122,26,0.3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-subtle);
}

.help-icon {
  font-size: 24px;
  margin-bottom: 10px;
}

.help-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.help-desc {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 600px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .feature-card {
    padding: 16px;
  }
  
  .feature-icon {
    font-size: 24px;
  }
  
  .docs-links {
    grid-template-columns: 1fr;
  }
  
  .help-cards {
    grid-template-columns: 1fr;
  }
  
  .docs-help-section {
    padding: 24px 16px;
  }
}
