/* ========================================
   SolarScope Documentation Styles
   ======================================== */

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

/* Sidebar */
.docs-sidebar {
  border-right: 1px solid var(--border-color, #e5e7eb);
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
  flex-shrink: 0;
}

.docs-sidebar-inner {
  padding: 1.5rem 1rem;
}

.docs-nav-home {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color, #111827);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.docs-nav-home:hover,
.docs-nav-home.active {
  background: var(--primary-color-light, #f0f9ff);
  color: var(--primary-color, #0ea5e9);
}

.docs-nav-section {
  margin-bottom: 1.25rem;
}

.docs-nav-section-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #6b7280);
  padding: 4px 8px;
  margin-bottom: 4px;
}

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

.docs-nav-link {
  display: block;
  font-size: 0.84rem;
  color: var(--text-color, #374151);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 5px;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}

.docs-nav-link:hover {
  background: var(--hover-bg, rgba(0,0,0,0.04));
  color: var(--primary-color, #0ea5e9);
}

.docs-nav-link.active {
  background: var(--primary-color-light, #f0f9ff);
  color: var(--primary-color, #0ea5e9);
  font-weight: 600;
}

/* Main content area */
.docs-main {
  padding: 2rem 2.5rem;
  min-width: 0;
  max-width: 800px;
}

/* Table of Contents */
.docs-toc {
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
  padding: 2rem 1rem 2rem 0;
}

.docs-toc-inner {
  padding-left: 1rem;
  border-left: 1px solid var(--border-color, #e5e7eb);
}

.docs-toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #6b7280);
  margin-bottom: 0.75rem;
}

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

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

.docs-toc-h3 {
  padding-left: 0.75rem;
}

.docs-toc-link {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted, #6b7280);
  text-decoration: none;
  padding: 2px 0;
  transition: color 0.15s;
  line-height: 1.4;
}

.docs-toc-link:hover,
.docs-toc-link.active {
  color: var(--primary-color, #0ea5e9);
}

/* Page header */
.docs-page-header {
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.docs-page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.docs-lead {
  font-size: 1.05rem;
  color: var(--text-muted, #6b7280);
  max-width: 600px;
}

/* Breadcrumb */
.docs-breadcrumb {
  margin-bottom: 1rem;
}

.docs-breadcrumb .breadcrumb {
  font-size: 0.83rem;
  background: none;
  padding: 0;
  margin: 0;
}

/* Article */
.docs-article-header {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  padding-bottom: 1rem;
}

.docs-article-header h1 {
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.docs-updated {
  font-size: 0.8rem;
  color: var(--text-muted, #9ca3af);
}

.docs-article-body h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
}

.docs-article-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.docs-article-body p {
  line-height: 1.75;
  margin-bottom: 1rem;
  font-size: 0.97rem;
}

.docs-article-body ul,
.docs-article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.docs-article-body li {
  line-height: 1.7;
  font-size: 0.97rem;
  margin-bottom: 0.25rem;
}

.docs-article-body code {
  background: var(--code-bg, rgba(0,0,0,0.06));
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.88em;
}

.docs-article-body pre {
  background: var(--code-bg, #f3f4f6);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.docs-article-body pre code {
  background: none;
  padding: 0;
}

.docs-article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.docs-article-body th,
.docs-article-body td {
  padding: 8px 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  text-align: left;
}

.docs-article-body th {
  background: var(--hover-bg, rgba(0,0,0,0.03));
  font-weight: 600;
}

.docs-article-body blockquote {
  border-left: 3px solid var(--primary-color, #0ea5e9);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: var(--primary-color-light, #f0f9ff);
  border-radius: 0 6px 6px 0;
}

/* Section grid cards */
.docs-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.docs-card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.docs-card:hover {
  border-color: var(--primary-color, #0ea5e9);
  box-shadow: 0 2px 12px rgba(14, 165, 233, 0.1);
  color: inherit;
  text-decoration: none;
}

.docs-card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--primary-color-light, #f0f9ff);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color, #0ea5e9);
}

.docs-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.docs-card p {
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.docs-card-links {
  font-size: 0.8rem;
  color: var(--text-muted, #9ca3af);
  padding-left: 1rem;
  margin: 0;
}

/* FAQ grid */
.docs-faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Glossary */
.docs-az-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.docs-az-link {
  display: inline-block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 5px;
  text-decoration: none;
  color: var(--text-color, #374151);
  background: var(--hover-bg, rgba(0,0,0,0.04));
  transition: background 0.15s;
}

.docs-az-link:hover {
  background: var(--primary-color, #0ea5e9);
  color: #fff;
}

.docs-glossary-section {
  margin-bottom: 2rem;
}

.docs-glossary-letter {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--primary-color, #0ea5e9);
  display: inline-block;
  min-width: 2rem;
}

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

.docs-glossary-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color, #f3f4f6);
  font-size: 0.9rem;
}

.docs-glossary-term-link {
  text-decoration: none;
  color: var(--primary-color, #0ea5e9);
}

.docs-glossary-term-link:hover {
  text-decoration: underline;
}

/* Related links */
.docs-related {
  border-top: 1px solid var(--border-color, #e5e7eb);
  padding-top: 1rem;
}

.docs-related h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.docs-related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.docs-related-list a {
  font-size: 0.85rem;
  padding: 4px 10px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-color, #374151);
  transition: border-color 0.15s;
}

.docs-related-list a:hover {
  border-color: var(--primary-color, #0ea5e9);
  color: var(--primary-color, #0ea5e9);
}

/* Feedback widget */
.docs-feedback {
  background: var(--hover-bg, rgba(0,0,0,0.02));
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
}

/* Pagination */
.docs-pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
  padding-top: 1.5rem;
}

.docs-pagination-prev,
.docs-pagination-next {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  max-width: 48%;
  transition: border-color 0.15s;
}

.docs-pagination-prev { align-items: flex-start; }
.docs-pagination-next { align-items: flex-end; margin-left: auto; }

.docs-pagination-prev:hover,
.docs-pagination-next:hover {
  border-color: var(--primary-color, #0ea5e9);
  text-decoration: none;
}

.docs-pagination-label {
  font-size: 0.75rem;
  color: var(--text-muted, #9ca3af);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.docs-pagination-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color, #111827);
}

/* Search */
.docs-search-hero .input-group {
  max-width: 500px;
}

/* Search in sidebar */
.docs-search-wrap .form-control {
  font-size: 0.82rem;
}

/* Mobile sidebar toggle */
.docs-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--primary-color, #0ea5e9);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

@media (max-width: 768px) {
  .docs-wrapper {
    grid-template-columns: 1fr;
  }
  .docs-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    width: 260px;
    z-index: 150;
    background: var(--bg-color, #fff);
    transition: left 0.25s;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
  }
  .docs-sidebar.open {
    left: 0;
  }
  .docs-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .docs-main {
    padding: 1.5rem 1rem;
  }
}

/* Dark mode support */
[data-theme="dark"] .docs-sidebar,
.dark-mode .docs-sidebar {
  background: var(--bg-color, #111827);
  border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .docs-card,
.dark-mode .docs-card {
  border-color: rgba(255,255,255,0.1);
  background: var(--card-bg, rgba(255,255,255,0.03));
}

[data-theme="dark"] .docs-article-body h2,
.dark-mode .docs-article-body h2 {
  border-color: rgba(255,255,255,0.1);
}
