/**
 * Cluster Report Specific Styles
 * 
 * Additional styles for cluster report pages including:
 * - Sticky sidebar with scroll sync
 * - Hierarchical table of contents
 * - Interactive checklists
 * - Improved technical references formatting
 * 
 * Last Updated: September 30, 2025
 */

/* ============================================================================
   Sticky Sidebar & TOC Navigation
   ============================================================================ */

.sidebar {
  position: sticky;
  top: 100px; /* Below header */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

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

.sidebar::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: var(--radius-full);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-border-dark);
}

/* Hierarchical TOC Indentation */
.sidebar-nav-item.sidebar-nav-section {
  /* h2 items - no indent */
}

.sidebar-nav-item.sidebar-nav-subsection {
  /* h3 items - indent */
  padding-left: var(--space-md);
}

.sidebar-nav-item.sidebar-nav-subsection .sidebar-nav-link {
  font-size: var(--font-size-sm);
  padding: var(--space-xs) var(--space-md);
}

.sidebar-nav-item.sidebar-nav-subsubsection {
  /* h4 items - deeper indent */
  padding-left: var(--space-xl);
}

.sidebar-nav-item.sidebar-nav-subsubsection .sidebar-nav-link {
  font-size: var(--font-size-xs);
  padding: var(--space-xs) var(--space-sm);
  color: var(--color-text-muted);
}

/* Visual hierarchy markers */
.sidebar-nav-item.sidebar-nav-section .sidebar-nav-link {
  font-weight: var(--font-weight-semibold);
  border-left: 3px solid transparent;
  padding-left: calc(var(--space-md) - 3px);
}

.sidebar-nav-item.sidebar-nav-section .sidebar-nav-link.active {
  border-left-color: var(--color-primary);
}

.sidebar-nav-item.sidebar-nav-subsection .sidebar-nav-link::before {
  content: "→";
  margin-right: var(--space-xs);
  opacity: 0.4;
  font-size: 0.9em;
}

.sidebar-nav-item.sidebar-nav-subsubsection .sidebar-nav-link::before {
  content: "•";
  margin-right: var(--space-xs);
  opacity: 0.3;
}

/* ============================================================================
   Interactive Checklists
   ============================================================================ */

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  list-style: none;
  margin-left: 0;
  border-bottom: 1px solid var(--color-border-light);
}

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

.checklist-checkbox {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  border: 2px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--color-background);
  transition: var(--transition-all);
}

.checklist-checkbox:hover {
  border-color: var(--color-primary);
}

.checklist-checkbox:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-position: center;
}

.checklist-label {
  flex: 1;
  cursor: pointer;
  line-height: 1.6;
  transition: var(--transition-all);
}

.checklist-checkbox:checked + .checklist-label {
  text-decoration: line-through;
  opacity: 0.6;
}

/* Checklist sections */
.prose h3 + ul:has(.checklist-item) {
  background-color: var(--color-background-alt);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-top: var(--space-lg);
}

/* ============================================================================
   Technical References Formatting
   ============================================================================ */

.technical-references {
  background-color: var(--color-background-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-2xl) 0;
}

.technical-references h3 {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--color-border);
}

.technical-references ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-sm);
}

.technical-references li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background-color: var(--color-background);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin: 0;
  transition: var(--transition-all);
}

.technical-references li:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-sm);
}

.technical-references li::before {
  content: "📄";
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

.technical-references code {
  background-color: var(--color-background-alt);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  color: var(--color-primary-dark);
  font-weight: var(--font-weight-medium);
}

/* Source type indicators */
.ref-component::before { content: "🔧"; }
.ref-file::before { content: "📁"; }
.ref-doc::before { content: "📖"; }
.ref-service::before { content: "⚙️"; }
.ref-config::before { content: "🔧"; }

/* ============================================================================
   Workflow Section Layout
   ============================================================================ */

.workflow-section {
  margin-bottom: var(--space-3xl);
}

.workflow-section h3 {
  color: var(--color-primary-dark);
  margin-bottom: var(--space-lg);
}

.workflow-diagram {
  background-color: var(--color-background-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-xl) 0;
}

.workflow-description {
  line-height: var(--line-height-relaxed);
  color: var(--color-text-primary);
  margin-top: var(--space-lg);
}

/* Diagram title styling */
.workflow-diagram h4 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

/* Mermaid diagram specific styles */
.workflow-diagram .mermaid {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

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

@media (max-width: 1024px) {
  .sidebar {
    position: static;
    max-height: none;
    margin-bottom: var(--space-xl);
  }

  .sidebar-nav-item.sidebar-nav-subsection {
    padding-left: var(--space-sm);
  }

  .sidebar-nav-item.sidebar-nav-subsubsection {
    padding-left: var(--space-md);
  }
}

@media (max-width: 768px) {
  .technical-references {
    padding: var(--space-md);
  }

  .technical-references ul {
    gap: var(--space-xs);
  }

  .technical-references li {
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm);
  }

  .checklist-item {
    gap: var(--space-sm);
  }
}

/* ============================================================================
   Print Styles
   ============================================================================ */

@media print {
  .sidebar {
    display: none;
  }

  .layout-two-column {
    grid-template-columns: 1fr;
  }

  .checklist-checkbox {
    border: 1px solid black;
  }

  .checklist-checkbox:checked {
    background-color: black;
  }
}
