/* Scophix v2 — global custom classes
   Only styles that Tailwind cannot express as utility classes belong here.
   Everything else must use Tailwind utility classes in templates.
   ─────────────────────────────────────────────────────────────────────── */

/* ── Alpine.js cloak — hides x-cloak elements until Alpine initializes ───── */
/* Without this, elements like the Coming Soon modal flash visible on every
   page load before deferred Alpine.js evaluates x-show.                     */

[x-cloak] { display: none !important; }

/* ── Glass morphism panels ──────────────────────────────────────────────── */

.lg-dark {
  background: #0f172a;
}

.lg-panel {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.lg-amber {
  background: rgba(254, 243, 199, 0.55);
  border: 1px solid rgba(251, 191, 36, 0.4);
}

/* ── Assistant dock button glow ─────────────────────────────────────────── */
/* Multi-layer box-shadow cannot be expressed as a Tailwind utility          */

.dock-glow {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 0 28px rgba(99, 102, 241, 0.35),
    0 8px 40px rgba(0, 0, 0, 0.50),
    0 2px 8px rgba(0, 0, 0, 0.30);
}

/* ── AI Workbench badge on dock button ──────────────────────────────────── */
/* rgba background + glow cannot be expressed as Tailwind utilities          */

.badge-ai {
  background: rgba(251, 191, 36, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.55);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ── Scophix logo connector lines ───────────────────────────────────────── */
/* Specific rotation values not available as Tailwind utilities               */

.logo-line-neg { transform: rotate(-28deg); }
.logo-line-pos { transform: rotate(28deg); }

/* ── Topbar height token (updated by JS in base.html on load + resize) ───── */
:root { --topbar-h: 65px; }

/* ── Assistant dock: on desktop, panel starts below the topbar ───────────── */
@media (min-width: 1024px) {
  .dock-below-topbar { top: var(--topbar-h, 65px); }
}

/* Mermaid flowchart labels default to a thin weight — bump for PM readability. */
.kd-flow-diagram.mermaid text,
.kd-flow-diagram.mermaid .nodeLabel,
.kd-flow-diagram.mermaid .edgeLabel,
.kd-flow-diagram.mermaid .label,
.kd-flow-diagram.mermaid .cluster-label,
.kd-flow-diagram.mermaid foreignObject div,
.kd-flow-diagram.mermaid foreignObject span {
  font-weight: 800 !important;
}

/*
 * Mermaid draws subgraph titles inside the cluster rect; lift Stage-N fully
 * above the box so the title is not bisected by the cluster border / arrows.
 */
.kd-flow-diagram.mermaid g.cluster > foreignObject,
.kd-flow-diagram.mermaid .cluster-label,
.kd-flow-diagram.mermaid g.cluster > .cluster-label foreignObject {
  transform: translateY(-2.75rem) !important;
}
/* ── Req clarification (Claude Code AskUserQuestion pattern) ── */
.req-clarify {
  margin: 8px 0;
  border: 1px solid #e0e0dc;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.req-clarify__head {
  padding: 10px 12px;
  background: #f7f7f5;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 8px;
}

.req-clarify__chip {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #1a1a1a;
  color: #fff;
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}

.req-clarify__title {
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.45;
  margin: 0;
}

.req-clarify__body {
  padding: 8px;
}

.req-clarify__option {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.req-clarify__option:hover {
  border-color: #ccc;
  background: #fafaf8;
}

.req-clarify__option.is-selected {
  border-color: #1a1a1a;
  background: #f7f7f5;
  box-shadow: inset 0 0 0 1px #1a1a1a;
}

.req-clarify__option-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 3px;
}

.req-clarify__option-desc {
  display: block;
  font-size: 11px;
  color: #666;
  line-height: 1.45;
}

.req-clarify__other {
  padding: 8px 12px 10px;
  border-top: 1px dashed #eee;
}

.req-clarify__other-input {
  width: 100%;
  margin-top: 6px;
  font-size: 11px;
  padding: 8px 10px;
  border: 1px solid #e0e0dc;
  border-radius: 6px;
  font-family: inherit;
}

.req-clarify__footer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  background: #fafaf8;
}

.req-clarify__btn {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
}

.req-clarify__btn--primary {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

.req-clarify__btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Wizard (multi-question) */
.req-clarify--wizard .req-clarify__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  background: #fafaf8;
}

.req-clarify__tab {
  font-size: 10px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  color: #444;
}

.req-clarify__tab.is-active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

.req-clarify__tab.is-answered:not(.is-active) {
  border-color: #1a1a1a;
  color: #1a1a1a;
}

.req-clarify__tab--submit {
  margin-left: auto;
}

.req-clarify__panel {
  padding: 10px 12px 12px;
}

.req-clarify__panel .req-clarify__head {
  padding: 0 0 8px;
  background: transparent;
  border: none;
}

.req-clarify__panel .req-clarify__body {
  padding: 0;
}

.req-clarify__option.is-recommended {
  border-color: #c8d4e8;
}

.req-clarify__rec-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #2563eb;
  margin-left: 4px;
}

.req-clarify__other-label {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.req-clarify__step-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.req-clarify__step-actions .req-clarify__btn--primary {
  flex: 1;
}

.req-clarify__hints {
  padding: 6px 12px;
  font-size: 10px;
  color: #999;
  text-align: center;
  border-top: 1px dashed #eee;
}

.req-clarify__footer-actions {
  padding: 8px 12px 10px;
  border-top: 1px solid #eee;
  background: #fafaf8;
}

.req-clarify__review-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  font-size: 11px;
}

.req-clarify__review-q {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

.req-clarify__review-a {
  display: block;
  color: #666;
  margin-bottom: 8px;
}

.req-clarify__review-warn {
  font-size: 11px;
  color: #b45309;
  margin: 0 0 8px;
}

/* Agent req_ask question in chat history — distinct green panel on AI side */
.req-ask-bubble {
  display: block;
  border: 1.5px solid #34d399 !important;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%) !important;
  border-radius: 1rem !important;
  padding: 0.875rem 1rem !important;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.12);
  color: #064e3b !important;
}
.req-ask-bubble::before {
  content: 'Agent question';
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #065f46;
  background: #a7f3d0;
  border: 1px solid #34d399;
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 0.65rem;
}
.req-ask-bubble strong {
  color: #064e3b;
}
.req-ask-bubble ul,
.req-ask-bubble ol {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}
.req-ask-bubble li {
  color: #065f46;
}

.ai-panel.is-clarifying .ai-panel__footer textarea,
.ai-panel.is-clarifying .ai-panel__footer button[type="submit"] {
  opacity: .45;
  pointer-events: none;
}

#v2-dock-panel.is-clarifying #v2-dock-input,
#v2-dock-panel.is-clarifying #v2-dock-send {
  opacity: .45;
  pointer-events: none;
}

/* ── Agent thinking — Scophix mark (replaces ···) ────────────────────────── */
/* Keyframes + drop-shadow cannot be expressed as Tailwind utilities.         */

.scophix-thinking {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
}

.scophix-thinking__mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
  object-fit: contain;
  animation: scophix-think 1.35s ease-in-out infinite;
}

.scophix-thinking--main .scophix-thinking__mark {
  width: 2.35rem;
  height: 2.35rem;
}

@keyframes scophix-think {
  0%, 100% {
    transform: scale(0.92) rotate(-10deg);
    filter: drop-shadow(0 0 2px rgba(99, 102, 241, 0.25));
    opacity: 0.82;
  }
  50% {
    transform: scale(1.12) rotate(10deg);
    filter: drop-shadow(0 0 12px rgba(126, 20, 255, 0.55));
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scophix-thinking__mark {
    animation: none;
  }
}

