/* CEO Bar — persistent chat input on every page.
 * Replaces the old agent status bar.
 * Fixed bottom, full width. Popover chat expands above.
 */

/* ── Bar container ─── */
.ceo-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--surface-2);
  border-top: 0.5px solid var(--border);
  font-family: var(--font-body);
}

/* Offset for sidebar on desktop */
@media (min-width: 768px) {
  .ceo-bar {
    left: 260px;
  }
}

/* Hidden on /chat page */
.ceo-bar.ceo-bar--hidden {
  display: none;
}

/* Push main content above fixed bar */
body.ceo-bar-visible {
  padding-bottom: 52px;
}

/* ── Input strip ─── */
.bar-input-strip {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 10px;
}

.bar-mark {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--terracotta);
  opacity: 0.7;
  flex-shrink: 0;
  letter-spacing: -0.5px;
  cursor: default;
}

.bar-input-wrapper {
  flex: 1;
  position: relative;
}

.bar-input {
  width: 100%;
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 44px 10px 14px;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--cream);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.bar-input::placeholder {
  color: var(--ink-muted);
  font-style: italic;
}

.bar-input:focus {
  border-color: rgba(192, 120, 90, 0.3);
  box-shadow: 0 0 0 3px rgba(192, 120, 90, 0.06);
}

.bar-send {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  color: var(--ink-muted);
}

.bar-send:hover {
  background: var(--terracotta-muted);
  color: var(--terracotta);
}

.bar-send svg {
  width: 16px;
  height: 16px;
}

/* Context chip */
.bar-context {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-muted);
  background: rgba(232,228,220,0.03);
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  border: 0.5px solid var(--border);
}

/* Agent pulse */
.bar-agent-pulse {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.bar-agent-pulse:hover {
  background: rgba(232,228,220,0.03);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-breathe 2s ease-in-out infinite;
}

@keyframes pulse-breathe {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

.bar-agent-pulse.idle .pulse-dot {
  background: var(--ink-muted);
  animation: none;
  opacity: 0.3;
}

.bar-cost {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

/* ── Chat popover ─── */
.chat-popover {
  position: absolute;
  bottom: 100%;
  left: 16px;
  right: 16px;
  max-height: 0;
  overflow: hidden;
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s;
  opacity: 0;
  display: flex;
  flex-direction: column;
}

.chat-popover.open {
  max-height: 380px;
  opacity: 1;
}

.popover-header {
  display: flex;
  align-items: center;
  padding: 12px 16px 10px;
  border-bottom: 0.5px solid var(--border);
  gap: 8px;
}

.popover-title {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--cream);
  flex: 1;
  font-weight: 400;
}

.popover-continue {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--terracotta);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
  letter-spacing: 0.3px;
}

.popover-continue:hover { opacity: 1; }

.popover-close {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-family: var(--font-body);
  transition: background 0.15s;
}

.popover-close:hover {
  background: rgba(232,228,220,0.05);
  color: var(--ink-ghost);
}

.popover-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Popover messages ─── */
.ceo-bar-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ceo-bar-msg--user { align-items: flex-end; }

.ceo-bar-msg-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 4px;
}

.ceo-bar-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 85%;
}

.ceo-bar-msg--user .ceo-bar-msg-bubble {
  background: var(--terracotta-muted);
  color: var(--cream);
  border-bottom-right-radius: 4px;
}

.ceo-bar-msg--sovereign .ceo-bar-msg-bubble {
  background: var(--surface-3);
  color: var(--cream);
  border-bottom-left-radius: 4px;
  border: 0.5px solid var(--border);
}

/* ── Responsive ─── */
@media (max-width: 600px) {
  .bar-context { display: none; }
  .bar-cost { display: none; }
  .chat-popover.open { max-height: 320px; }
}
