/* AI Chat Sidebar Styles */

/* Body adjustments when chat is open */
body.ai-chat-open {
  margin-left: 437.5px; /* 7/16 of 1000px base width */
}

/* AI Chat Toggle Button */
.ai-chat-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.ai-chat-toggle:hover {
  transform: translateY(-2px);
  background: #2563eb;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.ai-chat-toggle svg {
  flex-shrink: 0;
}

/* Settings Button */
.settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  color: #6c757d;
  border: 1px solid #e9ecef;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-btn:hover {
  background: #e9ecef;
  color: #495057;
  transform: rotate(15deg);
}

/* Header Right Layout */
.header-right-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
}

.profile-avatar {
  font-size: 1.2rem;
}

.profile-name {
  font-size: 0.9rem;
  font-weight: 500;
}

/* AI Chat Sidebar */
.ai-chat-sidebar {
  position: fixed;
  top: 0;
  left: -450px; /* Hidden initially */
  width: 437.5px; /* 7/16 of viewport */
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  z-index: 1500; /* Above global header (z-index 1100-1200) */
  transition: left 0.3s ease;
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.08);
}

.ai-chat-sidebar.open {
  left: 0;
}

/* Chat Header */
.ai-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: #ffffff;
  color: #1f2937;
  border-bottom: 1px solid #e5e7eb;
}

.ai-chat-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-chat-header h3::before {
  content: '✨';
}

.ai-chat-close {
  background: #f3f4f6;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.ai-chat-close:hover {
  background-color: #e5e7eb;
  color: #1f2937;
}

/* Messages Container */
.ai-chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #fafafa;
}

/* Message Styles */
.ai-message, .user-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  max-width: 85%;
  animation: messageSlideIn 0.3s ease;
}

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

.ai-avatar, .user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.ai-avatar {
  background: #3b82f6;
  color: white;
}

.user-avatar {
  background: #f3f4f6;
  color: #6b7280;
}

.message-content {
  background: white;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
  line-height: 1.4;
}

.user-message .message-content {
  background: #3b82f6;
  color: white;
}

.ai-message.welcome-message .message-content {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}

.welcome-message ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.welcome-message li {
  margin: 0.25rem 0;
}

/* Thinking Animation */
.ai-message.thinking .message-content {
  position: relative;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.ai-message.thinking .message-content::after {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

/* Input Area */
.ai-chat-input-area {
  padding: 1rem 1.5rem;
  background: white;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.ai-chat-input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  background: #f8f9fa;
  border-radius: 25px;
  padding: 0.5rem;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.ai-chat-input-wrapper:focus-within {
  border-color: #3b82f6;
}

.ai-chat-input {
  flex: 1;
  border: none;
  background: none;
  resize: none;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 0.5rem 1rem;
  max-height: 120px;
  outline: none;
}

.ai-chat-input::placeholder {
  color: #6c757d;
}

.ai-chat-send {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-chat-send:hover:not(:disabled) {
  transform: scale(1.1);
  background: #2563eb;
}

.ai-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Animations */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Scrollbar Styling */
.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

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

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
  .ai-chat-sidebar {
    width: 100vw;
    left: -100vw;
  }
  
  body.ai-chat-open {
    margin-left: 0;
  }
  
  .ai-chat-toggle span {
    display: none;
  }
}

@media (max-width: 480px) {
  .ai-chat-header {
    padding: 0.75rem 1rem;
  }
  
  .ai-chat-messages {
    padding: 0.75rem;
  }
  
  .ai-chat-input-area {
    padding: 0.75rem 1rem;
  }
}