/* ============================================================
   Mindcracker AI — site assistant widget
   Matches the site system: sharp corners, thin lines,
   JetBrains Mono labels, Inter Tight body, blue/orange accents.
   ============================================================ */

.mcb-root, .mcb-root * { box-sizing: border-box; }

.mcb-root {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  z-index: 9999;
  font-family: 'Inter Tight', sans-serif;
}

/* ---------- launcher ---------- */
.mcb-launch {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 6px;
  background: rgba(11, 15, 26, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease, padding 0.25s ease;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
}
.mcb-launch:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
  padding-left: 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

/* circular face */
.mcb-face {
  position: relative;
  width: 50px;
  height: 50px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 36%, rgba(210, 106, 30, 0.26), rgba(210, 106, 30, 0.05) 72%);
}
.mcb-face img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
}
/* pulsing rings */
.mcb-face::before,
.mcb-face::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--orange);
  animation: mcbPulse 3.2s ease-out infinite;
  pointer-events: none;
}
.mcb-face::after { animation-delay: 1.6s; }
@keyframes mcbPulse {
  0% { opacity: 0.55; transform: scale(0.85); }
  70% { opacity: 0; transform: scale(1.3); }
  100% { opacity: 0; transform: scale(1.3); }
}
/* online status dot */
.mcb-status {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ok, #46c896);
  border: 2px solid var(--bg-2);
  box-shadow: 0 0 8px 1px rgba(70, 200, 150, 0.6);
}

.mcb-launch .mcb-launch-txt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.28s ease, opacity 0.2s ease, margin 0.28s ease;
}
.mcb-launch:hover .mcb-launch-txt {
  max-width: 220px;
  opacity: 1;
  margin-right: 4px;
  color: var(--ink);
}
.mcb-root.is-open .mcb-launch { display: none; }

/* node mark animation */
.mcb-mark .mcb-core { transform-origin: 13px 13px; animation: mcbCore 3.2s ease-in-out infinite; }
.mcb-mark .mcb-ring { transform-origin: 13px 13px; animation: mcbRing 3.2s ease-out infinite; }
@keyframes mcbCore { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes mcbRing { 0% { opacity: 0.5; transform: scale(0.6); } 70% { opacity: 0; } 100% { opacity: 0; transform: scale(1.25); } }

/* ---------- panel ---------- */
.mcb-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(390px, calc(100vw - 32px));
  height: min(580px, calc(100vh - 96px));
  display: none;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.mcb-root.is-open .mcb-panel { display: flex; animation: mcbIn 0.26s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes mcbIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* header */
.mcb-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 15px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(210, 106, 30, 0.06), transparent);
}
.mcb-head .mcb-mark { width: 30px; height: 30px; flex: none; }
.mcb-head-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mcb-head-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1;
}
.mcb-head-sub {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.mcb-head-sub .mcb-live {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok, #46c896);
  box-shadow: 0 0 8px 1px rgba(70, 200, 150, 0.6);
  animation: mcbBlink 1.8s ease-in-out infinite;
}
@keyframes mcbBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.mcb-close {
  margin-left: auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
  flex: none;
}
.mcb-close:hover { border-color: var(--line-strong); color: var(--ink); }
.mcb-close svg { width: 13px; height: 13px; }

/* messages */
.mcb-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.mcb-log::-webkit-scrollbar { width: 8px; }
.mcb-log::-webkit-scrollbar-thumb { background: var(--line-strong); }

.mcb-msg { display: flex; gap: 10px; max-width: 100%; }
.mcb-msg .mcb-av {
  width: 24px; height: 24px; flex: none; margin-top: 2px;
}
.mcb-bubble {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
}
/* assistant */
.mcb-msg.bot .mcb-bubble {
  color: var(--ink);
  font-weight: 300;
}
/* user */
.mcb-msg.user { flex-direction: row-reverse; }
.mcb-msg.user .mcb-bubble {
  background: var(--bg-3);
  border: 1px solid var(--line);
  padding: 10px 13px;
  color: var(--ink);
  font-weight: 400;
}

/* typing */
.mcb-typing { display: inline-flex; gap: 5px; padding: 4px 0; }
.mcb-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue);
  opacity: 0.4;
  animation: mcbDot 1.1s ease-in-out infinite;
}
.mcb-typing span:nth-child(2) { animation-delay: 0.18s; }
.mcb-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes mcbDot { 0%,100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* suggestion chips */
.mcb-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 14px; }
.mcb-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  padding: 8px 11px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.mcb-chip:hover { border-color: var(--blue); color: var(--ink); }

/* input */
.mcb-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.mcb-input {
  flex: 1 1 auto;
  resize: none;
  max-height: 96px;
  min-height: 22px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: 'Inter Tight', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.mcb-input::placeholder { color: var(--muted); }
.mcb-send {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--orange);
  border: 1px solid var(--orange);
  color: #fff;
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.mcb-send:hover { background: var(--orange-deep); box-shadow: 0 0 0 4px var(--orange-glow); }
.mcb-send:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.mcb-send svg { width: 16px; height: 16px; }

.mcb-foot {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: center;
  padding: 0 0 10px;
  background: var(--bg);
}
.mcb-foot a { color: var(--muted); }
.mcb-foot a:hover { color: var(--blue); }

@media (prefers-reduced-motion: reduce) {
  .mcb-root *, .mcb-root *::before, .mcb-root *::after { animation: none !important; }
}
