/* ═══════════════════════════════════════════════════════════
   NUMEX — Kanvas Referans Kartı
   Chat mesajı içinde gösterilir. AI doküman/kod ürettiğinde
   mesajın altında çıkar. Tıklayınca kanvas paneli açılır.
   data-type: doc | code | markdown
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400&display=swap');

/* Scoped variables — sadece refcard içinde kullanılır */
.msg-content .canvas-ref {
  --void: #040608;
  --bg2: #0c1018;
  --bg3: #111822;
  --bg4: #171f2c;
  --g: #10b981;
  --gb: #34d399;
  --cy: #06b6d4;
  --bl: #3b82f6;
  --pu: #8b5cf6;
  --or: #f59e0b;
  --w: #e8ecf0;
  --l: #b8c4d0;
  --s: #5a6a7e;
  --d: #2d3a4a;
  --dd: #1a2232;
  --b: rgba(255,255,255,0.06);
  --ba: rgba(16,185,129,0.15);
}

/* ═══ DOCUMENT CARD ═══ */
.msg-content .canvas-ref {
  max-width: 480px;
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--ba);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.msg-content .canvas-ref:hover {
  border-color: rgba(16,185,129,0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25), 0 0 0 1px rgba(16,185,129,0.08);
}
.msg-content .canvas-ref:active {
  transform: translateY(0);
}

.msg-content .canvas-ref::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--g), var(--cy));
}

/* ── Header ── */
.msg-content .cr-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--b);
}
.msg-content .cr-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.msg-content .cr-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.msg-content .cr-icon.doc { background: rgba(16,185,129,0.08); }
.msg-content .cr-icon.code { background: rgba(139,92,246,0.08); }
.msg-content .cr-icon.md { background: rgba(6,182,212,0.08); }

.msg-content .cr-title-area { flex: 1; min-width: 0; }
.msg-content .cr-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--w);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-content .cr-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 9px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}
.msg-content .cr-badge.doc { background: rgba(16,185,129,0.08); color: var(--gb); }
.msg-content .cr-badge.code { background: rgba(139,92,246,0.08); color: var(--pu); }
.msg-content .cr-badge.md { background: rgba(6,182,212,0.08); color: var(--cy); }

.msg-content .cr-open {
  padding: 5px 14px;
  border-radius: 7px;
  background: rgba(16,185,129,0.1);
  border: 1px solid var(--ba);
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--gb);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.msg-content .cr-open:hover {
  background: rgba(16,185,129,0.18);
}

/* ── Preview ── */
.msg-content .cr-preview {
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  max-height: 88px;
}
.msg-content .cr-preview-text {
  font-family: 'Merriweather', serif;
  font-size: 12.5px;
  color: var(--s);
  line-height: 1.75;
  font-weight: 300;
}
.msg-content .cr-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(transparent, var(--bg3));
  pointer-events: none;
}

/* ── Footer ── */
.msg-content .cr-footer {
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--b);
  font-size: 10.5px;
  color: var(--dd);
}
.msg-content .cr-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}
.msg-content .cr-stat .icon { font-size: 12px; }

/* ═══ CODE VARIANT ═══ */
.msg-content .canvas-ref.code-variant { border-color: rgba(139,92,246,0.15); }
.msg-content .canvas-ref.code-variant::before { background: linear-gradient(90deg, var(--pu), var(--bl)); }
.msg-content .canvas-ref.code-variant:hover {
  border-color: rgba(139,92,246,0.3);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25), 0 0 0 1px rgba(139,92,246,0.08);
}

.msg-content .cr-code-preview {
  padding: 12px 16px;
  background: var(--void);
  border-bottom: 1px solid var(--b);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--s);
  line-height: 1.6;
  overflow: hidden;
  max-height: 80px;
  position: relative;
}
.msg-content .cr-code-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(transparent, var(--void));
}
.msg-content .cr-code-preview .kw { color: #c792ea; }
.msg-content .cr-code-preview .fn { color: #82aaff; }
.msg-content .cr-code-preview .str { color: #c3e88d; }
.msg-content .cr-code-preview .cm { color: #546e7a; }

/* ═══ VARIANT: Updated (after AI edit) ═══ */
.msg-content .canvas-ref.updated .cr-header { background: rgba(16,185,129,0.02); }
.msg-content .cr-update-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(16,185,129,0.06);
  font-size: 9px;
  font-weight: 600;
  color: var(--gb);
  margin-right: 8px;
}
.msg-content .cr-update-badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gb);
  animation: cr-pulse 2s infinite;
}
@keyframes cr-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
