:root {
  --primary-color: #01a982; /* HPE Green */
  --primary-light: rgba(1, 169, 130, 0.1);
  --secondary-color: #425563; /* HPE Dark Gray */
  --background-color: #f7f7f8;
  --sidebar-color: #f0f0f1;
  --chat-bg: #ffffff;
  --text-color: #2d2d2d;
  --light-text: #6e6e80;
  --border-color: #e5e5e5;
  --user-message-bg: #01a982;
  --user-message-color: #ffffff;
  --assistant-message-bg: #f0f0f1;
  --assistant-message-color: #2d2d2d;
  --shadow-color: rgba(0, 0, 0, 0.05);
  --font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    "Helvetica Neue", sans-serif;
  --border-radius: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
}

/* Main container */
.chat-container {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* Sidebar styles */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-color);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 10;
}

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

#new-chat-btn {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s ease;
}

#new-chat-btn:hover {
  background-color: #018e6c;
}

.conversation-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 6px;
}

.conversation-item {
  padding: 10px 12px;
  border-radius: var(--border-radius);
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.conversation-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.conversation-item.active {
  background-color: var(--primary-light);
  font-weight: 500;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

#lead-info-btn {
  width: 100%;
  padding: 8px 12px;
  background-color: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

#lead-info-btn:hover {
  background-color: var(--primary-light);
}

/* Chat area styles */
.chat-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--chat-bg);
  position: relative;
}

.chat-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background-color: white;
  z-index: 5;
}

.chat-header h1 {
  font-size: 16px;
  color: var(--primary-color);
  font-weight: 600;
}

.chat-controls button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--secondary-color);
  display: none;
}

/* Messages container */
.messages-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--background-color);
  max-height: 25vh; /* Smaller to give agent more room */
  border-radius: var(--border-radius);
  margin: 0 16px;
}

/* Simplified welcome message */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px var(--shadow-color);
  margin-bottom: 8px;
}

.welcome-message h2 {
  margin-bottom: 8px;
  color: var(--primary-color);
  font-size: 18px;
}

.welcome-message p {
  margin-bottom: 16px;
  color: var(--light-text);
  font-size: 14px;
}

/* Enhanced suggestion chips */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.suggestion-chip {
  background-color: var(--primary-light);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--primary-color);
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.suggestion-chip:hover {
  background-color: rgba(1, 169, 130, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Simplified message display for agent focus */
.message {
  display: flex;
  padding: 10px 14px;
  border-radius: var(--border-radius);
  max-width: 80%;
  font-size: 14px;
  box-shadow: 0 1px 2px var(--shadow-color);
  animation: fadeIn 0.3s ease;
  margin-bottom: 8px;
}

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

.user-message {
  background-color: var(--user-message-bg);
  color: var(--user-message-color);
  margin-left: auto;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.assistant-message {
  background-color: var(--assistant-message-bg);
  color: var(--assistant-message-color);
  margin-right: auto;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.message-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.message-content p {
  margin-bottom: 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul {
  margin-left: 16px;
  margin-bottom: 8px;
}

.message-content li {
  margin-bottom: 4px;
}

.citation {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 6px;
  font-style: italic;
}

/* Input area */
.input-area {
  padding: 16px;
  background-color: white;
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.input-container {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  overflow: hidden;
  background-color: white;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 4px;
}

.input-container:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-light);
  transform: translateY(-1px);
}

#message-input {
  flex-grow: 1;
  padding: 12px 16px;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-family);
  font-size: 14px;
  max-height: 150px;
  min-height: 24px;
  border-radius: 24px;
}

#send-button {
  width: 40px;
  height: 40px;
  background-color: var(--primary-color);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-right: 4px;
}

#send-button:hover {
  background-color: #018e6c;
  transform: scale(1.05);
}

#send-button:disabled {
  color: var(--border-color);
  cursor: not-allowed;
  transform: none;
}

.input-footer {
  margin-top: 6px;
  font-size: 11px;
  color: var(--light-text);
  text-align: center;
}

/* Loading indicator */
.loading-indicator {
  display: flex;
  align-items: center;
  padding: 8px 0;
  align-self: flex-start;
}

.typing-indicator {
  display: flex;
  gap: 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background-color: var(--primary-color);
  border-radius: 50%;
  opacity: 0.6;
  animation: typingAnimation 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}
.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: white;
  border-radius: var(--border-radius);
  max-width: 450px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px var(--shadow-color);
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

#close-modal-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--light-text);
  transition: color 0.2s;
}

#close-modal-btn:hover {
  color: var(--text-color);
}

.modal-body {
  padding: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-light);
  outline: none;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.checkbox-group input {
  width: auto;
  margin-top: 3px;
}

.checkbox-group label {
  font-size: 13px;
  font-weight: normal;
}

.form-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.primary-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition:
    background-color 0.2s,
    transform 0.1s;
}

.primary-button:hover {
  background-color: #018e6c;
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
}

/* D-ID Agent Styles */
.did-agent-container {
  width: 100%;
  min-height: 500px;
  background-color: var(--assistant-message-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* Enhanced welcome message styling */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px var(--shadow-color);
  margin-bottom: 8px;
}

.welcome-logo {
  max-width: 120px;
  margin-bottom: 16px;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Improved responsive styles */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    height: 100%;
    transform: translateX(-100%);
    z-index: 100;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .chat-controls button {
    display: block;
  }

  .message {
    max-width: 90%;
  }

  .messages-container {
    max-height: 30vh;
    margin: 8px;
  }

  .input-area {
    padding: 12px;
  }

  .suggestion-chip {
    padding: 6px 12px;
    font-size: 12px;
  }

  .welcome-logo {
    max-width: 100px;
  }
}

@media (max-width: 480px) {
  .chat-header h1 {
    font-size: 15px;
  }

  .messages-container {
    padding: 12px;
  }

  .message {
    padding: 8px 12px;
    max-width: 95%;
    font-size: 13px;
  }

  .welcome-message {
    padding: 12px;
  }

  .welcome-logo {
    max-width: 100px;
  }

  .welcome-message h2 {
    font-size: 16px;
  }

  .welcome-message p {
    font-size: 13px;
  }

  .suggestion-chip {
    font-size: 12px;
    padding: 5px 10px;
  }

  .input-area {
    padding: 8px 12px;
  }

  .did-agent-container {
    min-height: 200px;
  }

  .messages-container {
    max-height: calc(100vh - 350px);
  }
}
