/**
 * Code Snippet Viewer - Platform-Agnostic Styles
 * Requires: chevron-variables.css, highlight.js CSS theme
 */

/* ────────────────────────────────────────
   CODE SNIPPET SECTION
   ──────────────────────────────────────── */
.code-snippet-section {
  margin-top: var(--space-3);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  overflow: hidden;
  background: #ffffff;
}

.dark-theme .code-snippet-section {
  border-color: rgba(255, 255, 255, 0.12);
  background: #1e1e1e;
}

/* ────────────────────────────────────────
   TAB NAVIGATION
   ──────────────────────────────────────── */
.code-tabs {
  display: flex;
  background: #f5f5f5;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  overflow-x: auto;
  scrollbar-width: thin;
}

.dark-theme .code-tabs {
  background: #252526;
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.code-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: rgba(0, 0, 0, 0.7);
  font-family: var(--font-gotham-book, system-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.dark-theme .code-tab {
  color: rgba(255, 255, 255, 0.7);
}

.code-tab:hover {
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.87);
}

.dark-theme .code-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.87);
}

.code-tab.active {
  color: var(--chevron-dark-blue, #0b2d71);
  border-bottom-color: var(--chevron-dark-blue, #0b2d71);
  background: rgba(11, 45, 113, 0.04);
}

.dark-theme .code-tab.active {
  color: var(--chevron-light-teal, #00bfff);
  border-bottom-color: var(--chevron-light-teal, #00bfff);
  background: rgba(0, 191, 255, 0.08);
}

.code-tab svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.code-tab.active svg {
  opacity: 1;
}

/* ────────────────────────────────────────
   TAB CONTENT PANELS
   ──────────────────────────────────────── */
.code-content {
  position: relative;
  min-height: 200px;
}

.code-panel {
  display: none;
  animation: fadeIn 200ms ease;
}

.code-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Demo Panel */
.demo-placeholder {
  padding: var(--space-3);
}

/* ────────────────────────────────────────
   CODE DISPLAY
   ──────────────────────────────────────── */
.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #2d2d2d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-theme .code-header {
  background: #1e1e1e;
}

.code-filename {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.code-copy-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-gotham-book, system-ui);
  font-size: 12px;
  cursor: pointer;
  transition: all 150ms ease;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
}

.code-copy-btn.copied {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.code-copy-btn svg {
  width: 14px;
  height: 14px;
}

/* Code Block */
.code-panel pre {
  margin: 0;
  padding: 16px;
  background: #1e1e1e;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.dark-theme .code-panel pre {
  background: #0d0d0d;
}

.code-panel code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #d4d4d4;
}

/* Scrollbar Styling */
.code-panel pre::-webkit-scrollbar {
  height: 8px;
}

.code-panel pre::-webkit-scrollbar-track {
  background: transparent;
}

.code-panel pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.code-panel pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────── */
@media (max-width: 600px) {
  .code-tab {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .code-tab svg {
    width: 14px;
    height: 14px;
  }
  
  .code-panel pre {
    padding: 12px;
  }
  
  .code-panel code {
    font-size: 12px;
  }
}
