/* ChatComponent.css */

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 600px;
  min-height: 400px;
  background: #ffffff;
  border-radius: 1.25rem;
  border: 1px solid var(--regenera-earth-40, #EFE7DA);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* Header */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-dot.connected {
  background-color: #4ade80;
}

.status-dot.disconnected {
  background-color: #f87171;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.clear-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}

.clear-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.clear-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Messages Container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #EFE7DA;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 #f8fafc;
}

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

.chat-messages::-webkit-scrollbar-track {
  background: #f8fafc;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Message Styles */
.message {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  max-width: 80%;
  animation: slideIn 0.3s ease-out;
}

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

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.assistant {
  align-self: flex-start;
}

.message.system {
  align-self: center;
  max-width: 90%;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-text {
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.4;
  font-size: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message.user .message-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-text {
  background: #ffffff;
  color: #2d3748;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message.system .message-text {
  background: #fed7d7;
  color: #c53030;
  border: 1px solid #feb2b2;
  text-align: center;
  font-size: 13px;
}

.message-time {
  font-size: 11px;
  color: #a0aec0;
  padding: 0 4px;
}

.message.user .message-time {
  text-align: right;
}

.message.assistant .message-time {
  text-align: left;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message.user .message-avatar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
}

.message.assistant .message-avatar {
  
  border-color: #48bb78;
}

.message.system .message-avatar {
  background: none;
  border-color: #feb2b2;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a0aec0;
  animation: typing 1.5s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  30% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Input Container */
.chat-input-container {
  padding: 16px 20px;
  background: #EFE7DA;
  border-top: 1px solid #e2e8f0;
}

.chat-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border-radius: 20px;
  padding: 6px 8px;
  border: 1px solid #e1e5e9;
  transition: all 0.2s ease;
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 45px 10px 16px;
  font-size: 14px;
  color: #2d3748;
  font-family: inherit;
}



.chat-input:disabled {
  
  cursor: not-allowed;
}

.send-button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  
}

.send-button:hover:not(:disabled) {
  transform: scale(1.05);
  
}

.send-button:disabled {
  background: #e2e8f0;
  color: #a0aec0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-container {
    border-radius: 0;
    height: 100vh;
    max-height: none;
  }

  .chat-header {
    padding: 12px 16px;
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-input-container {
    padding: 12px 16px;
  }

  .message {
    max-width: 90%;
  }

  .chat-title h3 {
    font-size: 16px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .chat-container {
    background: #FFFFFF;
    border: 1px solid var(--regenera-earth-40, #EFE7DA);
  }

  .chat-messages {
    background: #2d3748;
  }

  .message.assistant .message-text {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #718096;
  }

  .chat-input-container {
    background: #efe7da;
    border-top: 1px solid #efe7da;
  }

  .chat-input {
    border: none;
  outline: none;
  background: transparent;
  }

  

  .message-avatar {
    background: #ffffff;
    border: 2px solid #e2e8f0;
  }
}

/* Custom scrollbar for better UX */
.chat-messages {
  scroll-behavior: smooth;
}

/* Ensure proper text rendering */
.message-text {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ChatExample.css */

.chat-example-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.example-header {
  padding: 40px 20px 20px;
  text-align: center;
  color: white;
}

.example-header h1 {
  margin: 0 0 10px;
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.example-header p {
  margin: 0;
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 300;
}

.error-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(254, 178, 178, 0.9);
  color: #c53030;
  padding: 12px 20px;
  border-radius: 8px;
  margin: 20px auto 0;
  max-width: 600px;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

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

.error-banner button {
  background: none;
  border: none;
  color: #c53030;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  margin-left: 10px;
  font-weight: bold;
}

/* Main Content */
.example-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Welcome Section */
.welcome-section {
  max-width: 500px;
  width: 100%;
}

.welcome-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  animation: fadeInUp 0.6s ease-out;
}

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

.welcome-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  display: block;
}

.welcome-card h2 {
  margin: 0 0 20px;
  font-size: 2rem;
  color: #2d3748;
  font-weight: 600;
}

.welcome-card p {
  margin: 0 0 20px;
  color: #4a5568;
  line-height: 1.6;
  font-size: 1rem;
}

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

.welcome-card li {
  margin: 12px 0;
  color: #4a5568;
  padding-left: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.start-chat-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  margin: 20px 0;
}

.start-chat-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

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

.stats {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  color: #718096;
  font-size: 0.9rem;
}

/* Chat Section */
.chat-section {
  max-width: 800px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-wrapper {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  animation: fadeInUp 0.6s ease-out;
}

.main-chat {
  height: 500px;
  border: none;
  box-shadow: none;
  background: transparent;
}

.chat-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  padding: 16px 24px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.minimize-button {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  border: 2px solid #667eea;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.minimize-button:hover {
  background: #667eea;
  color: white;
}

.chat-info {
  color: #718096;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Footer */
.example-footer {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.example-footer strong {
  color: white;
}

/* Floating Chat Button */


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

.floating-chat-button:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.7);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #f56565;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  animation: pulse 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .example-header {
    padding: 20px 15px 15px;
  }

  .example-header h1 {
    font-size: 2rem;
  }

  .example-header p {
    font-size: 1rem;
  }

  .example-main {
    padding: 15px;
  }

  .welcome-card {
    padding: 30px 20px;
  }

  .welcome-card h2 {
    font-size: 1.5rem;
  }

  .start-chat-button {
    padding: 14px 28px;
    font-size: 1rem;
  }

  .chat-section {
    max-width: 100%;
  }

  .chat-wrapper {
    padding: 15px;
  }

  .main-chat {
    height: 400px;
  }

  .chat-controls {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
  }

  .floating-chat-button {
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
    font-size: 22px;
  }

  .error-banner {
    margin: 15px;
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .example-header h1 {
    font-size: 1.8rem;
  }

  .welcome-card {
    margin: 0 10px;
    padding: 25px 15px;
  }

  .welcome-card ul {
    font-size: 0.9rem;
  }

  .main-chat {
    height: 350px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .welcome-card {
    background: rgba(26, 32, 44, 0.95);
    color: #e2e8f0;
  }

  .welcome-card h2 {
    color: #e2e8f0;
  }

  .welcome-card p,
  .welcome-card li {
    color: #cbd5e0;
  }

  .stats {
    color: #a0aec0;
    border-color: #4a5568;
  }

  .chat-wrapper {
    background: rgba(26, 32, 44, 0.95);
  }

  .chat-controls {
    background: rgba(26, 32, 44, 0.9);
  }

  .minimize-button {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    color: #90cdf4;
  }

  .minimize-button:hover {
    background: #667eea;
    color: white;
  }

  .chat-info {
    color: #a0aec0;
  }
}

/* Accessibility improvements */
.start-chat-button:focus,
.minimize-button:focus,
.floating-chat-button:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Smooth transitions for theme changes */
* {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

/* Loading states */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Enhanced visual hierarchy */
.welcome-card {
  position: relative;
  overflow: hidden;
}

.welcome-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}
