/**
 * Documentation Specific Styles
 * 
 * @package Hastika_Docs
 * @since 1.0.0
 */

/* Product Cards */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.product-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.product-card:hover {
  border-color: var(--product-color, var(--color-primary));
  box-shadow: 0 4px 12px var(--color-shadow);
  transform: translateY(-2px);
}

.product-card-inner {
  padding: var(--space-lg);
}

.product-logo {
  width: 60px;
  height: 60px;
  margin-bottom: var(--space-md);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.product-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-title {
  font-size: var(--font-h3);
  margin-bottom: var(--space-sm);
}

.product-title a {
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.product-title a:hover {
  color: var(--product-color, var(--color-primary));
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.product-excerpt {
  font-size: var(--font-body);
  color: var(--color-text-secondary);
  line-height: var(--line-height-base);
  margin-bottom: var(--space-md);
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.product-doc-count {
  font-size: var(--font-metadata);
  color: var(--color-text-tertiary);
}

.product-link {
  font-size: var(--font-body);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

.product-link:hover {
  text-decoration: underline;
}

/* Single Product */
.product-single .product-header {
  display: flex;
  gap: var(--space-2xl);
  align-items: flex-start;
  margin-bottom: var(--space-3xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--color-border);
}

.product-logo-large {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.product-logo-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-header-content {
  flex: 1;
}

.product-tagline {
  font-size: var(--font-h3);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

.product-version-badge {
  margin-bottom: var(--space-lg);
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.product-description {
  margin-bottom: var(--space-3xl);
  line-height: var(--line-height-base);
}

.product-sections {
  display: grid;
  gap: var(--space-3xl);
}

.product-sections section {
  padding: var(--space-2xl);
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.product-sections h2 {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.documentation-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-2xl);
}

.doc-category-item h3 {
  font-size: var(--font-h3);
  margin-bottom: var(--space-md);
}

.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-list li {
  margin-bottom: var(--space-sm);
}

.doc-list a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--font-body);
  transition: color var(--transition-fast);
}

.doc-list a:hover {
  color: var(--product-accent, var(--color-primary));
}

.changelog-preview-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg) 0;
}

.changelog-preview-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.changelog-preview-list li:last-child {
  border-bottom: none;
}

.changelog-date {
  font-size: var(--font-metadata);
  color: var(--color-text-tertiary);
}

.view-all-link {
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

.view-all-link:hover {
  text-decoration: underline;
}

/* Archive Header */
.archive-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--color-border);
}

.archive-title {
  margin-bottom: var(--space-md);
}

.archive-description {
  font-size: var(--font-h3);
  color: var(--color-text-secondary);
}

/* Responsive */
@media (max-width: 767px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
  
  .product-single .product-header {
    flex-direction: column;
  }
  
  .documentation-categories {
    grid-template-columns: 1fr;
  }
  
  .product-actions {
    flex-direction: column;
  }
  
  .product-actions .btn {
    width: 100%;
  }
}


/* Documentation Layout */
.site-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: var(--space-2xl);
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

@media (min-width: 1024px) {
  .site-layout {
    grid-template-columns: var(--sidebar-width) 1fr var(--toc-width);
  }
}

/* Sidebar */
.documentation-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
  max-height: calc(100vh - var(--header-height) - var(--space-2xl));
  overflow-y: auto;
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.sidebar-product-header {
  padding: var(--space-md);
  padding-left: var(--space-lg);
  margin-bottom: var(--space-lg);
  background-color: var(--color-background);
  border-radius: var(--radius-md);
}

.sidebar-product-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  text-decoration: none;
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.sidebar-product-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-product-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-product-name {
  font-size: var(--font-sidebar);
}

.sidebar-placeholder,
.toc-placeholder {
  font-size: var(--font-metadata);
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* Main Documentation Content */
.documentation-content {
  max-width: var(--doc-max-width);
  padding: 0 var(--space-lg);
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: var(--font-breadcrumb);
  margin-bottom: var(--space-lg);
  color: var(--color-text-secondary);
}

.breadcrumb a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--product-accent, var(--color-primary));
}

.breadcrumb-separator {
  color: var(--color-text-tertiary);
}

.breadcrumb-current {
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
}

.documentation-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.documentation-title {
  margin-bottom: var(--space-md);
}

.documentation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  font-size: var(--font-metadata);
  color: var(--color-text-secondary);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.documentation-body {
  line-height: var(--line-height-base);
  margin-bottom: var(--space-3xl);
}

.documentation-body h2 {
  scroll-margin-top: calc(var(--header-height) + var(--space-lg));
}

.documentation-body h3,
.documentation-body h4 {
  scroll-margin-top: calc(var(--header-height) + var(--space-md));
}

.documentation-footer {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2xl);
  margin-top: var(--space-3xl);
}

/* TOC */
.documentation-toc {
  display: none;
}

@media (min-width: 1024px) {
  .documentation-toc {
    display: block;
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
    max-height: calc(100vh - var(--header-height) - var(--space-2xl));
    overflow-y: auto;
  }
}

.toc-inner {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.toc-inner h4 {
  font-size: var(--font-body);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-md);
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .site-layout {
    grid-template-columns: 1fr;
    padding: var(--space-lg);
  }
  
  .documentation-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 280px;
    max-height: none;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: var(--z-modal);
    border-radius: 0;
  }
  
  .documentation-sidebar.is-open {
    transform: translateX(0);
  }
  
  .documentation-content {
    padding: 0;
  }
}


/* Documentation Navigation */
.doc-nav {
  font-size: var(--font-sidebar);
}

.nav-level {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-level-0 {
  margin-top: var(--space-md);
}

.nav-item {
  margin: 0;
}

.nav-category {
  margin-bottom: var(--space-sm);
}

.nav-category-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) 0;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.nav-toggle:hover {
  color: var(--color-text);
}

.toggle-icon {
  font-size: 14px;
  font-weight: bold;
  transition: transform var(--transition-fast);
}

.nav-category.is-active > .nav-category-label .toggle-icon {
  transform: rotate(90deg);
}

.category-name {
  flex: 1;
}

/* Documentation Links */
.nav-docs {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-sm) 0;
  padding-left: var(--space-lg);
}

.nav-doc {
  margin-bottom: 2px;
}

.nav-link {
  display: block;
  padding: 6px var(--space-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: var(--font-sidebar);
  line-height: var(--line-height-tight);
}

.nav-link:hover {
  color: var(--color-text);
  background-color: var(--color-hover);
}

.nav-doc.is-current .nav-link {
  color: var(--product-accent, var(--color-primary));
  background-color: var(--color-active);
  font-weight: var(--font-weight-medium);
}

/* Nested categories */
.nav-level-1,
.nav-level-2 {
  padding-left: var(--space-lg);
  margin-top: var(--space-xs);
}

/* Collapsed state */
.nav-category:not(.is-active) > .nav-docs,
.nav-category:not(.is-active) > .nav-level {
  display: none;
}

/* No navigation message */
.no-navigation {
  padding: var(--space-lg);
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: var(--font-metadata);
  font-style: italic;
}


/* Table of Contents Styles */
.toc-nav {
  margin-top: var(--space-md);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list-nested {
  padding-left: var(--space-lg);
  margin-top: 4px;
}

.toc-item {
  margin-bottom: 4px;
}

.toc-link {
  display: block;
  padding: 4px var(--space-sm);
  font-size: var(--font-metadata);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  line-height: var(--line-height-tight);
}

.toc-link:hover {
  color: var(--color-text);
  background-color: var(--color-hover);
}

.toc-link.active {
  color: var(--product-accent, var(--color-primary));
  background-color: var(--color-active);
  font-weight: var(--font-weight-medium);
  border-left: 2px solid var(--product-accent, var(--color-primary));
  padding-left: calc(var(--space-sm) - 2px);
}

.toc-level-2 .toc-link {
  font-size: 11px;
}

.toc-level-3 .toc-link,
.toc-level-4 .toc-link {
  font-size: 10px;
}

/* Heading anchor links */
.toc-heading {
  position: relative;
  scroll-margin-top: calc(var(--header-height) + var(--space-lg));
}

.toc-heading:hover::before {
  content: '#';
  position: absolute;
  left: -20px;
  color: var(--color-text-tertiary);
  font-weight: normal;
}
