/* Enhanced Code Block Styles */
.code-block-enhanced {
  font-family: 'Fira Code', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 2px;
}

.code-block-enhanced .code-content {
  background: #1a1a1a;
  border-radius: 10px;
  overflow: hidden;
}

/* Custom syntax highlighting improvements */
.shiki .token.comment {
  font-style: italic;
  opacity: 0.7;
}

.shiki .token.string {
  color: #98d982;
}

.shiki .token.property {
  color: #79dae8;
}

.shiki .token.selector {
  color: #c792ea;
}

.shiki .token.function {
  color: #82aaff;
}

.shiki .token.keyword {
  color: #c792ea;
  font-weight: 500;
}

/* Copy button animations */
@keyframes copySuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.copy-success {
  animation: copySuccess 0.3s ease-in-out;
}

/* Responsive code blocks */
@media (max-width: 640px) {
  .code-block-container {
    border-radius: 8px;
  }

  .shiki-code-wrapper pre {
    padding: 1rem;
    font-size: 12px;
  }
}

/* RTL Support for code comments */
.code-block-container[dir="rtl"] {
  direction: ltr;
  text-align: left;
}

.code-block-container .comment-rtl {
  direction: rtl;
  text-align: right;
  font-family: 'Noto Sans Arabic', Arial, sans-serif;
}

/* Enhanced scrollbar */
.shiki-code-wrapper {
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 155, 155, 0.5) transparent;
}

.shiki-code-wrapper::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.shiki-code-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.shiki-code-wrapper::-webkit-scrollbar-thumb {
  background-color: rgba(155, 155, 155, 0.5);
  border-radius: 20px;
  border: transparent;
}

.shiki-code-wrapper::-webkit-scrollbar-thumb:hover {
  background-color: rgba(155, 155, 155, 0.7);
}

/* Code language badge */
.code-language-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  z-index: 10;
}

/* Line numbers support */
.shiki-line-numbers {
  counter-reset: line;
}

.shiki-line-numbers .line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 2.5rem;
  margin-right: 1rem;
  text-align: right;
  color: rgba(255, 255, 255, 0.4);
  user-select: none;
}

/* Theme variations */
.code-block-light {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.code-block-dark {
  background: #1a202c;
  border: 1px solid #2d3748;
}

/* Hover effects */
.code-block-container:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease-in-out;
}

/* Focus states for accessibility */
.copy-code-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Loading state */
.code-block-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
