/**
 * Styles for analyst-assist agent chat panel.
 */

.agent-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.agent-panel-header {
  padding: 16px;
  border-bottom: 1px solid #e0e0e0;
  background: #f9f9f9;
}

.agent-panel-header h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.agent-context {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.context-badge {
  display: inline-block;
  padding: 4px 8px;
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 4px;
  font-size: 12px;
  color: #1976d2;
  font-family: monospace;
}

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

.agent-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #666;
  padding: 24px;
}

.welcome-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.welcome-text {
  margin-bottom: 12px;
  font-size: 14px;
}

.agent-welcome ul {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  text-align: left;
}

.agent-welcome li {
  padding: 4px 0;
  font-size: 14px;
  color: #555;
}

.agent-welcome li:before {
  content: "✓ ";
  color: #4caf50;
  font-weight: bold;
  margin-right: 6px;
}

.welcome-note {
  font-size: 13px;
  color: #999;
  margin-top: 16px;
  font-style: italic;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 6px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  background: #e3f2fd;
  border-left: 4px solid #1976d2;
  margin-left: 24px;
}

.message.agent {
  background: #f5f5f5;
  border-left: 4px solid #757575;
  margin-right: 24px;
}

.message.loading {
  align-items: center;
  justify-content: center;
}

.message.error {
  background: #ffebee;
  border-left: 4px solid #d32f2f;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #999;
}

.message-role {
  font-weight: 600;
  color: #333;
}

.message-content {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}

.message-details {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 13px;
}

.detail-section {
  margin-bottom: 8px;
}

.detail-section h5 {
  margin: 0 0 6px 0;
  font-weight: 600;
  color: #333;
  font-size: 13px;
}

.detail-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.detail-section li {
  padding: 4px 0;
  margin-left: 8px;
  border-left: 2px solid #ccc;
  padding-left: 8px;
}

.pivot-button {
  background: none;
  border: none;
  color: #1976d2;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  text-decoration: underline;
  transition: color 0.2s;
}

.pivot-button:hover {
  color: #1565c0;
}

.detail-section code {
  background: #f0f0f0;
  border: 1px solid #ddd;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
  color: #555;
}

.detail-section.caveats {
  background: #fffde7;
  padding: 8px;
  border-radius: 4px;
  border-left: 3px solid #fbc02d;
}

.detail-section.caveats p {
  margin: 0;
  font-size: 13px;
  color: #666;
}

.confidence {
  display: inline-block;
  padding: 4px 8px;
  background: #f0f0f0;
  border-radius: 3px;
  font-size: 12px;
  color: #666;
}

.error-text {
  color: #d32f2f;
  margin: 0;
  font-size: 14px;
}

/* Loading animation */
.loading-indicator {
  display: flex;
  gap: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: bounce 1.4s infinite;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

/* Input form */
.agent-input-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e0e0e0;
  background: #fafafa;
}

.agent-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: border-color 0.2s;
}

.agent-input:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.agent-input:disabled {
  background: #f0f0f0;
  color: #999;
}

.agent-input-form button {
  padding: 10px 20px;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.agent-input-form button:hover:not(:disabled) {
  background: #1565c0;
}

.agent-input-form button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Footer */
.agent-footer {
  padding: 8px 12px;
  border-top: 1px solid #e0e0e0;
  background: #f9f9f9;
  text-align: center;
}

.footer-note {
  margin: 0;
  font-size: 12px;
  color: #999;
}

/* Responsive */
@media (max-width: 768px) {
  .message {
    margin-left: 12px;
    margin-right: 12px;
  }

  .message.user {
    margin-left: 12px;
  }

  .message.agent {
    margin-right: 12px;
  }

  .agent-panel-header {
    padding: 12px;
  }

  .agent-messages {
    padding: 12px;
  }

  .agent-input-form {
    padding: 10px;
    gap: 6px;
  }
}
