/* Code Block Container */
.code-block {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.3),
    0 2px 4px -1px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin: 1.5rem 0;
  width: 100%;
  text-align: left;
}

/* Header Bar */
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 2.5rem;
}

.filename {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.language-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.copy-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0;
}

.code-block:hover .copy-button {
  opacity: 1;
}

.copy-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

.copy-button.copied {
  color: #22c55e;
  opacity: 1;
}

.copy-button .icon {
  width: 1rem;
  height: 1rem;
}

/* Code Content */
.code-pre {
  margin: 0;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.7;
  text-align: left;
}

.code-content {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  color: #e2e8f0;
  tab-size: 2;
  text-align: left;
  display: block;
  white-space: pre;
}

/* Custom scrollbar */
.code-pre::-webkit-scrollbar {
  height: 6px;
}

.code-pre::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.code-pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.code-pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   Syntax Highlighting - Rust/Prax Theme
   ============================================ */

/* Comments */
.token.comment {
  color: #6b7280;
  font-style: italic;
}

.token.doc-comment {
  color: #8b9eb0;
  font-style: italic;
}

/* Strings */
.token.string {
  color: #a5d6a7;
}

.token.char {
  color: #a5d6a7;
}

/* Keywords */
.token.keyword {
  color: #f97316;
  font-weight: 600;
}

/* Types */
.token.type-name,
.token.builtin {
  color: #fbbf24;
  font-weight: 500;
}

.token.class-name {
  color: #67e8f9;
  font-weight: 500;
}

/* Attributes */
.token.attribute {
  color: #c084fc;
}

.token.attr-name {
  color: #c084fc;
}

.token.attr-value {
  color: #a5d6a7;
}

/* Functions */
.token.function {
  color: #93c5fd;
}

.token.macro {
  color: #f472b6;
  font-weight: 500;
}

/* Variables & Properties */
.token.property {
  color: #93c5fd;
}

.token.variable {
  color: #e2e8f0;
}

/* Numbers */
.token.number {
  color: #f472b6;
}

/* Booleans */
.token.boolean {
  color: #f472b6;
  font-weight: 500;
}

/* Operators */
.token.operator {
  color: #94a3b8;
}

/* Punctuation */
.token.punctuation {
  color: #94a3b8;
}

/* Namespace */
.token.namespace {
  color: #67e8f9;
}

/* Lifetime */
.token.lifetime {
  color: #fbbf24;
  font-style: italic;
}

/* ============================================
   Language-Specific Overrides
   ============================================ */

/* Rust-specific */
.token.attribute-name {
  color: #c084fc;
}

/* SQL */
.language-sql .token.keyword {
  color: #67e8f9;
}

/* TOML */
.token.table {
  color: #f97316;
  font-weight: 600;
}

.token.key {
  color: #93c5fd;
}

/* Bash/Shell */
.token.shebang {
  color: #6b7280;
  font-style: italic;
}

.token.command {
  color: #f97316;
}

.token.parameter {
  color: #67e8f9;
}

/* GraphQL */
.token.directive {
  color: #c084fc;
}

.token.definition-query,
.token.definition-mutation,
.token.definition-subscription {
  color: #f97316;
  font-weight: 600;
}

/* ============================================
   Line Numbers (optional future feature)
   ============================================ */

.code-pre.line-numbers {
  counter-reset: line;
}

.code-pre.line-numbers .line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 2.5em;
  margin-right: 1.5em;
  color: rgba(255, 255, 255, 0.25);
  text-align: right;
  font-size: 0.8125rem;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding-right: 1em;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 640px) {
  .code-block {
    border-radius: 0.5rem;
    margin: 1rem -1rem;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .code-pre {
    padding: 1rem;
    font-size: 0.8125rem;
  }

  .copy-button {
    opacity: 1;
  }
}

