/* Qubyt Core — Premium kod editörü modülü
 * Bağımsız: yalnızca .ce-editor bileşenine etki eder.
 * Renkler özgün; temalanmış değil — proje kimliği ile uyumlu kuantum mor/cyan damarı. */

.ce-editor {
  --ce-bg: #0c0d14;
  --ce-bg-soft: #11131c;
  --ce-bar-bg: rgba(20, 22, 30, 0.92);
  --ce-text: #d6dae6;
  --ce-muted: #767e94;
  --ce-line: rgba(255, 255, 255, 0.05);
  --ce-rule: rgba(255, 255, 255, 0.04);
  --ce-edge: rgba(167, 139, 250, 0.22);

  /* Token paleti — özgün, telifsiz; kuantum mor/cyan/amber/mint çekirdek */
  --ce-comment: #5e6580;
  --ce-string: #fcd093;
  --ce-number: #86efac;
  --ce-keyword: #c084fc;
  --ce-builtin: #f0abfc;
  --ce-fn: #fde68a;
  --ce-class: #7dd3fc;
  --ce-decorator: #f87171;
  --ce-operator: #b6bdd2;

  position: relative;
  margin: 1.5rem 0;
  border-radius: 16px;
  border: 1px solid var(--ce-edge);
  background:
    radial-gradient(ellipse 70% 110% at 0% 0%, rgba(167, 139, 250, 0.1), transparent 55%),
    radial-gradient(ellipse 60% 90% at 100% 100%, rgba(56, 189, 248, 0.06), transparent 55%),
    var(--ce-bg);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.4);
}

/* ince gradient kenar — :before ile mask */
.ce-editor::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
      rgba(167, 139, 250, 0.55) 0%,
      rgba(56, 189, 248, 0.18) 38%,
      transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.6;
  pointer-events: none;
}

/* ─────────────────────── Üst başlık çubuğu ─────────────────────── */

.ce-editor__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--ce-line);
  background: linear-gradient(180deg, var(--ce-bar-bg), rgba(14, 15, 23, 0.96));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.ce-editor__dots {
  display: inline-flex;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.ce-editor__dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot, #c084fc);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.55),
    0 0 8px var(--glow, transparent);
}

.ce-editor__dots span:nth-child(1) {
  --dot: #c084fc;
  --glow: rgba(192, 132, 252, 0.5);
}

.ce-editor__dots span:nth-child(2) {
  --dot: #7dd3fc;
  --glow: rgba(125, 211, 252, 0.5);
}

.ce-editor__dots span:nth-child(3) {
  --dot: #86efac;
  --glow: rgba(134, 239, 172, 0.45);
}

.ce-editor__file {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.01em;
  color: #d6dae6;
  white-space: nowrap;
  min-width: 0;
}

.ce-editor__file svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.85;
}

.ce-editor__filename {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ce-editor__lang {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(196, 181, 253, 0.9);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  padding-left: 0.55rem;
  margin-left: 0.15rem;
}

.ce-editor__copy {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.3);
  background: rgba(167, 139, 250, 0.06);
  color: #e2e7f0;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease, color 0.18s ease;
}

.ce-editor__copy:hover {
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.55);
}

.ce-editor__copy:active {
  transform: scale(0.97);
}

.ce-editor__copy:focus-visible {
  outline: 2px solid var(--accent-strong, #c4b5fd);
  outline-offset: 2px;
}

.ce-editor__copy.is-copied {
  background: rgba(134, 239, 172, 0.12);
  border-color: rgba(134, 239, 172, 0.45);
  color: #bbf7d0;
}

.ce-editor__copy svg {
  width: 14px;
  height: 14px;
}

.ce-editor__copy-icon--check {
  display: none;
}

.ce-editor__copy.is-copied .ce-editor__copy-icon--clip {
  display: none;
}

.ce-editor__copy.is-copied .ce-editor__copy-icon--check {
  display: inline-block;
}

/* ─────────────────────── Kod gövdesi ──────────────────────────── */

.ce-editor__body {
  position: relative;
  overflow-x: auto;
  background:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(167, 139, 250, 0.045), transparent 70%),
    var(--ce-bg);
}

.ce-editor__body::before {
  content: "";
  position: absolute;
  left: 3.05rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.ce-editor__code {
  margin: 0;
  padding: 0.95rem 1.1rem 1.1rem;
  counter-reset: ce-line;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ce-text);
  -moz-tab-size: 4;
  tab-size: 4;
}

.ce-editor__code code {
  font: inherit;
  color: inherit;
}

.ce-line {
  display: block;
  position: relative;
  padding-left: 3rem;
  white-space: pre;
  border-left: 2px solid transparent;
  margin-left: -1.1rem;
  padding-right: 1.1rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ce-line::before {
  counter-increment: ce-line;
  content: counter(ce-line);
  position: absolute;
  left: 0;
  width: 2.55rem;
  text-align: right;
  padding-right: 0.85rem;
  color: #3b4361;
  user-select: none;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  transition: color 0.15s ease;
}

.ce-line:hover {
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.05), transparent 70%);
  border-left-color: rgba(167, 139, 250, 0.45);
}

.ce-line:hover::before {
  color: #8e96b3;
}

.ce-line:empty::after {
  content: "\200B";
}

/* WebKit kaydırma çubuğu — kod gövdesi */
.ce-editor__body::-webkit-scrollbar {
  height: 8px;
}

.ce-editor__body::-webkit-scrollbar-track {
  background: transparent;
}

.ce-editor__body::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.35);
  border-radius: 999px;
}

.ce-editor__body::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.6);
}

/* ─────────────────────── Alt durum çubuğu ─────────────────────── */

.ce-editor__statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  padding: 0.45rem 0.9rem;
  border-top: 1px solid var(--ce-line);
  background: rgba(14, 15, 23, 0.85);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ce-muted);
}

.ce-editor__status-tag {
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  background: rgba(192, 132, 252, 0.1);
  color: #c4b5fd;
  border: 1px solid rgba(192, 132, 252, 0.24);
}

.ce-editor__status-meta {
  margin-left: auto;
  white-space: nowrap;
}

/* ─────────────────────── Sözdizimi tokenları ──────────────────── */

.ce-comment {
  color: var(--ce-comment);
  font-style: italic;
}

.ce-string {
  color: var(--ce-string);
}

.ce-number {
  color: var(--ce-number);
}

.ce-keyword {
  color: var(--ce-keyword);
  font-weight: 500;
}

.ce-builtin {
  color: var(--ce-builtin);
}

.ce-fn {
  color: var(--ce-fn);
}

.ce-klass {
  color: var(--ce-class);
}

.ce-decorator {
  color: var(--ce-decorator);
}

.ce-op {
  color: var(--ce-operator);
}

/* Mobil ince ayarlar */
@media (max-width: 540px) {
  .ce-editor__lang {
    display: none;
  }

  .ce-editor__copy-label {
    display: none;
  }

  .ce-editor__copy {
    padding: 0.42rem 0.55rem;
  }

  .ce-editor__code {
    font-size: 0.82rem;
  }

  .ce-line {
    padding-left: 2.6rem;
  }

  .ce-line::before {
    width: 2.2rem;
  }
}
