/**
 * chat-interface.css
 * Styles for the persistent floating chat interface
 */

/* Chat Container */
.chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: 350px;
  max-width: calc(100vw - 40px);
  transition: all 0.3s ease;
}

/* Collapsed state */
.chat-container.collapsed {
  width: 60px;
  height: 60px;
}

/* Chat Button */
.chat-button {
  width: 60px;
  height: 60px;
  border-radius: 30px;
  background-color: #8b5cf6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: none;
  position: absolute;
  bottom: 0;
  right: 0;
}

.chat-button:hover {
  background-color: #7c3aed;
  transform: scale(1.05);
}

.chat-button svg {
  width: 24px;
  height: 24px;
}

/* Chat Panel */
.chat-panel {
  display: none;
  flex-direction: column;
  background-color: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  height: 500px;
  max-height: calc(100vh - 100px);
  width: 100%;
  transition: all 0.3s ease;
}

.chat-container:not(.collapsed) .chat-panel {
  display: flex;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #8b5cf6;
  color: white;
}

.chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

.chat-header-button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.chat-header-button svg {
  width: 16px;
  height: 16px;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #f9fafb;
}

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

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

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

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

/* Message Bubbles */
.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  position: relative;
  word-wrap: break-word;
  line-height: 1.4;
}

.message.user {
  align-self: flex-end;
  background-color: #e0e7ff;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background-color: white;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

/* Links in assistant messages */
.message.assistant a, .chat-link {
  color: #4f46e5;
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-block;
  margin: 2px 0;
  padding: 2px 0;
}

.message.assistant a:hover, .chat-link:hover {
  color: #4338ca;
  text-decoration: underline;
}

/* Loading Message Animation */
.message.loading {
  display: flex;
  align-items: center;
  gap: 4px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background-color: #8b5cf6;
  border-radius: 50%;
  opacity: 0.6;
}

.loading-dot:nth-child(1) {
  animation: pulse 1.2s infinite;
}

.loading-dot:nth-child(2) {
  animation: pulse 1.2s infinite 0.4s;
}

.loading-dot:nth-child(3) {
  animation: pulse 1.2s infinite 0.8s;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* Course Recommendations */
.recommendations {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  background-color: #f0f9ff;
  border-radius: 8px;
  border: 1px solid #bae6fd;
}

.recommendations h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #0369a1;
}

.recommendation-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recommendation-item {
  display: block;
  padding: 8px 12px;
  background-color: white;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  text-decoration: none;
  transition: all 0.2s ease;
}

.recommendation-item:hover {
  background-color: #f0f9ff;
  border-color: #7dd3fc;
  transform: translateY(-2px);
}

.recommendation-title {
  font-size: 14px;
  font-weight: 500;
  color: #0c4a6e;
  margin: 0;
}

.recommendation-details {
  font-size: 12px;
  color: #64748b;
  margin: 4px 0 0 0;
}

/* Chat Input */
.chat-input-container {
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  background-color: white;
}

.chat-input-form {
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.chat-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.chat-submit {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #8b5cf6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-submit:hover {
  background-color: #7c3aed;
  transform: scale(1.05);
}

.chat-submit:disabled {
  background-color: #c4b5fd;
  cursor: not-allowed;
  transform: none;
}

.chat-submit svg {
  width: 18px;
  height: 18px;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
  .chat-container {
    bottom: 16px;
    right: 16px;
    max-width: calc(100vw - 32px);
  }
  
  .chat-panel {
    height: 400px;
    max-height: calc(100vh - 80px);
  }
  
  .message {
    max-width: 85%;
    padding: 10px 14px;
  }
}

/* Animation for expanding/collapsing */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-container:not(.collapsed) .chat-panel {
  animation: fadeIn 0.3s ease forwards;
}

/* Unread indicator */
.unread-indicator {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background-color: #ef4444;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  border: 2px solid white;
}
