/* Modern UI for Agent Browser */

:root {
  --primary-color: #4a6cf7;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --bg-color: #f5f7ff;
  --sidebar-width: 380px;
  --sidebar-bg: #ffffff;
  --header-height: 60px;
  --border-radius: 8px;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--dark-color);
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Navigation Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  padding: 0 20px;
  background-color: #fff;
  box-shadow: var(--box-shadow);
  z-index: 10;
}

.url-bar {
  flex: 1;
  display: flex;
  max-width: calc(100% - 150px);
}

.url-bar input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.url-bar input:focus {
  border-color: var(--primary-color);
}

.url-bar button {
  padding: 8px 16px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  cursor: pointer;
  transition: background-color 0.2s;
}

.url-bar button:hover {
  background-color: #395dd4;
}

.nav-controls button {
  padding: 8px 16px;
  background-color: var(--light-color);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  color: var(--dark-color);
  cursor: pointer;
  transition: var(--transition);
}

.nav-controls button:hover {
  background-color: #e9ecef;
}

/* Main Content Area */
.content-area {
  display: flex;
  height: calc(100vh - var(--header-height));
  position: relative;
}

/* Browser iframe */
.browser-iframe {
  flex: 1;
  border: none;
  height: 100%;
  background-color: #fff;
}

/* Agent Sidebar */
.agent-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--sidebar-bg);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
}

.agent-sidebar.closed {
  transform: translateX(100%);
}

.agent-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 18px;
  color: var(--primary-color);
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--secondary-color);
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--danger-color);
}

/* Agent Chat */
.agent-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.welcome-message {
  background-color: rgba(74, 108, 247, 0.05);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
}

.welcome-message h3 {
  color: var(--primary-color);
  margin-bottom: 12px;
}

.welcome-message ul {
  margin-left: 20px;
  margin-top: 10px;
}

.welcome-message li {
  margin-bottom: 8px;
  color: #555;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  max-width: 100%;
}

.user-message, .assistant-message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.user-icon, .assistant-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 20px;
}

.user-icon {
  background-color: #e6f0ff;
}

.assistant-icon {
  background-color: #e9f5f9;
}

.message-content {
  flex: 1;
  padding: 12px;
  border-radius: var(--border-radius);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.user .message-content {
  background-color: #f5f7ff;
  border: 1px solid #e6e9fd;
}

.assistant .message-content {
  background-color: #ffffff;
  border: 1px solid #eaeaea;
}

/* Styling for Agent Response Parts */
.thought {
  color: #6d4c9f;
  margin-bottom: 10px;
}

.action {
  color: #2c7be5;
  margin-bottom: 10px;
}

.observation {
  color: #666;
  background-color: #f8f9fa;
  padding: 8px;
  border-left: 3px solid #ddd;
  margin-bottom: 10px;
  font-family: monospace;
  white-space: pre-wrap;
  font-size: 13px;
}

.final-answer {
  color: #28a745;
  margin-top: 10px;
  font-weight: 500;
}

/* Loading Indicator */
.loading-indicator {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

.loading-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary-color);
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%, 80%, 100% { 
    transform: scale(0);
  } 40% { 
    transform: scale(1.0);
  }
}

/* Agent Input */
.agent-input {
  display: flex;
  padding: 16px;
  border-top: 1px solid #eee;
  background-color: white;
}

.agent-input input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s;
}

.agent-input input:focus {
  border-color: var(--primary-color);
}

.agent-input button {
  padding: 12px 20px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  cursor: pointer;
  transition: background-color 0.2s;
}

.agent-input button:hover:not(:disabled) {
  background-color: #395dd4;
}

.agent-input button:disabled {
  background-color: #a0aec0;
  cursor: not-allowed;
}
