/* ========================================
   ClawView — Views CSS
   Activity Feed | Agent Live | Conversations | Decisions | Intake
   ======================================== */

/* --- 1. View Switcher --- */
.viewSwitcher {
  display: flex; gap: 4px; padding: 4px;
  background: rgba(255,255,255,.04); border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  overflow-x: auto; scrollbar-width: none;
}
.viewSwitcher::-webkit-scrollbar { display: none; }
.viewTab {
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  font-size: .85rem; color: var(--muted); white-space: nowrap;
  transition: all 200ms; border: 1px solid transparent; background: none;
}
.viewTab:hover { color: var(--text); background: rgba(255,255,255,.04); }
.viewTab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.viewTab.active {
  color: var(--accent); background: rgba(122,162,255,.1);
  border-color: rgba(122,162,255,.25); font-weight: 600;
}
.viewContent { animation: fadeIn 200ms ease; }

/* --- 2. Activity Feed --- */
.feedFilters {
  display: flex; gap: 6px; padding: 8px 0; flex-wrap: wrap;
}
.feedFilterChip {
  padding: 4px 12px; border-radius: 20px; font-size: .75rem;
  background: rgba(255,255,255,.06); color: var(--muted);
  border: 1px solid rgba(255,255,255,.08); cursor: pointer;
  transition: all 200ms;
}
.feedFilterChip:hover, .feedFilterChip.active {
  color: var(--accent); border-color: var(--accent); background: rgba(122,162,255,.1);
}
.feedFilterChip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.feedContainer { display: flex; flex-direction: column; gap: 8px; }
.feedEvent {
  padding: 12px 14px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  display: flex; gap: 10px; align-items: flex-start;
  transition: border-color 200ms, background 200ms;
  animation: slideDown 250ms ease;
}
.feedEvent:hover { background: rgba(255,255,255,.06); }
.feedEvent[data-type="error"] { border-color: var(--bad); }
.feedEvent[data-type="po_approval_needed"] { border-color: var(--warn); }
.feedEvent[data-type="po_approval_needed"]::after {
  content: '!'; position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%; font-size: .7rem;
  background: var(--warn); color: #1a1a2e; display: grid; place-items: center;
  font-weight: 700; animation: softPulse 2s infinite;
}
.feedEvent[data-type="po_approval_needed"] { position: relative; }
.feedIcon {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-size: .9rem;
  background: rgba(255,255,255,.06);
}
.feedAgent { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--accent); }
.feedTime { font-size: .7rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.feedDetails {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.06);
  font-size: .8rem; color: var(--muted); overflow: hidden;
  max-height: 0; transition: max-height 300ms ease;
}
.feedEvent.expanded .feedDetails { max-height: 300px; }

/* --- 3. Agent Live Grid --- */
.agentGrid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.agentLiveCard {
  padding: 16px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(12px); transition: all 250ms; position: relative;
}
.agentLiveCard:hover { background: rgba(255,255,255,.06); }
.agentLiveCard.working { border-color: var(--accent); animation: softPulse 3s infinite; }
.agentLiveCard.blocked { border-color: var(--bad); }
.agentLiveCard.waiting { border-color: var(--warn); }
.agentLiveCard.idle { opacity: .55; }
.agentLiveCard.offline { opacity: .4; filter: grayscale(.7); }
.agentLiveCard.error { border-color: var(--bad); border-width: 2px; }
.statusIndicator {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.statusIndicator.green { background: var(--ok); }
.statusIndicator.yellow { background: var(--warn); }
.statusIndicator.red { background: var(--bad); }
.statusIndicator.gray { background: var(--muted); opacity: .5; }
.healthBar {
  height: 4px; border-radius: 2px; background: rgba(255,255,255,.08);
  overflow: hidden; margin: 6px 0;
}
.healthBar .fill {
  height: 100%; border-radius: 2px; transition: width 300ms, background 300ms;
}
.healthBar .fill.ok { background: var(--ok); }
.healthBar .fill.warn { background: var(--warn); }
.healthBar .fill.bad { background: var(--bad); }
.liveOutput {
  background: rgba(0,0,0,.35); border-radius: 8px; padding: 8px 10px;
  font-family: 'JetBrains Mono', monospace; font-size: .72rem;
  color: var(--muted); max-height: 120px; overflow-y: auto;
  scrollbar-width: thin; line-height: 1.5;
}
.liveOutputLine { white-space: pre-wrap; word-break: break-all; }
.costBadge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: .7rem; background: rgba(255,255,255,.06); color: var(--muted);
}
.alertBubble {
  position: absolute; top: -10px; right: 12px;
  background: var(--warn); color: #1a1a2e; padding: 4px 10px;
  border-radius: 10px 10px 10px 2px; font-size: .72rem; font-weight: 600;
  animation: bounce 1.5s infinite; white-space: nowrap;
}

/* --- 4. Conversations --- */
.convList { display: flex; flex-direction: column; gap: 4px; }
.convItem {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: background 200ms; color: var(--muted); font-size: .85rem;
}
.convItem:hover { background: rgba(255,255,255,.04); }
.convItem:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.convItem.active { background: rgba(122,162,255,.08); color: var(--text); }
.convThread {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; overflow-y: auto; flex: 1;
}
.convMessage { display: flex; gap: 8px; align-items: flex-start; }
.convAvatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,.08); display: grid; place-items: center; font-size: .75rem;
}
.convBubble {
  padding: 8px 12px; border-radius: 10px; max-width: 75%;
  background: rgba(255,255,255,.04); font-size: .85rem; color: var(--text);
  line-height: 1.5;
}
.convMessage.question .convBubble { background: rgba(122,162,255,.1); }
.convMessage.decision .convBubble {
  background: rgba(255,209,102,.08); border: 1px solid rgba(255,209,102,.25);
}
.convMessage.decision .convBubble::before { content: '🧠 '; }
.convTimestamp { font-size: .65rem; color: var(--muted); margin-top: 4px; }
.convInput {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(255,255,255,.06);
}
.convInput input {
  flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04); color: var(--text); font-size: .85rem;
  transition: border-color 200ms;
}
.convInput input:focus { outline: none; border-color: var(--accent); }

/* --- 5. Decisions --- */
.decisionList { display: flex; flex-direction: column; gap: 10px; }
.decisionCard {
  padding: 16px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  transition: border-color 200ms;
}
.decisionCard[data-impact="high"] { border-color: var(--warn); }
.decisionCard[data-impact="critical"] { border-color: var(--bad); }
.decisionTitle { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.decisionOptions {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px;
  margin: 10px 0;
}
.decisionOption {
  padding: 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03); font-size: .82rem; color: var(--muted);
  transition: all 200ms;
}
.decisionOption.chosen {
  border-color: var(--ok); background: rgba(61,220,151,.08); color: var(--text);
}
.decisionOption.chosen::before { content: '✓ '; color: var(--ok); font-weight: 700; }
.decisionRationale {
  margin-top: 10px; padding: 10px; border-radius: 8px;
  background: rgba(255,255,255,.03); font-size: .82rem;
  color: var(--muted); border-left: 3px solid var(--accent); line-height: 1.5;
}
.decisionActions { display: flex; gap: 8px; margin-top: 12px; }
.decisionActions button {
  padding: 6px 16px; border-radius: 8px; font-size: .82rem;
  cursor: pointer; border: 1px solid; transition: all 200ms;
  background: transparent;
}
.decisionActions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.decisionActions .agree { color: var(--ok); border-color: var(--ok); }
.decisionActions .agree:hover { background: rgba(61,220,151,.15); }
.decisionActions .disagree { color: var(--bad); border-color: var(--bad); }
.decisionActions .disagree:hover { background: rgba(255,92,122,.15); }

/* --- 6. Demand / Intake Pipeline --- */
.demandList { display: flex; flex-direction: column; gap: 10px; }
.demandCard {
  padding: 14px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  transition: all 200ms;
}
.demandStatus {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.demandStatus[data-status="submitted"] { background: rgba(147,164,199,.2); color: var(--muted); }
.demandStatus[data-status="clarifying"] { background: rgba(122,162,255,.15); color: var(--accent); }
.demandStatus[data-status="generating"] { background: rgba(255,209,102,.15); color: var(--warn); animation: softPulse 2s infinite; }
.demandStatus[data-status="review"] { background: rgba(255,165,0,.15); color: #ffa500; }
.demandStatus[data-status="approved"] { background: rgba(61,220,151,.15); color: var(--ok); }
.demandStatus[data-status="discarded"] { background: rgba(147,164,199,.1); color: var(--muted); opacity: .5; }
.demandForm {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border-radius: 10px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}
.storyPreview {
  padding: 12px; border-radius: 10px; background: rgba(255,255,255,.03);
  border: 1px dashed rgba(255,255,255,.1); font-size: .85rem; color: var(--text);
}
.storyPreview .field {
  padding: 4px 6px; border-radius: 4px; border: 1px solid transparent;
  transition: border-color 200ms; cursor: text;
}
.storyPreview .field:hover { border-color: rgba(255,255,255,.12); }
.storyPreview .field:focus { outline: none; border-color: var(--accent); background: rgba(255,255,255,.03); }

/* --- 7. Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes softPulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes typingDots {
  0%, 80%, 100% { opacity: .3; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1); }
}
.typingDots span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: typingDots 1.4s infinite; }
.typingDots span:nth-child(2) { animation-delay: .2s; }
.typingDots span:nth-child(3) { animation-delay: .4s; }

/* --- 8. Responsive --- */
@media (max-width: 1024px) {
  .agentGrid { grid-template-columns: repeat(2, 1fr); }
  .decisionOptions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  .agentGrid { grid-template-columns: 1fr; }
  .decisionOptions { grid-template-columns: 1fr; }
  .viewSwitcher { gap: 2px; }
  .viewTab { padding: 6px 12px; font-size: .8rem; }
  .convBubble { max-width: 90%; }
}
