/* ============================================
   BIT Index Tabula — Source Library Styles
   Modern, human-readable code display
   ============================================ */

/* Source Hero */
.source-hero {
  padding-bottom: var(--space-xl);
}

.source-hero .section-header h1 {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}

/* Intro Cards */
.source-intro {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.intro-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-normal);
}

.intro-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.intro-icon {
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

.intro-card h3 {
  font-size: 1rem;
  font-family: var(--font-sans);
  margin-bottom: var(--space-sm);
}

.intro-card p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 0;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .source-intro {
    grid-template-columns: 1fr;
  }
}

/* Format Tabs */
.format-toggle-section {
  padding: var(--space-lg) 0;
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 56px;
  z-index: 100;
}

.format-tabs {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
}

.format-tab {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.format-tab:hover {
  border-color: var(--color-symbiosis);
}

.format-tab.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.tab-icon {
  font-family: var(--font-mono);
  font-size: 1rem;
  opacity: 0.7;
}

.tab-label {
  font-weight: 500;
  font-size: 0.9375rem;
}

.tab-count {
  font-size: 0.75rem;
  opacity: 0.7;
  font-family: var(--font-mono);
}

/* Source Section */
.source-section {
  padding: var(--space-3xl) 0;
}

.section-subheader {
  margin-bottom: var(--space-2xl);
}

.section-subheader h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.section-subheader p {
  color: var(--color-text-secondary);
  font-size: 1rem;
  margin-bottom: 0;
}

/* Source Category */
.source-category {
  margin-bottom: var(--space-2xl);
}

.category-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}

/* Source Block */
.source-block {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  margin-bottom: var(--space-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
}

.source-block:hover {
  box-shadow: var(--shadow-md);
}

.source-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-light);
}

.source-info h4 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.source-meta {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.meta-tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  padding: 2px 8px;
  background: var(--color-bg-alt);
  border-radius: 4px;
  color: var(--color-text-muted);
}

.meta-tag.tex {
  background: rgba(107, 70, 193, 0.1);
  color: var(--color-invariant);
}

.meta-tag.md {
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-framework);
}

.source-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Copy Button */
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-symbiosis);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.btn-copy:hover {
  background: #7a3fc9;
  transform: translateY(-1px);
}

.btn-copy svg {
  width: 14px;
  height: 14px;
}

.icon-check {
  color: #28c88c;
}

/* Source Preview */
.source-preview {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.source-preview.collapsed {
  max-height: 0;
}

.source-preview.expanded {
  max-height: 600px;
  overflow-y: auto;
}

.source-preview pre {
  margin: 0;
  padding: var(--space-xl);
  background: #0f172a;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.source-preview code {
  font-family: var(--font-mono);
  color: #e2e8f0;
  background: transparent;
  padding: 0;
  display: block;
  white-space: pre;
  tab-size: 2;
}

/* Expand Button */
.source-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md);
  background: var(--color-bg-alt);
  border: none;
  border-top: 1px solid var(--color-border-light);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.source-expand:hover {
  background: var(--color-border-light);
  color: var(--color-text);
}

.expand-icon {
  transition: transform 0.3s ease;
}

/* Conversion Guide */
.conversion-guide {
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
  border-top: 1px solid var(--color-border);
}

.workflow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
}

.workflow-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  background: white;
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  max-width: 260px;
  transition: all var(--transition-normal);
}

.workflow-step:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.step-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-symbiosis);
  color: white;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 0.9375rem;
  margin-bottom: var(--space-xs);
}

.step-content p {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-bottom: 0;
  line-height: 1.5;
}

.workflow-arrow {
  font-size: 1.5rem;
  color: var(--color-text-muted);
}

.workflow-note {
  max-width: 700px;
  margin: 0 auto;
  padding: var(--space-lg);
  background: rgba(140, 80, 220, 0.05);
  border: 1px solid rgba(140, 80, 220, 0.15);
  border-radius: 8px;
  font-size: 0.9375rem;
  line-height: 1.6;
  text-align: center;
}

.workflow-note strong {
  color: var(--color-symbiosis);
}

.workflow-note code {
  font-size: 0.8125rem;
  background: rgba(140, 80, 220, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 900px) {
  .workflow-steps {
    flex-direction: column;
  }
  
  .workflow-step {
    max-width: 100%;
  }
  
  .workflow-arrow {
    transform: rotate(90deg);
  }
}

/* Scrollbar styling for code blocks */
.source-preview pre::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.source-preview pre::-webkit-scrollbar-track {
  background: #1e293b;
}

.source-preview pre::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

.source-preview pre::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .source-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
  
  .source-actions {
    width: 100%;
  }
  
  .source-actions .btn {
    flex: 1;
    justify-content: center;
  }
  
  .format-tabs {
    flex-direction: column;
  }
  
  .format-tab {
    justify-content: center;
  }
}
