/* chat.css — Empire Brain chat panel, routing, and setup styles */

/* ─── Setup Overlay ─────────────────────────────────────────── */
#setup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 20, 0.96);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.setup-modal {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.setup-header { display: flex; flex-direction: column; gap: 8px; }

.setup-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #9b72ff;
}

.setup-title {
  font-size: 22px;
  font-weight: 800;
  color: #e8e6f0;
}

.setup-subtitle {
  font-size: 13px;
  color: #8b89a0;
  line-height: 1.6;
}

.setup-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #e8e6f0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.setup-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  color: #e8e6f0;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 4px;
}

.setup-input:focus { border-color: rgba(120,80,255,0.5); }
.setup-input::placeholder { color: #55536a; }

.setup-hint {
  font-size: 11px;
  color: #55536a;
  line-height: 1.5;
}

.setup-actions { display: flex; flex-direction: column; gap: 8px; }

.setup-error {
  font-size: 12px;
  color: #f472b6;
  background: rgba(244,114,182,0.1);
  border: 1px solid rgba(244,114,182,0.2);
  border-radius: 8px;
  padding: 8px 12px;
}

.setup-btn {
  background: #7850ff;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 24px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.setup-btn:hover { background: #9b72ff; transform: translateY(-1px); }

/* ─── Chat Overlay ───────────────────────────────────────────── */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,11,20,0.6);
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.chat-overlay--visible {
  opacity: 1;
  pointer-events: all;
}

/* ─── Chat Panel ─────────────────────────────────────────────── */
.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: #0d1121;
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-panel--open { transform: translateX(0); }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.chat-agent-info { display: flex; flex-direction: column; gap: 2px; }

.chat-agent-number {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #55536a;
  text-transform: uppercase;
}

.chat-agent-name {
  font-size: 15px;
  font-weight: 700;
  color: #e8e6f0;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-history-btn,
.chat-route-btn,
.chat-save-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px 12px;
  color: #8b89a0;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-history-btn:hover,
.chat-route-btn:hover { background: rgba(120,80,255,0.15); color: #9b72ff; border-color: rgba(120,80,255,0.3); }
.chat-save-btn:hover { background: rgba(45,212,191,0.1); color: #2dd4bf; border-color: rgba(45,212,191,0.2); }

.chat-close-btn {
  background: none;
  border: none;
  color: #55536a;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.chat-close-btn:hover { color: #e8e6f0; background: rgba(255,255,255,0.06); }

/* ─── Messages ───────────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120,80,255,0.3) transparent;
}

.chat-welcome {
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-welcome-name {
  font-size: 16px;
  font-weight: 700;
  color: #e8e6f0;
}
.chat-welcome-hint {
  font-size: 12px;
  color: #55536a;
}

.chat-msg { display: flex; flex-direction: column; gap: 4px; }
.chat-msg--user { align-items: flex-end; }
.chat-msg--assistant { align-items: flex-start; }
.chat-msg--system { align-items: center; }

.chat-msg-bubble {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
}

.chat-msg--user .chat-msg-bubble {
  background: #7850ff;
  color: #fff;
  border-radius: 12px 12px 4px 12px;
}

.chat-msg--assistant .chat-msg-bubble {
  background: rgba(255,255,255,0.06);
  color: #e8e6f0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px 12px 12px 4px;
}

.chat-msg--system .chat-msg-bubble {
  background: rgba(201,168,76,0.08);
  color: #c9a84c;
  border: 1px solid rgba(201,168,76,0.15);
  font-size: 12px;
  text-align: center;
  border-radius: 8px;
  white-space: pre-wrap;
}

.chat-msg-bubble code {
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.chat-msg-copy {
  background: none;
  border: none;
  color: #55536a;
  font-size: 11px;
  cursor: pointer;
  padding: 0 2px;
  font-family: 'Outfit', sans-serif;
  transition: color 0.2s;
  text-align: left;
}
.chat-msg-copy:hover { color: #8b89a0; }

/* Typing indicator */
.chat-msg--typing .chat-msg-bubble {
  padding: 12px 16px;
}
.typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #55536a;
  margin: 0 2px;
  animation: typingPulse 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingPulse { 0%,80%,100%{opacity:0.3;transform:scale(0.8)} 40%{opacity:1;transform:scale(1)} }

/* Session banner */
.chat-session-banner {
  font-size: 11px;
  color: #55536a;
  text-align: center;
  padding: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 8px;
}
.chat-session-banner button {
  background: none;
  border: none;
  color: #7850ff;
  font-size: 11px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  margin-left: 8px;
}

/* Routing hint */
.chat-routing-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(201,168,76,0.06);
  border: 1px solid rgba(201,168,76,0.12);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #8b89a0;
  gap: 12px;
}
.chat-routing-hint button {
  background: rgba(201,168,76,0.15);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 6px;
  padding: 4px 10px;
  color: #c9a84c;
  font-size: 12px;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.chat-routing-hint button:hover { background: rgba(201,168,76,0.25); }

/* ─── Input Area ─────────────────────────────────────────────── */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 10px 14px;
  color: #e8e6f0;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  resize: none;
  outline: none;
  line-height: 1.5;
  min-height: 40px;
  max-height: 160px;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: rgba(120,80,255,0.4); }
.chat-input::placeholder { color: #55536a; }

.chat-send-btn {
  background: #7850ff;
  border: none;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.chat-send-btn:hover { background: #9b72ff; transform: translateY(-1px); }

/* ─── Footer ─────────────────────────────────────────────────── */
.chat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.chat-model-label { font-size: 10px; color: #55536a; }
.chat-clear-btn {
  background: none;
  border: none;
  color: #55536a;
  font-size: 11px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: color 0.2s;
}
.chat-clear-btn:hover { color: #f472b6; }

/* ─── Routing Panel ──────────────────────────────────────────── */
.routing-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0d1121;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px 16px 0 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 10;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.routing-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}
.routing-title { font-size: 14px; font-weight: 700; color: #e8e6f0; }
.routing-subtitle { font-size: 12px; color: #55536a; }
.routing-close {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: #55536a;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.routing-close:hover { color: #e8e6f0; }

.routing-preview {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 10px 12px;
}
.routing-preview-label { font-size: 10px; color: #55536a; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.routing-preview-content { font-size: 12px; color: #8b89a0; line-height: 1.5; }

.routing-destinations { display: flex; flex-direction: column; gap: 6px; }

.routing-dest {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  font-family: 'Outfit', sans-serif;
}
.routing-dest:hover { background: rgba(120,80,255,0.1); border-color: rgba(120,80,255,0.25); }

.routing-dest-icon { font-size: 18px; flex-shrink: 0; }
.routing-dest-info { flex: 1; }
.routing-dest-label { font-size: 13px; font-weight: 600; color: #e8e6f0; }
.routing-dest-desc { font-size: 11px; color: #55536a; margin-top: 2px; }
.routing-dest-arrow { color: #55536a; font-size: 14px; flex-shrink: 0; }

.routing-dest--loading { opacity: 0.6; cursor: not-allowed; }
.routing-dest--success { background: rgba(45,212,191,0.1); border-color: rgba(45,212,191,0.25); }
.routing-dest--success .routing-dest-label { color: #2dd4bf; }
.routing-dest--error { background: rgba(244,114,182,0.1); border-color: rgba(244,114,182,0.2); }
.routing-dest--error .routing-dest-label { color: #f472b6; }

.routing-footer { padding-top: 4px; }
.routing-save-session {
  width: 100%;
  background: none;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px;
  color: #55536a;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.routing-save-session:hover { border-color: rgba(120,80,255,0.3); color: #9b72ff; }

/* ─── Settings button (added to dashboard header) ────────────── */
.settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 5px 12px;
  color: #55536a;
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.settings-btn:hover { color: #8b89a0; border-color: rgba(255,255,255,0.12); }

/* ─── Agent card activation indicator ───────────────────────── */
.agent-card.agent-card--active {
  border-color: rgba(120,80,255,0.5);
  box-shadow: 0 0 20px rgba(120,80,255,0.15);
}

.activate-btn {
  width: 100%;
  background: rgba(120,80,255,0.12);
  border: 1px solid rgba(120,80,255,0.25);
  border-radius: 8px;
  padding: 9px 14px;
  color: #9b72ff;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
  text-align: center;
}
.activate-btn:hover {
  background: rgba(120,80,255,0.22);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(120,80,255,0.2);
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 540px) {
  .chat-panel { width: 100vw; }
  .setup-modal { padding: 24px 20px; }
}
