/* chat.css */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: #f5f5f5;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.chat-container {
  max-width: 600px;
  width: 100%;
  height: 80vh;
  background-color: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background-color: #4a90e2;
  color: white;
  padding: 20px;
  text-align: center;
  border-radius: 16px 16px 0 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.bot-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background-color: white;
  padding: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #fafafa;
}

.chat-box::-webkit-scrollbar {
  width: 6px;
}

.chat-box::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* New message styles to match the JavaScript */
.message {
  display: flex;
  margin-bottom: 1rem;
  align-items: flex-start;
  gap: 8px;
}

.message.user {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.message.assistant {
  justify-content: flex-start;
}

.message-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.message-avatar img.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: white;
  padding: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: #4a90e2;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.message-content {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
  line-height: 1.4;
  font-size: 14px;
}

.message.user .message-content {
  background: #4a90e2;
  color: white;
  border-bottom-right-radius: 6px;
}

.message.assistant .message-content {
  background: #e5e5ea;
  color: #333;
  border-bottom-left-radius: 6px;
}

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 8px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
  0%, 80%, 100% { 
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% { 
    transform: scale(1);
    opacity: 1;
  }
}

/* Message sources */
.message-sources {
  margin: 0.5rem 0 1rem 2.5rem;
  padding: 0.5rem;
  background: #e9ecef;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.sources-title {
  font-weight: bold;
  margin-bottom: 0.25rem;
  color: #666;
}

.source-link, .source-item {
  display: block;
  margin: 0.25rem 0;
  color: #4a90e2;
  text-decoration: none;
  font-size: 0.8rem;
}

.source-link:hover {
  text-decoration: underline;
}

/* Suggestions container */
.suggestions {
  display: flex;
  gap: 8px;
  padding: 12px 20px 0;
  background-color: white;
  flex-wrap: wrap;
  justify-content: center;
}

.suggestions button {
  padding: 8px 16px;
  background-color: #f0f0f0;
  border: 1px solid #d0d0d0;
  border-radius: 20px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestions button:hover {
  background-color: #4a90e2;
  color: white;
  border-color: #4a90e2;
  transform: translateY(-1px);
}

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

.chat-input-container {
  display: flex;
  padding: 20px;
  background-color: white;
  border-top: 1px solid #e0e0e0;
  gap: 12px;
  align-items: center;
}

#chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  background-color: #f8f8f8;
}

#chat-input:focus {
  border-color: #4a90e2;
  background-color: white;
}

#chat-input:disabled {
  background-color: #f0f0f0;
  color: #999;
  cursor: not-allowed;
}

#send-btn {
  padding: 12px 24px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  min-width: 80px;
}

#send-btn:hover:not(:disabled) {
  background-color: #357abd;
  transform: translateY(-1px);
}

#send-btn:active {
  transform: translateY(0);
}

#send-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  body {
    padding: 10px;
  }
  
  .chat-container {
    height: 90vh;
    border-radius: 12px;
  }
  
  .chat-header {
    padding: 15px;
    border-radius: 12px 12px 0 0;
  }
  
  .bot-logo {
    width: 28px;
    height: 28px;
  }
  
  .header-content {
    gap: 10px;
  }
  
  .chat-header h1 {
    font-size: 1.3rem;
  }
  
  .chat-box {
    padding: 15px;
  }
  
  .message-content {
    max-width: 85%;
    font-size: 13px;
  }
  
  .chat-input-container {
    padding: 15px;
  }
  
  #send-btn {
    padding: 10px 20px;
    min-width: 70px;
  }
  
  .suggestions {
    padding: 10px 15px 0;
    gap: 6px;
  }
  
  .suggestions button {
    padding: 6px 12px;
    font-size: 12px;
  }
}
/* Feedback buttons styling */
.message-feedback {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    opacity: 0.7;
}

.feedback-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.feedback-btn:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.feedback-btn.selected {
    background-color: #e8f4fd;
    border-color: #1976d2;
}

.feedback-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 1000;
}

.feedback-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Add these styles to your existing chat.css */

/* Feedback buttons styling */
.message-feedback {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    opacity: 0.7;
}

.feedback-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.feedback-btn:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.feedback-btn.selected {
    background-color: #e8f4fd;
    border-color: #1976d2;
}

.feedback-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 1000;
}

.feedback-toast.show {
    opacity: 1;
    transform: translateY(0);
}
/* Admin notifications */
.admin-notification {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  text-align: center;
  animation: slideIn 0.3s ease-out;
  font-weight: 400;
  color: #475569;
}
.admin-notification.joining {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
  color: #166534;
}
.admin-notification.leaving {
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  border-color: #fca5a5;
  color: #991b1b;
}
.admin-status-bar {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: white;
  padding: 0.75rem;
  text-align: center;
  font-weight: 400;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 100;
  display: none;
}
.typing-indicator-admin {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0.5rem 0;
  color: #64748b;
  font-style: italic;
  font-weight: 400;
  animation: pulse 1.5s infinite;
}
.message.admin {
  justify-content: flex-start;
}
.message.admin .message-content {
  background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%);
  color: #0277bd;
  border: 1px solid #4fc3f7;
  border-radius: 12px;
  padding: 15px;
  margin: 8px 0;
  box-shadow: 0 2px 8px rgba(3, 169, 244, 0.15);
}
.admin-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
}

/* Beta tag */
.beta-tag {
  position: absolute;
  top: 10px;
  right: 15px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
  animation: betaGlow 2s ease-in-out infinite alternate;
  z-index: 10;
}
@keyframes betaGlow {
  from { box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3); }
  to { box-shadow: 0 2px 12px rgba(59, 130, 246, 0.5); }
}

/* Connection indicator */
.connection-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #10b981;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  z-index: 1000;
}
.connection-indicator.disconnected {
  background: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.connection-indicator.connecting {
  background: #f59e0b;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* System messages */
.error-message {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 8px;
  font-size: 0.875rem;
}
.no-socket-mode {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 0.75rem;
  margin: 0.5rem 0;
  border-radius: 6px;
  font-size: 0.8rem;
  text-align: center;
}

/* Animations */
@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
