/* Modern GitHub Copilot-Style Chat Widget */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
}

/* Chat Widget Button */
.chat-widget-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #0969da 0%, #0550ae 100%);
  border-radius: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 
    0 8px 24px rgba(9, 105, 218, 0.35),
    0 2px 8px rgba(9, 105, 218, 0.25);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-widget-button:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 
    0 12px 32px rgba(9, 105, 218, 0.4),
    0 4px 16px rgba(9, 105, 218, 0.3);
}

.chat-widget-button:active {
  transform: translateY(-1px) scale(1.02);
}

/* Chat Widget Container */
.chat-widget-container {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 400px;
  height: 600px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.15),
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  backdrop-filter: blur(16px);
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #0969da 0%, #0550ae 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 16px;
  border-radius: 16px 16px 0 0;
}

.chat-close-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.chat-close-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: linear-gradient(to bottom, #f6f8fa 0%, #ffffff 100%);
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(139, 148, 158, 0.3);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 148, 158, 0.5);
}

.message {
  margin-bottom: 16px;
  max-width: 85%;
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  display: flex;
  justify-content: flex-end;
}

.bot-message {
  display: flex;
  justify-content: flex-start;
}

.message-content {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.user-message .message-content {
  background: linear-gradient(135deg, #0969da 0%, #0550ae 100%);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(9, 105, 218, 0.25);
}

.bot-message .message-content {
  background: #f6f8fa;
  color: #24292f;
  border: 1px solid #d0d7de;
  border-bottom-left-radius: 6px;
}

/* Suggestion Chips */
.suggestion-chips {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.suggestion-chip {
  background: #ffffff;
  border: 1px solid #d0d7de;
  color: #24292f;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.suggestion-chip:hover {
  background: #f6f8fa;
  border-color: #0969da;
  color: #0969da;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(9, 105, 218, 0.15);
}

/* Copilot-Style Input Container */
.chat-input-container {
  display: flex;
  flex-direction: column;
  padding: 16px 20px 20px;
  background: #ffffff;
  border-top: 1px solid #d0d7de;
  gap: 12px;
}

.copilot-editor {
  min-height: 80px;
  max-height: 200px;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  overflow: hidden;
  background: #f6f8fa;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.copilot-editor:focus-within {
  border-color: #0969da;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.send-button {
  align-self: flex-end;
  background: linear-gradient(135deg, #0969da 0%, #0550ae 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(9, 105, 218, 0.25);
}

.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(9, 105, 218, 0.3);
}

.send-button:active {
  transform: translateY(0);
}

.send-button:disabled {
  background: #8b949e;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  padding: 12px 20px;
  align-items: center;
  background: #f6f8fa;
  border-top: 1px solid #d0d7de;
}

.typing-indicator::before {
  content: "Sympathico is typing";
  font-size: 13px;
  color: #656d76;
  margin-right: 8px;
}

.typing-dot {
  width: 4px;
  height: 4px;
  margin: 0 1px;
  background-color: #8b949e;
  border-radius: 50%;
  animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 480px) {
  .chat-widget-container {
    width: calc(100vw - 24px);
    height: calc(100vh - 120px);
    right: 12px;
    bottom: 90px;
    border-radius: 16px;
  }
  
  .chat-widget-button {
    bottom: 16px;
    right: 16px;
  }
}

/* Focus States for Accessibility */
.chat-widget-button:focus,
.send-button:focus,
.suggestion-chip:focus,
.chat-close-button:focus {
  outline: 2px solid #0969da;
  outline-offset: 2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .chat-widget-container {
    background: #0d1117;
    box-shadow: 
      0 20px 40px rgba(0, 0, 0, 0.4),
      0 8px 32px rgba(0, 0, 0, 0.3),
      0 0 0 1px rgba(255, 255, 255, 0.1);
  }
  
  .chat-messages {
    background: linear-gradient(to bottom, #161b22 0%, #0d1117 100%);
  }
  
  .bot-message .message-content {
    background: #21262d;
    color: #f0f6fc;
    border-color: #30363d;
  }
  
  .copilot-editor {
    background: #21262d;
    border-color: #30363d;
  }
  
  .suggestion-chip {
    background: #21262d;
    border-color: #30363d;
    color: #f0f6fc;
  }
  
  .suggestion-chip:hover {
    background: #30363d;
    border-color: #58a6ff;
    color: #58a6ff;
  }
  
  .chat-input-container {
    background: #0d1117;
    border-color: #30363d;
  }
  
  .typing-indicator {
    background: #161b22;
    border-color: #30363d;
  }
}
