/**
 * Documentation Page Styles
 * Professional design matching store.html aesthetic
 */

/* ========================================
   MAIN CONTENT
   ======================================== */

.docs-main {
  min-height: calc(100vh - var(--navbar-height));
  padding-bottom: var(--space-16);
}

/* ========================================
   DOCS HEADER
   ======================================== */

.docs-header {
  padding: var(--space-20) 0 var(--space-12);
  text-align: center;
  background: linear-gradient(180deg, var(--theme-bg-secondary) 0%, var(--theme-bg-primary) 100%);
}

.docs-header__title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: var(--font-extrabold);
  line-height: 1.1;
  margin-bottom: var(--space-4);
  color: var(--theme-text-primary);
}

.docs-header__description {
  font-size: clamp(1rem, 2vw, 1.125rem);
  line-height: var(--leading-relaxed);
  color: var(--theme-text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ========================================
   PANEL / CONTAINER
   ======================================== */


.docs-panel-wrap {
  padding: 0 0 var(--space-16);
}

.docs-panel-wrap > .container {
  max-width: var(--container-2xl);
}

.docs-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

/* ========================================
   PROJECTS HEADER
   ======================================== */

.docs-projects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.docs-projects-header h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--theme-text-primary);
}

.docs-projects-header p {
  color: var(--theme-text-secondary);
  font-size: var(--text-base);
}

.docs-count {
  background: var(--theme-bg-elevated);
  border: 1px solid var(--theme-border-subtle);
  color: var(--theme-accent-primary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

/* ========================================
   PROJECT GRID
   ======================================== */

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}

.docs-card {
  background: var(--theme-bg-elevated);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--transition-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.docs-card:hover {
  transform: translateY(-4px);
  border-color: var(--theme-accent-primary);
  box-shadow: 0 8px 24px rgba(6, 182, 212, 0.3);
}

.docs-card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--theme-text-primary);
  margin: 0;
}

.docs-card-description {
  color: var(--theme-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.docs-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
}

.docs-tag {
  padding: var(--space-1) var(--space-3);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--theme-accent-primary);
}

/* ========================================
   DOCUMENTATION VIEW
   ======================================== */

.docs-view {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-8);
  align-items: start;
}

.docs-sidebar-column {
  position: sticky;
  top: calc(var(--navbar-height) + var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-height: calc(100vh - var(--navbar-height) - var(--space-8));
  overflow-y: auto;
  transition: width var(--transition-base), min-width var(--transition-base);
}

/* Sidebar */
.docs-sidebar {
  background: var(--theme-bg-elevated);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  overflow-y: auto;
  flex-shrink: 0;
}

/* ========================================
   SIDEBAR COLLAPSE / EXPAND
   ======================================== */

.docs-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 32px;
  background: var(--theme-bg-elevated);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--radius-lg);
  color: var(--theme-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.docs-sidebar-toggle:hover {
  background: var(--theme-bg-secondary);
  border-color: var(--theme-accent-primary);
  color: var(--theme-accent-primary);
}

.docs-sidebar-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

/* Collapsed sidebar state */
.docs-view.sidebar-collapsed {
  grid-template-columns: 48px 1fr;
}

.docs-view.sidebar-collapsed .docs-sidebar-column {
  overflow: visible;
}

.docs-view.sidebar-collapsed .docs-sidebar {
  display: none;
}

.docs-view.sidebar-collapsed .docs-ads {
  display: none;
}

.docs-view.sidebar-collapsed .docs-sidebar-toggle {
  width: 40px;
  height: 40px;
  margin: 0 auto;
}

.docs-view.sidebar-collapsed .docs-sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Collapsed mini-nav: page indicators */
.docs-collapsed-nav {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.docs-view.sidebar-collapsed .docs-collapsed-nav {
  display: flex;
}

.docs-collapsed-nav__item {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--theme-bg-elevated);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--radius-md);
  color: var(--theme-text-tertiary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.docs-collapsed-nav__item:hover {
  background: var(--theme-bg-secondary);
  border-color: var(--theme-accent-primary);
  color: var(--theme-accent-primary);
}

.docs-collapsed-nav__item.is-active {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--theme-accent-primary);
  color: var(--theme-accent-primary);
}

.docs-collapsed-nav__item::after {
  content: attr(data-title);
  position: absolute;
  left: calc(100% + var(--space-2));
  top: 50%;
  transform: translateY(-50%);
  background: var(--theme-bg-elevated);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  white-space: nowrap;
  color: var(--theme-text-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  box-shadow: var(--theme-shadow-md);
  z-index: 10;
}

.docs-collapsed-nav__item:hover::after {
  opacity: 1;
}

.docs-back {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--radius-lg);
  color: var(--theme-text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-6);
}

.docs-back:hover {
  background: var(--theme-bg-secondary);
  border-color: var(--theme-accent-primary);
  color: var(--theme-accent-primary);
}

.docs-project-info {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--theme-border-subtle);
}

.docs-project-info h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--theme-text-primary);
  margin: 0 0 var(--space-2) 0;
}

.docs-project-info p {
  font-size: var(--text-sm);
  color: var(--theme-text-secondary);
  margin: 0;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.docs-nav button {
  width: 100%;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  color: var(--theme-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.docs-nav button:hover {
  background: var(--theme-bg-secondary);
  color: var(--theme-text-primary);
}

.docs-nav button.is-active {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--theme-accent-primary);
  color: var(--theme-accent-primary);
}

/* Ads Section */
.docs-ads {
  background: var(--theme-bg-elevated);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Content Area */
.docs-content {
  background: var(--theme-bg-elevated);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  min-height: 500px;
}

.docs-content h1 {
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  font-weight: var(--font-extrabold);
  color: var(--theme-text-primary);
  margin: 0 0 var(--space-6) 0;
  line-height: 1.15;
}

.docs-content h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--theme-text-primary);
  margin: var(--space-10) 0 var(--space-4) 0;
  line-height: 1.2;
}

.docs-content h3 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  color: var(--theme-text-primary);
  margin: var(--space-8) 0 var(--space-3) 0;
  line-height: 1.3;
}

.docs-content p {
  color: var(--theme-text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}

.docs-content ul,
.docs-content ol {
  color: var(--theme-text-secondary);
  line-height: var(--leading-relaxed);
  margin: var(--space-4) 0 var(--space-4) var(--space-6);
}

.docs-content li {
  margin-bottom: var(--space-2);
}

.docs-content a {
  color: var(--theme-accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.docs-content a:hover {
  color: var(--color-brand-cyan);
  text-decoration: underline;
}

.docs-content code {
  background: var(--theme-bg-secondary);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--theme-accent-primary);
}

.docs-content pre {
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow-x: auto;
  margin: var(--space-4) 0;
}

.docs-content pre code {
  background: transparent;
  padding: 0;
  color: var(--theme-text-primary);
}

.docs-content hr {
  border: none;
  height: 1px;
  background: var(--theme-border-subtle);
  margin: var(--space-8) 0;
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-4) 0;
}

.docs-content th,
.docs-content td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--theme-border-subtle);
  text-align: left;
}

.docs-content th {
  background: var(--theme-bg-secondary);
  color: var(--theme-text-primary);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
}

.docs-content td {
  color: var(--theme-text-secondary);
  font-size: var(--text-sm);
}

.docs-content tbody tr:hover {
  background: var(--theme-bg-secondary);
}

.docs-empty {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--theme-text-tertiary);
  font-size: var(--text-base);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.is-hidden {
  display: none !important;
}

.docs-status {
  text-align: center;
  padding: var(--space-8) 0;
  color: var(--theme-text-tertiary);
  font-size: var(--text-sm);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
  .docs-view {
    grid-template-columns: 1fr;
  }

  .docs-view.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .docs-sidebar-column {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .docs-sidebar-toggle {
    display: none;
  }

  .docs-collapsed-nav {
    display: none !important;
  }

  .docs-view.sidebar-collapsed .docs-sidebar {
    display: block;
  }

  .docs-view.sidebar-collapsed .docs-ads {
    display: flex;
  }

  .docs-projects-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .docs-header {
    padding: var(--space-16) 0 var(--space-8);
  }

  .docs-main {
    padding-bottom: var(--space-8);
  }

  .docs-panel {
    padding: var(--space-5);
  }

  .docs-content {
    padding: var(--space-6);
  }

  .docs-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 480px) {
  .docs-panel-wrap {
    padding-top: 0;
  }
  .docs-panel {
    padding: var(--space-4);
  }
  
  .docs-content {
    padding: var(--space-4);
  }
  
}
