/* ============================================================
   ARIA COMMAND CENTER — AGENT WORKSPACE PANEL
   ============================================================ */

/* ---- OVERLAY BACKDROP ---- */
#agent-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 12, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  animation: fade-in 0.2s ease;
}
#agent-panel-backdrop.open { display: block; }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---- PANEL ---- */
#agent-panel {
  display: none;
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 48px;
  width: 520px;
  background: rgba(4, 8, 22, 0.97);
  border-left: 1px solid var(--border-solid);
  z-index: 201;
  flex-direction: column;
  animation: slide-in 0.25s ease;
}
#agent-panel.open { display: flex; }

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ---- PANEL HEADER ---- */
.ap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-glow);
  background: rgba(0, 245, 255, 0.04);
  flex-shrink: 0;
}

.ap-agent-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ap-agent-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid;
  flex-shrink: 0;
}

.ap-agent-name {
  font-family: var(--font-hud);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan-glow);
}

.ap-agent-role {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.ap-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hud);
  font-size: 8px;
  letter-spacing: 0.2em;
  padding: 4px 10px;
  border: 1px solid;
  border-radius: 2px;
  text-transform: uppercase;
}

.ap-status-badge.idle    { color: var(--text-dim); border-color: rgba(180,210,255,0.15); }
.ap-status-badge.running { color: var(--amber); border-color: var(--amber); animation: pulse-badge 1s ease infinite alternate; }
.ap-status-badge.done    { color: var(--green); border-color: var(--green); }
.ap-status-badge.error   { color: var(--red); border-color: var(--red); }

@keyframes pulse-badge {
  from { box-shadow: none; }
  to   { box-shadow: 0 0 8px var(--amber-glow); }
}

.ap-close-btn {
  background: none;
  border: 1px solid var(--border-glow);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.ap-close-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }

/* ---- CHAT AREA ---- */
.ap-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-dim) transparent;
}

.ap-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: msg-in 0.2s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ap-message.system .ap-bubble {
  background: var(--cyan-dim);
  border-left: 2px solid var(--cyan);
  color: var(--text-primary);
  font-style: italic;
}

.ap-message.user .ap-bubble {
  background: rgba(255, 183, 0, 0.08);
  border-left: 2px solid var(--amber);
  color: var(--text-primary);
  align-self: flex-end;
  max-width: 85%;
}

.ap-message.agent .ap-bubble {
  background: rgba(10, 22, 50, 0.8);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  border-radius: 0 4px 4px 4px;
}

.ap-message.error .ap-bubble {
  background: var(--red-dim);
  border-left: 2px solid var(--red);
  color: var(--red);
}

.ap-bubble {
  padding: 10px 14px;
  border-radius: 0 4px 4px 4px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.ap-meta {
  font-family: var(--font-hud);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 0 2px;
}

/* ---- TYPING INDICATOR ---- */
.ap-typing {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(10, 22, 50, 0.8);
  border: 1px solid var(--border-glow);
  border-radius: 0 4px 4px 4px;
  width: fit-content;
}
.ap-typing.active { display: flex; }

.ap-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  animation: typing-dot 1.2s ease infinite;
}
.ap-typing span:nth-child(2) { animation-delay: 0.2s; }
.ap-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.2; transform: scale(0.8); }
  30%            { opacity: 1;   transform: scale(1.1); }
}

/* ---- QUICK TASK CHIPS ---- */
.ap-quick-tasks {
  padding: 8px 20px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-glow);
  flex-shrink: 0;
}

.ap-quick-chip {
  padding: 4px 10px;
  background: var(--bg-panel-light);
  border: 1px solid var(--border-glow);
  border-radius: 2px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-data);
}
.ap-quick-chip:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
}

/* ---- INPUT AREA ---- */
.ap-input-wrap {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-glow);
  background: rgba(2, 4, 12, 0.95);
  flex-shrink: 0;
}

.ap-input {
  flex: 1;
  background: rgba(10, 20, 45, 0.8);
  border: 1px solid var(--border-glow);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: var(--font-data);
  font-size: 12px;
  padding: 10px 14px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.5;
}
.ap-input::placeholder { color: var(--text-dim); }
.ap-input:focus { border-color: var(--cyan); }

.ap-send-btn {
  padding: 10px 18px;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan);
  border-radius: 3px;
  color: var(--cyan);
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: flex-end;
}
.ap-send-btn:hover { background: rgba(0,245,255,0.25); box-shadow: 0 0 12px var(--cyan-glow); }
.ap-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.ap-send-btn.running {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-dim);
}

/* ---- BACKGROUND TASK INDICATOR ---- */
.ap-bg-badge {
  position: fixed;
  bottom: 60px;
  right: 16px;
  background: rgba(4, 8, 22, 0.95);
  border: 1px solid var(--amber);
  border-radius: 4px;
  padding: 8px 14px;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 199;
  font-size: 11px;
  color: var(--amber);
  cursor: pointer;
  animation: pulse-badge 1s ease infinite alternate;
}
.ap-bg-badge.active { display: flex; }
.ap-bg-badge .bg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }

/* ---- MOBILE ---- */
@media (max-width: 768px) {
  #agent-panel {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    top: 48px !important;
    bottom: 0 !important;
    border-left: none !important;
    border-top: 1px solid var(--border-solid);
  }

  .ap-quick-tasks {
    padding: 8px 12px;
  }

  .ap-input-wrap {
    padding: 10px 12px;
  }

  .ap-chat {
    padding: 12px;
  }
}
