/* styles.css */

/* Reset and base styles using modern CSS */
:root {
  --primary-color: #007bff;
  /* Blue for accents */
  --secondary-color: #6c757d;
  /* Gray for secondary text */
  --bg-color: #f8f9fa;
  /* Light background */
  --chat-bg: #ffffff;
  /* White chat window */
  --user-msg-bg: #dcf8c6;
  /* Light green for user messages */
  --bot-msg-bg: #e9ecef;
  /* Light gray for bot messages */
  --font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
    Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.chat-container {
  width: 100%;
  max-width: 600px;
  background-color: var(--chat-bg);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  max-height: 400px;
  /* Adjustable for demo */
}

.message {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 20px;
  max-width: 80%;
  word-wrap: break-word;
}

.message.user {
  background-color: var(--user-msg-bg);
  align-self: flex-end;
  margin-left: auto;
}

.message.bot {
  background-color: var(--bot-msg-bg);
  align-self: flex-start;
}

/* Markdown content styling */
.message-content {
  line-height: 1.6;
}

.message-content h1,
.message-content h2,
.message-content h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.message-content h1 {
  font-size: 1.3rem;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.3rem;
}

.message-content h2 {
  font-size: 1.15rem;
}

.message-content h3 {
  font-size: 1.05rem;
}

.message-content p {
  margin-bottom: 0.75rem;
}

.message-content ul,
.message-content ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.message-content li {
  margin-bottom: 0.25rem;
}

.message-content strong {
  font-weight: 600;
}

.message-content code {
  background-color: #f1f3f4;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

.message-content pre {
  background-color: #f1f3f4;
  padding: 0.75rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.message-content pre code {
  background: none;
  padding: 0;
}

/* Legal disclaimer styling */
.legal-disclaimer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed #ccc;
  font-size: 0.75rem;
  color: #888;
  font-style: italic;
  line-height: 1.4;
}

/* Citation/Sources styling */
.message .citation {
  font-size: 0.85rem;
  color: var(--secondary-color);
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #dee2e6;
}

.message .citation ul {
  list-style: none;
  margin: 0.5rem 0 0 0;
  padding: 0;
}

.message .citation li {
  margin-bottom: 0.25rem;
}

.message .citation a {
  color: var(--primary-color);
  text-decoration: none;
  text-transform: capitalize;
}

.message .citation a:hover {
  text-decoration: underline;
}

.chat-input {
  display: flex;
  padding: 1rem;
  border-top: 1px solid #dee2e6;
}

.chat-input input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px 0 0 4px;
  font-size: 1rem;
}

.chat-input button {
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

.chat-input button:hover {
  background-color: #0056b3;
}

.chat-input button:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

/* Scrollbar styling for modern browsers */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: #adb5bd;
  border-radius: 3px;
}

/* User Selector Styles */
.user-selector {
  width: 100%;
  max-width: 400px;
  background-color: var(--chat-bg);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  text-align: center;
}

.user-selector h2 {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.user-selector .select-section {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.user-selector .user-dropdown {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
  background-color: white;
}

.user-selector .continue-btn {
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

.user-selector .continue-btn:hover:not(:disabled) {
  background-color: #0056b3;
}

.user-selector .continue-btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

.user-selector .divider {
  color: var(--secondary-color);
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.user-selector .create-section {
  display: flex;
  gap: 0.5rem;
}

.user-selector .name-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
}

.user-selector .create-btn {
  padding: 0.75rem 1.5rem;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

.user-selector .create-btn:hover:not(:disabled) {
  background-color: #1e7e34;
}

.user-selector .create-btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

/* Chat Wrapper - Side by side layout */
.chat-wrapper {
  display: flex;
  gap: 1.5rem;
  width: 100%;
  max-width: 1000px;
  align-items: flex-start;
}

.chat-wrapper .chat-container {
  flex: 1;
  max-width: 600px;
}

/* Feedback Panel */
.feedback-panel {
  width: 280px;
  background-color: var(--chat-bg);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 1rem;
}

.feedback-header {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1rem;
  text-align: center;
}

.sentiment-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sentiment-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  background-color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sentiment-btn:hover {
  border-color: var(--primary-color);
  background-color: #f8f9fa;
}

.sentiment-btn.selected {
  border-color: var(--primary-color);
  background-color: #e7f1ff;
}

.sentiment-btn .emoji {
  font-size: 1.5rem;
}

.sentiment-btn .label {
  font-size: 0.75rem;
  color: var(--secondary-color);
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feedback-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  resize: vertical;
  min-height: 80px;
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.feedback-submit-btn {
  padding: 0.75rem 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.3s ease;
}

.feedback-submit-btn:hover:not(:disabled) {
  background-color: #0056b3;
}

.feedback-submit-btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

.feedback-success {
  text-align: center;
  padding: 1.5rem 1rem;
  color: #28a745;
  font-weight: 500;
}

.hidden {
  display: none !important;
}

/* Media queries for responsiveness */
@media (max-width: 900px) {
  .chat-wrapper {
    flex-direction: column;
    align-items: center;
  }

  .chat-wrapper .chat-container {
    max-width: 100%;
  }

  .feedback-panel {
    width: 100%;
    max-width: 600px;
  }
}

@media (max-width: 600px) {
  .chat-container {
    max-width: 100%;
  }

  .user-selector {
    max-width: 100%;
    padding: 1rem;
  }

  .user-selector .select-section,
  .user-selector .create-section {
    flex-direction: column;
  }
}