* {
  box-sizing: border-box;
}

#wpchatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

#wpchatbot-button {
  background: #52AFC0;
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(82, 175, 192, 0.3);
  transition: all 0.3s ease;
  border: none;
  font-size: 24px;
}

#wpchatbot-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(82, 175, 192, 0.4);
}

#wpchatbot-box {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 40px));
  height: min(600px, calc(100vh - 140px));
  max-height: 80vh;
  min-height: 400px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  position: fixed;
  bottom: 90px;
  right: 20px;
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
}

#wpchatbot-box.show {
  transform: translateY(0);
  opacity: 1;
}

.hidden {
  display: none;
}

#wpchatbot-header {

  background: #52afc0;
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

#wpchatbot-header .back-arrow {
  cursor: pointer;
  font-size: 18px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

#wpchatbot-header .back-arrow:hover {
  opacity: 1;
}

#wpchatbot-header .avatar {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

#wpchatbot-header .header-text {
  flex: 1;
}

#wpchatbot-header .header-title {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}

#wpchatbot-header .header-menu {
  cursor: pointer;
  font-size: 18px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

#wpchatbot-header .header-menu:hover {
  opacity: 1;
}

#wpchatbot-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-message {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
}

.welcome-message .emoji {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.welcome-message h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 500;
  color: #334155;
}

.welcome-message p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.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 .avatar {

  background: #52AFC0;
  color: white;
}

.message.user .avatar {
  background: #e5e7eb;
  color: #6b7280;
}

.message .content {
  background: white;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 280px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.user .content {

  background: #52afc0;
  color: white;
}

#wpchatbot-input-container {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 12px;
}

#wpchatbot-input-container .emoji-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

#wpchatbot-input-container .emoji-btn:hover {
  opacity: 1;
}

#wpchatbot-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  background: transparent;
}

#wpchatbot-input::placeholder {
  color: #9ca3af;
}

#wpchatbot-send-btn {

  background: #52afc0;
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.2s ease;
}

#wpchatbot-send-btn:hover {
  background: #4a9fb3;
}

#wpchatbot-send-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.powered-by {
  padding: 12px 20px;
  text-align: center;
  background: white;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Scrollbar styling */
#wpchatbot-messages::-webkit-scrollbar {
  width: 4px;
}

#wpchatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

#wpchatbot-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

#wpchatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Typing indicator */
.typing-dots {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  margin-right: 8px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-text {
  font-size: 12px;
  color: #9ca3af;
  font-style: italic;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Message enhancements */
.message {
  opacity: 1 !important;
  transform: translateY(0) !important;
  display: flex !important;
  animation: messageSlideIn 0.3s ease forwards;
}

.message-read {
  animation: messageRead 0.2s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageRead {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.message-time {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 4px;
  text-align: right;
}

.message.user .message-time {
  text-align: left;
}

/* Confidence indicators */
.message.high-confidence .content {
  border-left: 3px solid #10b981;
}

.message.medium-confidence .content {
  border-left: 3px solid #f59e0b;
}

/* Debug information */
.message-debug {
  font-size: 10px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 4px;
  font-family: monospace;
}

/* Contact options */
.contact-options {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0;
}

.contact-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
  text-align: center;
}

.contact-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-bottom: 4px;
}

.contact-option:hover {
  background: #e5e7eb;
}

.contact-option:last-child {
  margin-bottom: 0;
}

.contact-icon {
  font-size: 16px;
}

.contact-text {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}

/* Enhanced message styling */
.message.bot.high-confidence .avatar {
  background: #10b981;
  animation: pulse 2s infinite;
}

.message.bot.medium-confidence .avatar {
  background: #f59e0b;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Sentiment indicators */
.message.positive-sentiment .content {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.message.negative-sentiment .content {
  background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}

/* Enhanced animations */
.message.user .content {
  animation: slideInRight 0.3s ease;
}

.message.bot .content {
  animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Multiple Choice Styling */
.multiple-choice-intro {
  margin-bottom: 15px;
  font-weight: 500;
  color: #374151;
}

.choice-option {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  margin: 8px 0;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f9fafb;
}

.choice-option:hover {

  border-color: #52AFC0;
  background: #f0f9fa;
  transform: translateX(2px);
}

.choice-option.selected {

  border-color: #52afc0;
  background: #eef7f8;
  box-shadow: 0 2px 8px rgba(82, 175, 192, 0.15);
}

.choice-number {

  background: #52afc0;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  margin-right: 12px;
  flex-shrink: 0;
  margin-top: 2px;
}

.choice-content {
  flex: 1;
}

.choice-title {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
  font-size: 14px;
}

.choice-preview {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.4;
}

.multiple-choice-instruction {
  margin-top: 15px;
  padding: 10px;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 13px;
  color: #6b7280;

  border-left: 3px solid #52afc0;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  #wpchatbot-box {
    width: calc(100vw - 16px);
    height: min(75vh, 480px);
    max-height: 75vh;
    min-height: 320px;
    bottom: 70px;
    right: 8px;
    left: 8px;
    border-radius: 8px;
  }
  
  #wpchatbot-container {
    right: 8px;
    bottom: 8px;
  }

  #wpchatbot-button {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  #wpchatbot-header {
    padding: 10px 12px;
  }

  #wpchatbot-header .header-title {
    font-size: 13px;
  }

  #wpchatbot-header .avatar {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  #wpchatbot-messages {
    padding: 12px;
    gap: 10px;
  }

  .welcome-message {
    padding: 30px 16px;
  }

  .welcome-message .emoji {
    font-size: 28px;
    margin-bottom: 10px;
  }

  .welcome-message h3 {
    font-size: 15px;
  }

  .welcome-message p {
    font-size: 13px;
  }

  .message .avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .message .content {
    max-width: calc(100vw - 80px);
    padding: 9px 12px;
    font-size: 13px;
    border-radius: 16px;
  }

  #wpchatbot-input-container {
    padding: 10px 12px;
    gap: 8px;
  }

  #wpchatbot-input {
    font-size: 13px;
  }

  #wpchatbot-send-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .powered-by {
    padding: 8px 12px;
    font-size: 10px;
  }

  .choice-option {
    padding: 8px;
    margin: 5px 0;
  }

  .choice-number {
    width: 18px;
    height: 18px;
    font-size: 10px;
    margin-right: 6px;
  }

  .choice-title {
    font-size: 12px;
  }

  .choice-preview {
    font-size: 11px;
  }

  .multiple-choice-instruction {
    margin-top: 12px;
    padding: 8px;
    font-size: 12px;
  }

  .contact-options {
    padding: 12px;
  }

  .contact-title {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .contact-option {
    padding: 8px 10px;
  }

  .contact-text {
    font-size: 12px;
  }
}

/* Enhanced Mobile responsiveness */
@media (max-width: 768px) {
  #wpchatbot-box {
    width: calc(100vw - 24px);
    height: min(70vh, 500px);
    max-height: 70vh;
    min-height: 350px;
    bottom: 80px;
    right: 12px;
    left: 12px;
  }
  
  #wpchatbot-container {
    right: 12px;
    bottom: 12px;
  }

  #wpchatbot-button {
    width: 50px;
    height: 50px;
    font-size: 22px;
  }

  #wpchatbot-header {
    padding: 12px 16px;
  }

  #wpchatbot-messages {
    padding: 16px;
    gap: 12px;
  }

  .message .content {
    max-width: calc(100vw - 120px);
    padding: 10px 14px;
    font-size: 14px;
  }

  #wpchatbot-input-container {
    padding: 12px 16px;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  #wpchatbot-box {
    height: min(85vh, 400px);
    max-height: 85vh;
    min-height: 300px;
  }

  #wpchatbot-messages {
    padding: 12px;
  }
}

/* Large screens */
@media (min-width: 1200px) {
  #wpchatbot-box {
    width: 420px;
    height: 650px;
  }

  #wpchatbot-messages {
    padding: 24px;
    gap: 18px;
  }

  .message .content {
    max-width: 320px;
    font-size: 14px;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  #wpchatbot-box {
    width: calc(100vw - 12px);
    height: min(80vh, 400px);
    max-height: 80vh;
    min-height: 280px;
    bottom: 60px;
    right: 6px;
    left: 6px;
  }

  #wpchatbot-container {
    right: 6px;
    bottom: 6px;
  }

  .message .content {
    max-width: calc(100vw - 70px);
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* Add CSS for collapsed button with bubble text */

.collapsed-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    z-index: 9999;
}

.collapsed-text {
    background: linear-gradient(135deg, #52AFC0, #4a9db0);
    color: white;
    padding: 10px 16px;
    border-radius: 20px;
    margin: 0;
    margin-right: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(82, 175, 192, 0.3);
    position: relative;
    white-space: nowrap;
    animation: bubbleFloat 2s ease-in-out infinite;
    transition: opacity 0.3s ease, transform 0.3s ease;
}



/* Alternative approach - hide when chatbot box doesn't have hidden class */
#wpchatbot-container.chatbot-open .collapsed-text {
    display: inline-block;
}

/* Speech bubble arrow */
.collapsed-text::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #52AFC0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Chat button styling */
#wpchatbot-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #52AFC0, #4a9db0);
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(82, 175, 192, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Floating animation */
@keyframes bubbleFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .collapsed-btn {
        bottom: 15px;
        right: 15px;
    }
    
    .collapsed-text {
        font-size: 12px;
        padding: 8px 12px;
        margin-right: 8px;
    }
    
    #wpchatbot-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Hide bubble text when chatbot is open */
#wpchatbot-container.chatbot-open .collapsed-text {
    display: none;
}

/* Optional: Fade in animation when page loads */
.collapsed-text {
    animation: bubbleFloat 2s ease-in-out infinite, fadeInBubble 0.8s ease-out;
}

@keyframes fadeInBubble {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0px);
    }
}
