/* Chat Widget Styles */
#disegnarecass-chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 350px;
  max-width: 90vw;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: all 0.3s ease;
}

#disegnarecass-chat-container.chat-closed {
  height: 60px;
  overflow: hidden;
}

#disegnarecass-chat-container.chat-open {
  height: 500px;
  max-height: 80vh;
}

/* Chat Header */
.chat-header {
  background: #ff0000;
  color: white;
  padding: 15px 20px;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

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

.chat-toggle {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.chat-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-toggle .dashicons {
  width: 20px;
  height: 20px;
  font-size: 20px;
}

/* Chat Body */
.chat-body {
  display: flex;
  flex-direction: column;
  height: calc(100% - 60px);
}

.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  max-height: 350px;
  background: #f9f9f9;
}

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

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

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

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

/* Messages */
.message {
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
}

.message-content {
  max-width: 85%;
  padding: 10px 15px;
  border-radius: 18px;
  word-wrap: break-word;
  line-height: 1.4;
}

.bot-message {
  justify-content: flex-start;
}

.bot-message .message-content {
  background: #e9ecef;
  color: #333;
  border-bottom-left-radius: 5px;
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-content {
  background: #0073aa;
  color: white;
  border-bottom-right-radius: 5px;
}

.message-content p {
  margin: 0;
  font-size: 14px;
}

.message-content ul {
  margin: 5px 0;
  padding-left: 20px;
}

.message-content li {
  margin: 3px 0;
  font-size: 13px;
}

.message-content strong {
  font-weight: 600;
}

.message-content a {
  color: #0073aa;
  text-decoration: none;
}

.user-message .message-content a {
  color: #ffffff;
  text-decoration: underline;
}

.message-content a:hover {
  text-decoration: underline;
}

/* Typing Indicator */
.typing-indicator .message-content {
  padding: 15px;
  background: #e9ecef;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-dots span {
  height: 6px;
  width: 6px;
  background: #999;
  border-radius: 50%;
  display: inline-block;
  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;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat Input */
.chat-input-container {
  display: flex;
  padding: 15px;
  border-top: 1px solid #e9ecef;
  background: white;
  border-radius: 0 0 10px 10px;
  gap: 10px;
}

#chat-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 20px;
  max-height: 80px;
  overflow-y: auto;
}

#chat-input:focus {
  border-color: #0073aa;
}

#chat-send {
  background: #ff0000;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
}

#chat-send:hover {
  background: #ba0202;
}

#chat-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  #disegnarecass-chat-container {
    width: 300px;
    right: 10px;
    bottom: 10px;
  }

  /* When chat is closed on mobile, show only icon */
  #disegnarecass-chat-container.chat-closed {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  }

  #disegnarecass-chat-container.chat-closed .chat-header {
    border-radius: 50%;
    padding: 0;
    justify-content: center;
    width: 60px;
    height: 60px;
  }

  #disegnarecass-chat-container.chat-closed .chat-header h3 {
    display: none;
  }

  #disegnarecass-chat-container.chat-closed .chat-toggle {
    padding: 0;
  }

  #disegnarecass-chat-container.chat-closed .chat-toggle .dashicons {
    width: 30px;
    height: 30px;
    font-size: 30px;
  }

  /* When chat is open on mobile */
  #disegnarecass-chat-container.chat-open {
    width: calc(100vw - 20px);
    max-width: 100%;
    height: 500px;
    max-height: calc(100vh - 20px);
    border-radius: 10px;
  }

  #disegnarecass-chat-container.chat-open .chat-header {
    border-radius: 10px 10px 0 0;
    padding: 12px 15px;
  }

  #disegnarecass-chat-container.chat-open .chat-header h3 {
    display: block;
    font-size: 14px;
  }

  #disegnarecass-chat-container.chat-open .chat-toggle .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
  }

  .chat-messages {
    max-height: 350px;
  }

  .message-content {
    max-width: 90%;
    padding: 8px 12px;
    font-size: 13px;
  }

  .chat-input-container {
    padding: 10px;
  }

  #chat-input {
    padding: 8px 12px;
    font-size: 13px;
  }

  #chat-send {
    padding: 8px 16px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  /* Icon styles for smaller mobile devices when closed */
  #disegnarecass-chat-container.chat-closed {
    width: 56px;
    height: 56px;
    right: 5px;
    bottom: 5px;
  }

  #disegnarecass-chat-container.chat-closed .chat-header {
    width: 56px;
    height: 56px;
  }

  #disegnarecass-chat-container.chat-closed .chat-toggle .dashicons {
    width: 28px;
    height: 28px;
    font-size: 28px;
  }

  /* Full chat view when open */
  #disegnarecass-chat-container.chat-open {
    width: calc(100vw - 10px);
    height: 450px;
    max-height: calc(100vh - 10px);
    right: 5px;
    bottom: 5px;
  }

  .chat-messages {
    max-height: 280px;
    padding: 10px;
  }
}

/* Animation for chat opening/closing */
#disegnarecass-chat-container {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Notification badge (future enhancement) */
.chat-notification {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.message-content ul {
  list-style: none; /* This removes the dots from any ULs */
  padding-left: 0; /* Remove default padding from ULs */
}

/* Modern Button Design */
.command-buttons-container {
  display: flex;
  flex-wrap: wrap; /* Allows buttons to wrap to the next line */
  gap: 8px; /* Space between buttons */
  margin-top: 10px; /* Space above the buttons */
  justify-content: center; /* Center buttons if there's extra space */
}

.command-btn {
  background-color: #007bff; /* A nice blue for primary action */
  color: white;
  border: none;
  border-radius: 20px; /* More rounded corners for a modern look */
  padding: 10px 18px; /* Ample padding for touch targets */
  font-size: 14px;
  font-weight: 500; /* Slightly bolder text */
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease,
    box-shadow 0.3s ease; /* Smooth transitions for hover effects */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
  white-space: nowrap; /* Prevent text from wrapping inside the button */
}

.command-btn:hover {
  background-color: #0056b3; /* Darker blue on hover */
  transform: translateY(-1px); /* Slight lift effect */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* More pronounced shadow on hover */
}

.command-btn:active {
  background-color: #004085; /* Even darker on click */
  transform: translateY(0); /* Press-down effect */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); /* Smaller shadow on click */
}

/* You might want to adjust how these buttons look within the bot message,
   especially if the bot message background changes. */
.bot-message .command-buttons-container {
  /* No specific styles needed here, as the .command-btn handles it */
}
