/* Modern Code Canvas Styles */
.code-canvas-container {
  margin: 0;
  padding: 0;
}

.code-editor-wrapper {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 16px;
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 480px;
  backdrop-filter: blur(16px);
  animation: fadeInUp 0.6s ease-out;
}

.code-editor-wrapper:hover {
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.code-header {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  border-bottom: 1px solid rgba(75, 85, 99, 0.3);
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 20px;
  border-radius: 16px 16px 0 0;
}

.code-header h6 {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #e2e8f0;
  margin: 0;
}

.code-header .dropdown button {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.code-header .dropdown button:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.code-header .dropdown-menu {
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(75, 85, 99, 0.2);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  padding: 8px;
  min-width: 120px;
}

.code-header .dropdown-item {
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.code-header .dropdown-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

.code-content {
  position: relative;
  max-height: 350px;
  overflow-y: auto;
  overflow-x: auto;
  padding: 20px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

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

.code-content::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.code-content::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.3), rgba(100, 116, 139, 0.4));
  border-radius: 3px;
  transition: background 0.2s ease;
}

.code-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.5), rgba(100, 116, 139, 0.6));
}

.line-numbers {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  color: #64748b;
  text-align: right;
  padding-right: 20px;
  user-select: none;
  min-width: 45px;
  position: sticky;
  left: 0;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  z-index: 5;
  font-size: 13px;
  line-height: 1.6;
  font-weight: 400;
}

.line-numbers div {
  height: 20px;
  line-height: 20px;
  position: relative;
}

.line-numbers div:before {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 16px;
  background: linear-gradient(to bottom, transparent, rgba(148, 163, 184, 0.2), transparent);
}

.code-lines {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  white-space: pre;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
}

.code-lines div {
  height: 20px;
  line-height: 20px;
  transition: background-color 0.1s ease;
}

.code-lines div:hover {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  margin: 0 -8px;
  padding: 0 8px;
}

.code-footer {
  background: linear-gradient(135deg, #111827 0%, #030712 100%);
  border-top: 1px solid rgba(75, 85, 99, 0.3);
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 12px 20px;
  border-radius: 0 0 16px 16px;
}

.code-footer small {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 11px;
  color: #9ca3af;
  font-weight: 400;
}

.code-footer .btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.code-footer .btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -6px rgba(59, 130, 246, 0.4);
}

.code-footer .btn:active {
  transform: translateY(0);
}

.code-footer .btn:focus {
  animation: pulse 1.5s infinite;
  outline: none;
}

/* Enhanced Syntax Highlighting */
.text-warning {
  color: #fbbf24 !important;
  font-weight: 500;
}

.text-info {
  color: #60a5fa !important;
  font-weight: 500;
}

.text-success {
  color: #34d399 !important;
  font-weight: 500;
}

.text-primary {
  color: #3b82f6 !important;
  font-weight: 600;
}

.text-muted {
  color: #6b7280 !important;
  font-style: italic;
  opacity: 0.8;
}

.text-white {
  color: #f8fafc !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .code-editor-wrapper {
    max-height: 400px;
    border-radius: 12px;
  }
  
  .code-content {
    padding: 16px;
    font-size: 12px;
    max-height: 280px;
  }
  
  .line-numbers {
    min-width: 35px;
    padding-right: 12px;
    font-size: 11px;
  }
  
  .code-lines {
    font-size: 12px;
  }
  
  .code-lines div,
  .line-numbers div {
    height: 18px;
    line-height: 18px;
  }
  
  .code-header,
  .code-footer {
    padding: 12px 16px;
  }
  
  .code-header h6 {
    font-size: 11px;
  }
  
  .code-header .dropdown button {
    font-size: 10px;
    padding: 4px 8px;
  }
}

@media (max-width: 480px) {
  .code-editor-wrapper {
    max-height: 350px;
    border-radius: 8px;
  }
  
  .code-content {
    padding: 12px;
    max-height: 240px;
  }
  
  .code-header,
  .code-footer {
    padding: 10px 12px;
  }
}

/* Modern glassmorphism effect */
@supports (backdrop-filter: blur(16px)) {
  .code-editor-wrapper {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(16px);
  }
  
  .code-header {
    background: rgba(55, 65, 81, 0.8);
    backdrop-filter: blur(8px);
  }
  
  .code-footer {
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(8px);
  }
}

/* Add modern animations and micro-interactions */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
  }
}

/* Improved focus states for accessibility */
.code-header .dropdown button:focus,
.code-footer .btn:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
  .code-editor-wrapper {
    box-shadow: 
      0 20px 25px -5px rgba(0, 0, 0, 0.3),
      0 10px 10px -5px rgba(0, 0, 0, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.03);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .code-editor-wrapper {
    border: 2px solid #ffffff;
  }
  
  .line-numbers {
    color: #ffffff;
  }
  
  .text-muted {
    opacity: 1;
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .code-editor-wrapper,
  .code-footer .btn,
  .code-lines div {
    transition: none;
    animation: none;
  }
}

/* Print styles */
@media print {
  .code-editor-wrapper {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    border: 2px solid black !important;
  }
  
  .code-header,
  .code-footer {
    background: #f5f5f5 !important;
    color: black !important;
  }
  
  .code-footer .btn {
    display: none;
  }
}