/* 🛡️ KAITIAKI SIDEBAR — Universal Governance Visibility Component
 * "The mother tree sends wisdom signals to her children"
 * Shared across ALL demos to prove unified governance layer
 */

/* ============================================================================
   SIDEBAR LAYOUT
   ============================================================================ */

.demo-container.has-sidebar .demo-stage {
  max-width: none;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-lg);
  align-items: start;
}

.demo-container.has-sidebar .bead-content {
  grid-column: 1;
}

.kaitiaki-sidebar {
  grid-column: 2;
  grid-row: 1 / -1;
  position: sticky;
  top: var(--space-lg);
  background: var(--cave-black);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.8125rem;
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.05);
  transition: all 0.3s ease;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.kaitiaki-sidebar.collapsed {
  width: 48px;
  min-width: 48px;
  overflow: hidden;
}

.kaitiaki-sidebar.collapsed .sidebar-content {
  display: none;
}

/* Scrollbar styling for sidebar */
.kaitiaki-sidebar::-webkit-scrollbar {
  width: 4px;
}

.kaitiaki-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.kaitiaki-sidebar::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.3);
  border-radius: 2px;
}

/* ============================================================================
   SIDEBAR HEADER
   ============================================================================ */

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.875rem var(--space-sm);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05));
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.guardian-icon {
  font-size: 1.25rem;
}

.guardian-title {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8125rem;
  color: #d4af37;
  letter-spacing: 0.05em;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #d4af37;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.sidebar-toggle:hover {
  opacity: 1;
}

.sidebar-status {
  display: block;
  font-size: 0.6875rem;
  color: #10b981;
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ============================================================================
   SIDEBAR SECTIONS
   ============================================================================ */

.sidebar-section {
  padding: 0.75rem var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-section h4 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem 0;
}

.sidebar-section:last-child {
  border-bottom: none;
}

/* Session Info */
.session-id {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: #6b7280;
  display: block;
  word-break: break-all;
}

.session-mode {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-top: 4px;
}

.session-mode.professional {
  background: rgba(0, 119, 182, 0.2);
  color: #0077b6;
}

.session-mode.production {
  background: rgba(32, 201, 151, 0.2);
  color: #20c997;
}

.session-mode.constitutional {
  background: rgba(139, 92, 246, 0.2);
  color: #8b5cf6;
}

/* ============================================================================
   YAMA SCORES
   ============================================================================ */

.yama-scores {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.yama-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.yama-bar-wrapper {
  flex: 1;
  height: 6px;
  background: var(--cave-mid);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.yama-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  width: 0;
}

.yama-bar-fill.ahimsa { background: linear-gradient(90deg, #10b981, #34d399); }
.yama-bar-fill.satya { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.yama-bar-fill.asteya { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.yama-bar-fill.brahmacharya { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.yama-bar-fill.aparigraha { background: linear-gradient(90deg, #ec4899, #f472b6); }

.yama-name {
  font-size: 0.6875rem;
  color: #6b7280;
  width: 80px;
  flex-shrink: 0;
}

.yama-value {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: #e5e7eb;
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.yama-composite {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.composite-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
}

.composite-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.875rem;
}

.composite-value.pass { color: #10b981; }
.composite-value.fail { color: #ef4444; }

/* ============================================================================
   INFERENCE PATH
   ============================================================================ */

.log-display {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.6;
  color: #9ca3af;
}

.log-display .log-level {
  color: var(--service-primary, #d4af37);
  font-weight: 600;
}

.log-display .log-stat {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.log-display .log-stat-value {
  color: #e5e7eb;
  font-weight: 500;
}

.log-display .butterfly-seed {
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 4px;
  border-left: 2px solid #8b5cf6;
  font-family: var(--font-body);
  font-style: italic;
  color: #a78bfa;
  font-size: 0.6875rem;
  line-height: 1.5;
}

/* ============================================================================
   RECEIPT CHAIN
   ============================================================================ */

.receipts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.receipt {
  padding: 8px;
  background: var(--cave-mid);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.4s ease, opacity 0.4s ease, transform 0.4s ease;
}

.receipt.receipt-new {
  opacity: 0;
  transform: translateY(-10px);
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.receipt-step {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.6875rem;
  color: #d4af37;
}

.receipt-status {
  font-size: 0.625rem;
  color: #10b981;
  font-weight: 600;
}

.receipt-desc {
  font-size: 0.6875rem;
  color: #e5e7eb;
  line-height: 1.4;
  margin-bottom: 4px;
}

.receipt-hash {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  color: #6b7280;
  display: block;
}

/* ============================================================================
   DIFFERENTIATOR SECTION
   ============================================================================ */

.sidebar-section.differentiator {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.05), transparent);
}

.differentiator h4 {
  color: #d4af37 !important;
}

.differentiator ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.differentiator ul li {
  position: relative;
  padding-left: 16px;
  font-size: 0.6875rem;
  color: #9ca3af;
  line-height: 1.6;
}

.differentiator ul li::before {
  content: "×";
  position: absolute;
  left: 0;
  color: #ef4444;
  font-weight: 700;
}

.tagline {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  color: #d4af37;
}

/* ============================================================================
   INLINE META-BOXES (Used within beads)
   ============================================================================ */

.meta-box {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 8px;
  font-size: 0.875rem;
}

.meta-box-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: #d4af37;
  margin: 0 0 0.75rem 0;
  font-size: 0.9375rem;
}

.meta-box .meta-line {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: #9ca3af;
  line-height: 1.8;
}

.meta-box .meta-line strong {
  color: #e5e7eb;
}

.meta-box .meta-highlight {
  color: var(--service-primary, #d4af37);
  font-weight: 600;
}

/* Butterfly seed inline */
.butterfly-inline {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: var(--space-sm) 0;
  padding: 10px 12px;
  background: rgba(139, 92, 246, 0.08);
  border-radius: 6px;
  border-left: 3px solid #8b5cf6;
}

.butterfly-inline .butterfly-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.butterfly-inline .butterfly-text {
  font-style: italic;
  font-size: 0.875rem;
  color: #a78bfa;
  line-height: 1.5;
}

/* Hypothesis boxes */
.hypothesis-box {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hypothesis-box.primary {
  border-color: #dc3545;
  background: rgba(220, 53, 69, 0.08);
}

.hypothesis-box.secondary {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.hypothesis-box.tertiary {
  border-color: #6b7280;
  background: rgba(107, 114, 128, 0.08);
}

.hypothesis-box h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9375rem;
}

.hypothesis-box .falsification {
  margin-top: 0.75rem;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #9ca3af;
}

.hypothesis-box .falsification strong {
  color: #f59e0b;
}

.hypothesis-box .evidence {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
  font-family: var(--font-mono);
}

.hypothesis-box .evidence a {
  color: #3b82f6;
  text-decoration: none;
}

.hypothesis-box .evidence a:hover {
  text-decoration: underline;
}

/* Constitutional score inline */
.constitutional-inline {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
}

.constitutional-inline.high {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.constitutional-inline.medium {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.constitutional-inline.low {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Audit trail */
.audit-trail {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: var(--cave-black);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.8;
}

.audit-trail .audit-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: #d4af37;
  font-size: 0.875rem;
  margin: 0 0 var(--space-sm) 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.audit-entry {
  padding: 8px 0;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.05);
}

.audit-entry:last-child {
  border-bottom: none;
}

.audit-entry .audit-label {
  color: #d4af37;
  font-weight: 600;
}

.audit-entry .audit-detail {
  color: #9ca3af;
  padding-left: 16px;
  display: block;
}

.audit-entry .audit-hash {
  color: #6b7280;
  font-size: 0.6875rem;
}

.audit-entry .audit-sig {
  color: #10b981;
}

/* Counterfactual box */
.counterfactual-box {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
}

.counterfactual-box .counterfactual-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: #ef4444;
  margin: 0 0 0.75rem 0;
}

.counterfactual-box .without,
.counterfactual-box .with {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 0.875rem;
  line-height: 1.6;
}

.counterfactual-box .without {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
  color: #fca5a5;
}

.counterfactual-box .with {
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid #10b981;
  color: #6ee7b7;
}

/* Governance differentiator callout */
.governance-callout {
  margin: var(--space-lg) 0;
  padding: var(--space-lg);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), rgba(139, 92, 246, 0.08));
  border: 2px solid #d4af37;
  border-radius: 12px;
  text-align: center;
}

.governance-callout h3 {
  font-family: var(--font-display);
  color: #d4af37;
  margin: 0 0 var(--space-md) 0;
}

.governance-callout .comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin: var(--space-md) 0;
  text-align: left;
}

.governance-callout .comparison-col {
  padding: var(--space-md);
  border-radius: 8px;
}

.governance-callout .comparison-col.opus {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.governance-callout .comparison-col.axiom {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.governance-callout .comparison-col h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
}

.governance-callout .comparison-col.opus h4 { color: #ef4444; }
.governance-callout .comparison-col.axiom h4 { color: #10b981; }

.governance-callout .comparison-col li {
  font-size: 0.8125rem;
  color: #9ca3af;
  line-height: 1.6;
}

.governance-callout .governance-tagline {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: #d4af37;
  margin: var(--space-md) 0 0 0;
  line-height: 1.5;
}

/* Philosophy quote boxes */
.philosophy-quote {
  margin: var(--space-md) 0;
  padding: var(--space-md) var(--space-lg);
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid #d4af37;
  font-style: italic;
  color: #d4af37;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.philosophy-quote .attribution {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.8125rem;
  color: #6b7280;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1024px) {
  .demo-container.has-sidebar .demo-stage {
    grid-template-columns: 1fr;
  }
  
  .kaitiaki-sidebar {
    position: relative;
    top: 0;
    order: -1;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .kaitiaki-sidebar {
    font-size: 0.75rem;
  }
  
  .governance-callout .comparison {
    grid-template-columns: 1fr;
  }
}
