/* Chatbot Styles */
.chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chat-tooltip {
  position: absolute;
  bottom: 70px;
  right: 0;
  background-color: #1A1A1A;
  color: white;
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

.chat-tooltip.show-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.chatbot-bubble {
  width: 60px;
  height: 60px;
  background-color: #1A1A1A;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.chatbot-bubble:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.chatbot-bubble svg {
  width: 30px;
  height: 30px;
  fill: #FFFFFF;
}

.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  height: 500px;
  background-color: #FFFFFF;
  border: 1px solid #E5E5E5;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  transform: translateY(20px);
}

/* Desktop positioning - center the chatbot window */
@media (min-width: 769px) {
  .chatbot-window {
    left: auto;
    right: 0;
  }
}



.chatbot-window.active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.chatbot-header {
  background-color: #1A1A1A;
  color: #FFFFFF;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chatbot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatbot-title {
  font-weight: 600;
  font-size: 16px;
}

.chatbot-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 20px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #FFFFFF;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
}

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

.message-bot {
  align-self: flex-start;
  background-color: #F7F7F7;
  color: #111111;
  border-bottom-left-radius: 4px;
}

.typing-indicator {
  align-self: flex-start;
  background-color: #F7F7F7;
  color: #111111;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-width: 60px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: #111111;
  border-radius: 50%;
  animation: typing 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 typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

.suggestions-container {
  padding: 16px;
  background-color: #FFFFFF;
  border-top: 1px solid #E5E5E5;
}

.suggestions-title {
  font-size: 14px;
  font-weight: 600;
  color: #111111;
  margin-bottom: 10px;
}

.suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-item {
  background-color: #F7F7F7;
  border: none;
  border-radius: 14px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-item:hover {
  background-color: #E5E5E5;
}

.chatbot-input-container {
  display: flex;
  padding: 16px;
  background-color: #FFFFFF;
  border-top: 1px solid #E5E5E5;
  gap: 10px;
}

.chatbot-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #DCDCDC;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  background-color: #FFFFFF;
}

.chatbot-input:focus {
  border-color: #1A1A1A;
}

.chatbot-input::placeholder {
  color: #888888;
}

.chatbot-send-button {
  background-color: #1A1A1A;
  color: #FFFFFF;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.chatbot-send-button:hover {
  background-color: #333333;
}

.chatbot-send-button svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.escalation-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  background-color: #FFFFFF;
  border-top: 1px solid #E5E5E5;
}

.escalation-button {
  flex: 1;
  min-width: 100px;
  padding: 10px;
  background-color: #F7F7F7;
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #111111;
  cursor: pointer;
  transition: all 0.2s ease;
}

.escalation-button:hover {
  background-color: #E5E5E5;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .chatbot-window {
    width: 90%;
    max-width: 90vw;
    height: 80vh;
    bottom: 70px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(0);
  }
  
  .chatbot-bubble {
    width: 50px;
    height: 50px;
  }
  
  .message {
    max-width: 90%;
    font-size: 15px;
    line-height: 1.5;
    padding: 14px 18px;
  }
  
  .chatbot-input {
    padding: 14px 18px;
    font-size: 16px; /* Better for mobile typing */
  }
  
  .chatbot-send-button {
    width: 44px;
    height: 44px;
  }
}

/* Extra small devices (phones, 480px and down) */
@media (max-width: 480px) {
    /* 1. Reset Positioning */
    .chatbot-window {
        position: fixed;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        
        /* 2. Full Size Dimensions */
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh;
        max-width: 100vw;
        border-radius: 0; /* Remove corners for full screen feel */
        
        /* 3. Stack Order */
        z-index: 99999;
        margin: 0;
        transform: none !important; /* Remove the centering transform */
        
        /* Use flexbox for better layout control */
        display: flex;
        flex-direction: column;
    }
    
    /* 4. Fix the Header for Mobile */
    .chatbot-header {
        border-radius: 0;
        padding-top: 15px; /* Account for status bar */
        flex-shrink: 0; /* Prevent header from shrinking */
    }
    
    /* 5. Ensure the Input area sticks to bottom */
    .chatbot-input-container {
        position: relative; /* Change to relative positioning */
        width: 100%;
        background: white;
        flex-shrink: 0; /* Prevent input area from shrinking */
    }
    
    /* 6. Adjust Chat Body to scroll above input */
    .chatbot-messages { 
        flex: 1; /* Take up remaining space */
        overflow-y: auto; /* Enable scrolling */
        padding-bottom: 20px; 
    }
    
    /* 7. Ensure suggestions and escalation containers are properly positioned */
    .suggestions-container,
    .escalation-buttons {
        flex-shrink: 0; /* Prevent these from shrinking */
    }
    
    /* 8. Hide the Launch Button when open */
    .chatbot-container.open .chatbot-bubble { 
        display: none; 
    }
    
    .message {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .chatbot-input {
        padding: 12px 16px;
        font-size: 16px;
    }
    
    .chatbot-send-button {
        width: 40px;
        height: 40px;
    }
}