/* Container */
.oai-codebox {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  overflow: hidden;
  margin: 16px 0;
  background: #000; /* مشکی */
}

/* Header bar */
.oai-codebox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  direction: ltr; /* label left, button right like ChatGPT */
}

.oai-codebox__label {
  font-size: 12px;
  opacity: 0.95;
  color: #eaeaea;
  user-select: none;

  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Copy button */
.oai-codebox__copy {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.05s ease, background 0.2s ease, border-color 0.2s ease;
}

.oai-codebox__copy:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.oai-codebox__copy:active {
  transform: scale(0.98);
}

.oai-codebox__copy:disabled {
  opacity: 0.85;
  cursor: default;
}

/* Icon: copy */
.oai-codebox__copyicon {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  opacity: 0.95;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
}

.oai-codebox__copy[data-copy-state="copied"] .oai-codebox__copyicon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}

.oai-codebox__copy[data-copy-state="error"] .oai-codebox__copyicon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6L6 18'/%3E%3Cpath d='M6 6l12 12'/%3E%3C/svg%3E");
}

.oai-codebox__copy[data-copy-state="copied"] {
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.12);
}

.oai-codebox__copy[data-copy-state="error"] {
  border-color: rgba(255,80,80,0.40);
}

/* Code area */
.oai-codebox__pre {
  margin: 0;
  padding: 14px 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  direction: ltr;
  text-align: left;

  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.22) rgba(255,255,255,0.06);
}

.oai-codebox__pre::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.oai-codebox__pre::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.06);
}

.oai-codebox__pre::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.22);
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.06);
}

.oai-codebox__pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.30);
}

.oai-codebox__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.75;
  white-space: pre !important;
  tab-size: 4;
  background: transparent;
  font-variant-ligatures: none;
  letter-spacing: normal;
}

/* If highlight.js theme adds background, force transparent */
.oai-codebox .hljs {
  background: transparent !important;
}

/* Fallback token colors (used when HLJS is missing) */
.oai-codebox .cb-tok-comment { color: #8b949e; }
.oai-codebox .cb-tok-string  { color: #a5d6ff; }
.oai-codebox .cb-tok-number  { color: #79c0ff; }
.oai-codebox .cb-tok-keyword { color: #ff7b72; font-weight: 600; }
.oai-codebox .cb-tok-builtin { color: #d2a8ff; }
.oai-codebox .cb-tok-func    { color: #7ee787; }
.oai-codebox .cb-tok-op      { color: #c9d1d9; }

/* Mobile tuning */
@media (max-width: 480px) {
  .oai-codebox { border-radius: 12px; }
  .oai-codebox__bar { padding: 8px 10px; }
  .oai-codebox__pre { padding: 12px 12px; }
  .oai-codebox__code { font-size: 12.5px; line-height: 1.7; }
  .oai-codebox__copy { padding: 6px 8px; gap: 6px; }
  .oai-codebox__copytext { font-size: 12px; }
}
/* === CodeBox: force ChatGPT-like dark background (theme-proof) === */
.oai-codebox{
  background:#000 !important;
}
.oai-codebox__bar{
  background: rgba(255,255,255,0.06) !important;
}
.oai-codebox__pre{
  background:#000 !important;
}
.oai-codebox__code,
.oai-codebox .hljs{
  background: transparent !important;
}
/* Some themes target pre/code globally; ensure our box stays dark */
.oai-codebox pre,
.oai-codebox code{
  background: transparent !important;
}
