/* Interactive Python Editor */
.python-playground {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 16px 0 24px;
  overflow: hidden;
  background: var(--surface);
}

.playground-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #306998 0%, #FFD43B 100%);
  border-bottom: 1px solid var(--border);
}

.playground-actions {
  display: flex;
  gap: 8px;
}

.playground-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.playground-btn.run {
  background: white;
  color: #306998;
}

.playground-btn.run:hover {
  background: #f0f0f0;
}

.playground-btn.run:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.playground-btn.reset {
  background: rgba(255,255,255,0.2);
  color: white;
}

.playground-btn.reset:hover {
  background: rgba(255,255,255,0.3);
}


.playground-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Editor with line numbers container */
.playground-editor-with-lines {
  display: flex;
  min-height: 80px;
  overflow: hidden;
}

.playground-editor {
  position: relative;
  background: #1E293B;
  min-height: 80px;
  overflow: hidden;
  flex: 1;
}

.playground-editor textarea,
.playground-editor pre {
  width: 100%;
  padding: 16px;
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 0;
  white-space: pre;
  word-wrap: normal;
  overflow-x: auto;
  overflow-y: auto;
  box-sizing: border-box;
  font-variant-ligatures: none;
}

.playground-editor textarea {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: transparent;
  color: transparent;
  caret-color: #E2E8F0;
  resize: none;
  outline: none;
  z-index: 2;
  -webkit-text-fill-color: transparent;
}

.playground-editor textarea::selection {
  background: rgba(100, 150, 255, 0.3);
}

.playground-editor pre {
  background: #1E293B !important;
  border-radius: 0 !important;
  pointer-events: none;
  z-index: 1;
  min-height: inherit;
  height: 100%;
}

.playground-editor pre code {
  background: none !important;
  padding: 0 !important;
  font-size: inherit;
  color: #E2E8F0;
}

.playground-editor textarea::placeholder {
  color: #64748B;
}

.playground-output {
  border-top: 1px solid var(--border);
  background: #0F172A;
  min-height: 60px;
  max-height: 300px;
  overflow: auto;
}

.playground-output-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  font-size: 0.75rem;
  font-weight: 600;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.playground-output-content {
  padding: 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #E2E8F0;
  white-space: pre-wrap;
  word-break: break-word;
  font-variant-ligatures: none;
  min-height: 1.6em;
}

.playground-output-content.error {
  color: #FCA5A5;
}

.playground-output-content.success {
  color: #86EFAC;
}

.playground-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: #94A3B8;
  font-size: 0.875rem;
}

.playground-loading .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #334155;
  border-top-color: #60A5FA;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Line numbers */
.line-numbers {
  flex-shrink: 0;
  padding: 16px 0;
  background: #1E293B;
  border-right: 1px solid #334155;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #475569;
  user-select: none;
  pointer-events: none;
  overflow: hidden;
}

.line-numbers span {
  display: block;
  padding: 0 12px;
  min-width: 40px;
}

/* Copy code button */
.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #94A3B8;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 10;
}

.playground-editor:hover .copy-code-btn {
  opacity: 1;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #E2E8F0;
}

.copy-code-btn.copied {
  background: #10B981;
  color: white;
}

/* Execution time display */
.execution-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 0.75rem;
  color: #94A3B8;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.execution-time.visible {
  opacity: 1;
}

.execution-time svg {
  width: 12px;
  height: 12px;
}

/* Auto-save indicator */
.auto-save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  padding: 4px 8px;
  transition: opacity 0.3s ease;
}

.auto-save-indicator.saved {
  color: #86EFAC;
}

.auto-save-indicator svg {
  width: 12px;
  height: 12px;
}

/* Running indicator in output area */
.running-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #E2E8F0;
}

.running-indicator .running-spinner {
  width: 14px;
  height: 14px;
  animation: spinnerRotate 0.8s linear infinite;
}

.running-indicator .running-spinner circle {
  stroke: #E2E8F0;
  stroke-linecap: round;
}

@keyframes spinnerRotate {
  to { transform: rotate(360deg); }
}

/* Stop button styles */
.playground-btn.stop {
  background: #EF4444;
  color: white;
}

.playground-btn.stop:hover {
  background: #DC2626;
}
