/* ============================================================================
 * Nyx AI Chat - Marketing Demo styles
 * ----------------------------------------------------------------------------
 * A 1:1 plain-CSS translation of the real app's Tailwind classes. Everything
 * is scoped under .nyx-chat so it can drop into any page without colliding
 * with the marketing site's own styles. No Tailwind, no build step required.
 *
 * Design tokens (from the app's src/index.css):
 *   --nyx-blue:   #2563eb   (Tailwind blue-600 / the app's --blue)
 *   --nyx-violet: #7c3aed   (the app's --violet)
 * The blue→violet gradient is used on the trigger button and send button.
 * ==========================================================================*/

.nyx-chat {
  /* Tokens */
  --nyx-blue: #2563eb;
  --nyx-violet: #7c3aed;

  /* Slate scale (Tailwind) */
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-600: #2563eb;
  --red-500: #ef4444;

  /* Exact font stack from the app (src/index.css). System fonts - nothing to
     load. If your marketing site standardises on Inter, see the README. */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
    'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
    'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: left;
  box-sizing: border-box;
}
.nyx-chat *,
.nyx-chat *::before,
.nyx-chat *::after { box-sizing: border-box; }

/* ── Demo stage (embeds the panel; not part of the real app) ─────────────── */
.nyx-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

/* ── Panel ───────────────────────────────────────────────────────────────
 * Real: fixed bottom-6 right-6 w-[480px] h-[calc(100vh-96px)] rounded-2xl
 *       shadow-2xl bg-white border border-slate-200 overflow-hidden
 * For embedding we make it position:relative with a fixed height. To pin it
 * bottom-right like the real app, add the .nyx-panel--fixed modifier. */
.nyx-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 480px;
  height: 640px;
  max-height: calc(100vh - 96px);
  border-radius: 16px;                 /* rounded-2xl */
  background: #fff;
  border: 1px solid var(--slate-200);
  overflow: hidden;
  /* shadow-2xl */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.nyx-panel--fixed {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 50;
}

/* ── Header ──────────────────────────────────────────────────────────────
 * flex items-center gap-2 px-4 py-3 border-b border-slate-200 bg-white */
.nyx-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-200);
  flex-shrink: 0;
  background: #fff;
}
.nyx-logo { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; border-radius: 6px; }
.nyx-title { font-size: 14px; font-weight: 600; color: var(--slate-800); }
.nyx-beta {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 9999px;
  background: var(--blue-100);
  color: var(--blue-600);
  border: 1px solid var(--blue-200);
}
.nyx-spacer { flex: 1; }
.nyx-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  color: var(--slate-400);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.nyx-iconbtn:hover { color: var(--slate-600); background: var(--slate-100); }

/* ── Messages list ───────────────────────────────────────────────────────
 * flex-1 overflow-y-auto p-4 flex flex-col gap-3 bg-white */
.nyx-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
}

/* Empty state: flex-1 flex flex-col items-center justify-center gap-4 p-6 */
.nyx-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: #fff;
}
.nyx-empty-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.nyx-empty-head .nyx-spark { color: var(--slate-400); }
.nyx-empty-head p { margin: 0; font-size: 14px; color: var(--slate-400); }
.nyx-suggestions { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.nyx-suggestion {
  border-radius: 9999px;
  border: 1px solid var(--slate-200);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--slate-500);
  text-align: left;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.nyx-suggestion:hover { border-color: var(--slate-400); background: #f8fafc; }

/* ── User message ────────────────────────────────────────────────────────
 * flex flex-col items-end gap-1
 * bubble: max-w-[85%] rounded-2xl rounded-br-sm px-4 py-2.5 bg-blue-600
 *         text-white text-[13px] */
.nyx-row-user { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.nyx-bubble-user {
  max-width: 85%;
  border-radius: 16px 16px 2px 16px;   /* rounded-2xl + rounded-br-sm */
  padding: 10px 16px;
  background: var(--blue-600);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.nyx-time { font-size: 10px; color: var(--slate-400); }

/* ── Assistant message ───────────────────────────────────────────────────
 * flex flex-col items-start gap-1
 * bubble: max-w-[90%] rounded-2xl rounded-bl-sm px-4 py-3 bg-slate-100
 *         border border-slate-200 text-slate-800 text-[13px] leading-relaxed */
.nyx-row-ai { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.nyx-bubble-ai {
  max-width: 90%;
  border-radius: 16px 16px 16px 2px;   /* rounded-2xl + rounded-bl-sm */
  padding: 12px 16px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  color: var(--slate-800);
  font-size: 13px;
  line-height: 1.625;                  /* leading-relaxed */
  word-break: break-word;
}
/* Markdown inside assistant bubbles */
.nyx-md p { margin: 0 0 8px 0; font-size: 13px; color: var(--slate-800); }
.nyx-md p:last-child { margin-bottom: 0; }
.nyx-md ul, .nyx-md ol { margin: 0 0 8px 0; padding-left: 16px; }
.nyx-md ul { list-style: disc; }
.nyx-md ol { list-style: decimal; }
.nyx-md li { font-size: 13px; color: var(--slate-800); margin-bottom: 4px; }
.nyx-md strong { font-weight: 500; color: var(--slate-900); }
.nyx-md code {
  background: var(--slate-200);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 11px;
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
  color: var(--blue-600);
}
/* Streaming cursor - ▋ animate-pulse */
.nyx-cursor { display: inline-block; animation: nyx-pulse 1s ease-in-out infinite; }

/* ── Typing indicator ────────────────────────────────────────────────────
 * self-start max-w-[90%] rounded-2xl rounded-bl-sm px-4 py-3 bg-slate-100
 * 3 dots w-2 h-2 bg-slate-400 animate-bounce (delays 0/150/300ms) */
.nyx-typing {
  align-self: flex-start;
  max-width: 90%;
  border-radius: 16px 16px 16px 2px;
  padding: 12px 16px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
}
.nyx-typing-dots { display: flex; align-items: center; gap: 4px; }
.nyx-typing-dots span {
  width: 8px; height: 8px; border-radius: 9999px;
  background: var(--slate-400);
  animation: nyx-bounce 1s infinite;
}
.nyx-typing-dots span:nth-child(1) { animation-delay: 0ms; }
.nyx-typing-dots span:nth-child(2) { animation-delay: 150ms; }
.nyx-typing-dots span:nth-child(3) { animation-delay: 300ms; }

/* ── Input bar ───────────────────────────────────────────────────────────
 * p-3 border-t border-slate-200 bg-white
 * box: relative flex items-end gap-2 rounded-xl border border-slate-300
 *      bg-white px-3 py-2 focus-within ring */
.nyx-input { padding: 12px; border-top: 1px solid var(--slate-200); background: #fff; flex-shrink: 0; }
.nyx-input-box {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid var(--slate-300);
  background: #fff;
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.nyx-input-box.is-focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px var(--blue-200);
}
.nyx-input-box textarea {
  flex: 1;
  resize: none;
  background: transparent;
  font-size: 13px;
  color: var(--slate-800);
  border: 0;
  outline: none;
  line-height: 1.625;
  max-height: 96px;
  font-family: inherit;
}
.nyx-input-box textarea::placeholder { color: var(--slate-400); }
.nyx-send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  color: #fff;
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, var(--nyx-blue), var(--nyx-violet));
  transition: opacity .15s;
}
.nyx-send:hover { opacity: .9; }
.nyx-send:disabled { opacity: .4; cursor: default; }
.nyx-input-hint { margin: 6px 0 0; text-align: center; font-size: 10px; color: var(--slate-400); }

/* ── Inline chart card ───────────────────────────────────────────────────
 * mt-2 rounded-lg border #e2e8f0 bg #fff */
.nyx-chartcard { margin-top: 8px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; }
.nyx-chartcard-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; }
.nyx-chartcard-title { font-size: 12px; font-weight: 500; color: #1e293b; }
.nyx-metric-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.nyx-chart-area { margin: 0 12px; border-radius: 6px; background: #f8fafc; }
.nyx-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 80px; }
.nyx-stat-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.nyx-stat-sub { font-size: 10px; color: #94a3b8; }
.nyx-chartcard-foot { display: flex; align-items: center; gap: 8px; padding: 6px 12px; }
.nyx-time-label { font-size: 10px; color: #94a3b8; }
.nyx-filter-pill { font-size: 9px; padding: 2px 6px; border-radius: 4px; background: #f1f5f9; color: #64748b; }
.nyx-chartcard-actions { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid #f1f5f9; }
.nyx-btn-pin {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 6px 12px; border-radius: 6px;
  color: #fff; background: #3b82f6; border: 0; cursor: pointer;
}
.nyx-btn-alert {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 6px 12px; border-radius: 6px;
  color: #64748b; background: #fff; border: 1px solid #e2e8f0; cursor: pointer;
}

/* ── Policy action card ──────────────────────────────────────────────────
 * mt-2.5 rounded-lg overflow-hidden border 0.5px #e2e8f0 bg #fff */
.nyx-policycard { margin-top: 10px; border-radius: 8px; overflow: hidden; border: 0.5px solid #e2e8f0; background: #fff; }
.nyx-policycard-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: #f8fafc; border-bottom: 0.5px solid #f1f5f9;
}
.nyx-policycard-head .nyx-pc-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: #334155; }
.nyx-policycard-badges { display: flex; align-items: center; gap: 6px; }
.nyx-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.nyx-policycard-summary { padding: 8px 14px; font-size: 12px; color: #475569; }
.nyx-policycard-summary .nyx-k { font-weight: 500; }
.nyx-yaml { margin: 8px 14px; border-radius: 6px; overflow: hidden; background: #1e293b; }
.nyx-yaml pre {
  margin: 0; padding: 10px 14px; overflow-x: auto;
  color: #94a3b8; font-size: 11px; line-height: 1.7;
  font-family: ui-monospace, source-code-pro, Menlo, Monaco, Consolas, monospace;
}
.nyx-yaml-more { width: 100%; text-align: left; padding: 0 14px 8px; font-size: 11px; color: #60a5fa; background: transparent; border: 0; cursor: pointer; }
.nyx-yaml-more:hover { text-decoration: underline; }
.nyx-policycard-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 14px 12px; }
.nyx-btn-apply { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 4px 12px; border-radius: 6px; color: #fff; background: #111827; border: 0; cursor: pointer; }
.nyx-btn-ghost { font-size: 11px; padding: 4px 10px; border-radius: 6px; color: #334155; background: #fff; border: 1px solid #e2e8f0; cursor: pointer; }
.nyx-btn-text { font-size: 11px; padding: 4px 10px; border-radius: 6px; color: #64748b; background: transparent; border: 0; cursor: pointer; }
.nyx-btn-dismiss { font-size: 11px; color: #94a3b8; background: transparent; border: 0; cursor: pointer; margin-left: auto; }
.nyx-btn-dismiss:hover { text-decoration: underline; }

/* ── Alert confirm card ──────────────────────────────────────────────────
 * mt-2 rounded-lg overflow-hidden border 0.5px #93c5fd bg #eff6ff */
.nyx-alertcard { margin-top: 8px; border-radius: 8px; overflow: hidden; border: 0.5px solid #93c5fd; background: #eff6ff; }
.nyx-alertcard-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; }
.nyx-alertcard-head .nyx-ac-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: #2563eb; }
.nyx-ac-edit { font-size: 11px; color: #2563eb; opacity: .7; background: transparent; border: 0; cursor: pointer; }
.nyx-ac-edit:hover { text-decoration: underline; }
.nyx-alertcard-fields { padding: 0 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.nyx-ac-name {
  height: 32px; font-size: 13px; font-weight: 500; padding: 0 10px;
  border-radius: 6px; border: 1px solid rgba(147,197,253,0.5);
  background: rgba(255,255,255,0.5); color: #1e293b; width: 100%;
}
.nyx-ac-sev { display: flex; gap: 4px; }
.nyx-ac-sev button { font-size: 11px; padding: 4px 10px; border-radius: 6px; cursor: pointer; background: transparent; }
.nyx-ac-cond { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nyx-ac-metric { font-size: 10px; padding: 2px 6px; border-radius: 6px; background: #dbeafe; color: #1d4ed8; }
.nyx-ac-cond select, .nyx-ac-cond input {
  font-size: 11px; border: 1px solid rgba(147,197,253,0.5); border-radius: 4px;
  padding: 2px 6px; height: 24px; background: rgba(255,255,255,0.5); color: #334155;
}
.nyx-ac-cond input { width: 64px; }
.nyx-ac-per { font-size: 10px; color: #6b7280; }
.nyx-ac-scope { display: flex; align-items: center; gap: 6px; }
.nyx-ac-scope-badge { font-size: 10px; padding: 2px 6px; border-radius: 6px; background: #e2e8f0; color: #475569; }
.nyx-ac-channels { display: flex; align-items: center; gap: 6px; }
.nyx-ac-chan { font-size: 10px; padding: 2px 8px; border-radius: 6px; cursor: pointer; background: transparent; }
.nyx-ac-chan--inapp { background: rgba(147,197,253,0.2); color: #2563eb; opacity: .6; border: 0; }
.nyx-ac-chan--on { background: rgba(147,197,253,0.2); border: 1px solid #93c5fd; color: #2563eb; }
.nyx-ac-chan--off { background: transparent; border: 1px solid rgba(147,197,253,0.3); color: #9ca3af; }
.nyx-ac-ai { display: flex; align-items: center; gap: 16px; }
.nyx-ac-ai label { display: flex; align-items: center; gap: 6px; font-size: 10px; color: #6b7280; }
.nyx-switch { position: relative; width: 28px; height: 16px; border-radius: 9999px; background: #cbd5e1; transition: background .15s; flex-shrink: 0; }
.nyx-switch.on { background: #2563eb; }
.nyx-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 9999px; background: #fff; transition: transform .15s; }
.nyx-switch.on::after { transform: translateX(12px); }
.nyx-alertcard-divider { height: 1px; background: rgba(147,197,253,0.3); }
.nyx-alertcard-actions { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; }
.nyx-ac-save { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 4px 12px; border-radius: 6px; color: #fff; background: #111827; border: 0; cursor: pointer; }
.nyx-ac-editchat { font-size: 11px; padding: 4px 10px; border-radius: 6px; color: #2563eb; background: #fff; border: 1px solid rgba(147,197,253,0.5); cursor: pointer; }

/* ── Demo control strip (not part of the real app) ───────────────────────── */
.nyx-demo-controls {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-top: 16px;
}
.nyx-demo-controls button {
  font-size: 12px; padding: 6px 14px; border-radius: 9999px;
  border: 1px solid var(--slate-300); background: #fff; color: var(--slate-600);
  cursor: pointer; transition: all .15s;
}
.nyx-demo-controls button:hover:not(:disabled) { border-color: var(--nyx-blue); color: var(--nyx-blue); }
.nyx-demo-controls button:disabled { opacity: .45; cursor: default; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes nyx-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes nyx-bounce {
  0%,100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8,0,1,1); }
  50%     { transform: translateY(0);    animation-timing-function: cubic-bezier(0,0,0.2,1); }
}
.nyx-spin { animation: nyx-spin 1s linear infinite; }
@keyframes nyx-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .nyx-cursor, .nyx-typing-dots span, .nyx-spin { animation: none; }
}
