/* ==================================================
   Chatbot Widget Styles
   ================================================== */

/* Import monospace font for code-like appearance */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600&display=swap');

/* Chat Widget Container */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: var(--font-family);
}


/* Chat Toggle Button */
.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(255, 255, 255, 0.4);
}

.chat-toggle .chat-icon,
.chat-toggle .close-icon {
  color: #000;
  transition: all 0.3s ease;
}

.chat-toggle .close-icon {
  display: none;
}

.chat-toggle.active .chat-icon {
  display: none;
}

.chat-toggle.active .close-icon {
  display: block;
}

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

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
  }
}

/* Chat Container */
.chat-container {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: min(400px, calc(100vw - 80px));
  max-width: 400px;
  height: min(600px, calc(100vh - 160px));
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideUp 0.3s ease;
}

.chat-container.active {
  display: flex;
}

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

/* Chat Header */
.chat-header {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-info {
  flex: 1;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

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

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.status-text {
  color: #ffffff;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 14px;
}

.chat-subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  margin: 0;
}

.minimize-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px;
  transition: all 0.3s ease;
}

.minimize-btn:hover {
  color: #ffffff;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 136, 0.3) transparent;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

/* Welcome Message */
.welcome-message {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  line-height: 1.6;
}

.ascii-art {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #ffffff;
  margin-bottom: 16px;
  white-space: pre;
  line-height: 1.2;
}

.welcome-message ul {
  list-style: none;
  padding: 0;
  margin-top: 12px;
}

.welcome-message li {
  padding: 4px 0;
  color: rgba(255, 255, 255, 0.7);
}

/* Message Bubbles */
.message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.message.bot .message-avatar {
  background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
  color: #000;
}

.message.user .message-avatar {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
}

.message-content {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.message.bot .message-content {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
  border-bottom-left-radius: 4px;
}

.message.user .message-content {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border-bottom-right-radius: 4px;
}

/* Code blocks in messages */
.message-content pre {
  background: var(--color-code-bg);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 4px;
  padding: 8px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
}

.message-content code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #ffffff;
}

.message-content a {
  color: #ffffff !important;
  text-decoration: underline;
  transition: all 0.3s ease;
  word-break: break-all;
  overflow-wrap: break-word;
}

.message-content a:hover {
  color: #cccccc !important;
  text-decoration: none;
}

/* Quick Actions */
.quick-actions {
  padding: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(0, 255, 136, 0.1);
}

.quick-action {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-mono);
}

.quick-action:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 20px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
  animation: typing 1.4s 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: translateY(0);
    opacity: 0.3;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Chat Input Container */
.chat-input-container {
  padding: 16px;
  border-top: 1px solid rgba(0, 255, 136, 0.2);
  background: rgba(0, 0, 0, 0.3);
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  outline: none;
  font-family: var(--font-family);
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.voice-btn,
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: rgba(255, 255, 255, 0.5);
}

.voice-btn:hover,
.send-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.voice-btn.recording {
  background: rgba(255, 68, 68, 0.2);
  color: #ff4444;
  animation: recordPulse 1.5s infinite;
}

@keyframes recordPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 68, 68, 0);
  }
}

/* Voice Wave Animation */
.voice-wave {
  display: flex;
  gap: 3px;
  justify-content: center;
  padding: 8px;
  height: 40px;
  align-items: center;
}

.voice-wave span {
  width: 3px;
  height: 20px;
  background: #ffffff;
  border-radius: 3px;
  animation: wave 1s ease-in-out infinite;
}

.voice-wave span:nth-child(1) { animation-delay: 0s; }
.voice-wave span:nth-child(2) { animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% {
    height: 20px;
  }
  50% {
    height: 40px;
  }
}

/* Mobile and Small Screen Responsive */
@media screen and (max-width: 480px) {
  .chat-container {
    position: fixed !important;
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 100px) !important;
    right: 10px !important;
    left: 10px !important;
    bottom: 70px !important;
    max-width: none !important;
    z-index: 10000 !important;
    transform: none !important;
  }
  
  .chat-toggle {
    width: 50px;
    height: 50px;
    position: fixed !important;
    bottom: 15px !important;
    right: 15px !important;
    z-index: 10001 !important;
  }
}

/* Very small screens */
@media screen and (max-width: 400px) {
  .chat-container {
    position: fixed !important;
    width: calc(100vw - 16px) !important;
    height: calc(100vh - 90px) !important;
    right: 8px !important;
    left: 8px !important;
    bottom: 60px !important;
    z-index: 10000 !important;
    transform: none !important;
  }
  
  .chat-toggle {
    width: 45px;
    height: 45px;
    position: fixed !important;
    bottom: 12px !important;
    right: 12px !important;
    z-index: 10001 !important;
  }
}

/* Medium screens - prevent overflow */
@media screen and (min-width: 481px) and (max-width: 768px) {
  .chat-container {
    width: min(380px, calc(100vw - 60px)) !important;
    right: 20px;
  }
}

/* Ensure proper viewport constraints on all screens */
@media screen and (max-width: 500px) {
  .chat-widget {
    position: fixed !important;
    right: 15px !important;
    bottom: 20px !important;
    z-index: 10001 !important;
  }
  
  .chat-container {
    position: fixed !important;
    transform: none !important;
    z-index: 10000 !important;
  }
  
  /* Ensure chatbot doesn't interfere with page content */
  .chat-container.active {
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
  }
}

/* Suggested Actions */
.suggested-actions {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.suggestions-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-align: center;
  font-weight: 500;
}

.actions-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.suggestion-btn {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: white;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.suggestion-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.3);
}

.suggestion-btn::before {
  content: '→';
  position: absolute;
  right: 1rem;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.suggestion-btn:hover::before {
  opacity: 1;
  transform: translateX(0);
}

/* Responsive adjustments for suggested actions */
@media (max-width: 480px) {
  .suggested-actions {
    padding: 0.8rem;
  }
  
  .actions-container {
    gap: 0.4rem;
  }
  
  .suggestion-btn {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* Suggested Questions in Welcome Interface */
.suggested-questions {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.suggested-questions-title {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 8px;
  text-align: center;
  font-family: var(--font-mono);
}

.suggested-questions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.suggested-question-btn {
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-family: var(--font-family);
  line-height: 1.2;
}

.suggested-question-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Responsive adjustments for suggested questions */
@media (max-width: 480px) {
  .suggested-questions {
    padding: 10px 12px;
  }
  
  .suggested-questions-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  
  .suggested-question-btn {
    padding: 5px 6px;
    font-size: 9px;
  }
}