.ai-assistant {
  position: fixed;
  z-index: 999999;
  bottom: 20px;
  right: 17px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  display: none;
}

.ai-assistant .chat-toggle {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #38733c 0%, #78ac42 100%);
  color: white;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-assistant .chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.ai-assistant .chat-toggle .icon-container {
  position: relative;
  z-index: 2;
}

.ai-assistant .chat-toggle .chat-icon,
.ai-assistant .chat-toggle .close-icon {
  width: 24px;
  height: 24px;
  transition: all 0.3s ease;
}

.ai-assistant .chat-toggle .pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border: 1.5px solid #38733c;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  opacity: 0.8;
}

.ai-assistant .chat-toggle.active .pulse-ring {
  display: none;
}

.ai-assistant .chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 480px;
  height: 600px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-assistant .chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

.ai-assistant .chat-header {
  background: linear-gradient(135deg, #38733c 0%, #78ac42 100%);
  color: white;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-assistant .header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-assistant .avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-assistant .avatar svg {
  width: 20px;
  height: 20px;
}

.ai-assistant .header-text h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.ai-assistant .header-text p {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
}

.ai-assistant .messages-counter {
  text-align: right;
}

.ai-assistant .counter-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 15px;
  border-radius: 15px;
  font-size: 11px;
  font-weight: 500;
  display: inline-block;
}

.ai-assistant .counter-badge.warning {
  background: rgba(255, 193, 7, 0.8);
}

.ai-assistant .counter-badge.danger {
  background: rgba(234, 34, 54, 0.8);
}

.ai-assistant .reset-time {
  font-size: 10px;
  opacity: 0.8;
  margin-top: 2px;
  display: block;
}

.ai-assistant .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-assistant .chat-messages::-webkit-scrollbar {
  width: 4px;
}

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

.ai-assistant .chat-messages::-webkit-scrollbar-thumb {
  background: #38733c;
  border-radius: 2px;
}

.ai-assistant .default-questions .questions-title {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
  font-weight: 500;
}

.ai-assistant .question-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  font-size: 13.5px;
  color: #333;
  cursor: pointer;
  transition: all 0.5s ease-in-out;
  position: relative;
  overflow: hidden;
}

.ai-assistant .question-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
  transition: left 0.5s ease-in-out;
}

.ai-assistant .question-btn:hover {
  color: #38733c;
  border-color: #38733c;
  transform: translateY(-2px);
  background: rgba(102, 126, 234, 0.1);
  box-shadow: 0 8px 25px rgba(5, 127, 44, 0.216);
}

.ai-assistant .question-btn:hover::before {
  left: 100%;
}

.ai-assistant .message {
  display: flex;
  margin-bottom: 16px;
}


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

.ai-assistant .message.user .message-content {
  background: #38733c;
  color: white;
  border-radius: 18px 18px 4px 18px;
}

.ai-assistant .message.assistant {
  justify-content: flex-start;
}

.ai-assistant .message.assistant .message-content {
  background: #f1f3f4;
  color: #333;
  border-radius: 18px 18px 18px 4px;
}

.ai-assistant .message-content {
  max-width: 80%;
  padding: 12px 16px;
  word-wrap: break-word;
}

.ai-assistant .timestamp {
  font-size: 11.5px;
  opacity: 0.7;
  display: block;
  margin-top: 8px;
}

.ai-assistant .typing-indicator {
  display: flex;
  gap: 4px;
  padding: 7px 0;
}

.ai-assistant .typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #999;
  animation: typing 1.4s infinite ease-in-out;
}

.ai-assistant .typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.ai-assistant .typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

.ai-assistant .chat-input {
  border-top: 1px solid #e9ecef;
  padding: 16px 20px;
}

.ai-assistant .input-container {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.ai-assistant .input-container textarea {
  color: black;
  flex: 1;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14px;
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.ai-assistant .input-container textarea:focus {
  border-color: #38733c;
}

.ai-assistant .input-container textarea::placeholder {
  color: #999;
}

.ai-assistant .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #38733c;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ai-assistant .send-btn:hover:not(:disabled) {
  background: #78ac42;
  transform: scale(1.05);
}

.ai-assistant .send-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.ai-assistant .send-btn svg {
  width: 18px;
  height: 18px;
}

.ai-assistant .input-hint {
  font-size: 11px;
  color: #ff0000;
  font-weight: bold;
  margin: 10px 0 0 0;
  text-align: center;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.13);
    opacity: 0.3;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

@media (max-width: 480px) {
  .ai-assistant .chat-window {
    width: calc(100vw - 35px);
    height: 70vh;
    bottom: 70px;
  }
}

/* Formatted Content Styles */
.ai-assistant .formatted-content {
  font-size: 14px;
  line-height: 1.6;
}

.ai-assistant .formatted-content h2 {
  font-size: 17px;
}

.ai-assistant .formatted-content h3,
.ai-assistant .formatted-content h4 {
  margin: 8px 0 8px 0;
  font-weight: 600;
  position: relative;
  animation: slideInFromLeft 0.5s ease-out;
}

.ai-assistant .formatted-content h3::after,
.ai-assistant .formatted-content h4::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #38733c, #78ac42);
  animation: expandLine 0.8s ease-out 0.3s forwards;
}

.ai-assistant .formatted-content h3 {
  font-size: 16px;
}

.ai-assistant .formatted-content h4 {
  font-size: 15px;
}

.ai-assistant .formatted-content img {
  width: 100%;
  margin: 10px 0px;
  border: 2px dotted #38733c;
  border-radius: 8px;
}

.ai-assistant .formatted-content img:hover {
  border: 2px solid #38733c;
}

.ai-assistant .formatted-content p {
  animation: fadeInUp 0.6s ease-out;
}

.ai-assistant .formatted-content p:last-child {
  margin-bottom: 0;
}

.ai-assistant .formatted-content ul {
  margin: 8px 0;
  padding: 0;
  list-style: none;
  position: relative;
}

.ai-assistant .formatted-content ul::before {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #38733c, #78ac42);
  border-radius: 1px;
  opacity: 0.3;
}

.ai-assistant .formatted-content ul li {
  margin-bottom: 8px;
  padding-left: 24px;
  position: relative;
  animation: slideInFromLeft 0.5s ease-out;
  transition: all 0.3s ease;
}

.ai-assistant .formatted-content ul li:hover {
  transform: translateY(4px);
  color: #38733c;
}

.ai-assistant .formatted-content ul li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  width: 6px;
  height: 6px;
  background: #38733c;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
  animation: pulse 2s infinite;
}

.ai-assistant .formatted-content ul ul {
  margin: 8px 0 8px 0;
}

.ai-assistant .formatted-content ul ul::before {
  left: 4px;
  background: linear-gradient(180deg, #38733c, #78ac42);
}

.ai-assistant .formatted-content ul ul li::before {
  background: #78ac42;
  width: 4px;
  height: 4px;
  left: 5px;
}

.ai-assistant .formatted-content ol {
  margin: 12px 0;
  padding-left: 0;
  counter-reset: custom-counter;
}

.ai-assistant .formatted-content ol li {
  margin-bottom: 8px;
  padding-left: 32px;
  position: relative;
  counter-increment: custom-counter;
  animation: slideInFromLeft 0.5s ease-out;
}

.ai-assistant .formatted-content ol li::before {
  content: counter(custom-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #38733c, #78ac42);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.ai-assistant .formatted-content strong {
  font-weight: 600;
  position: relative;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.3s ease;
  color: #38733c;
}

.ai-assistant .formatted-content strong:hover {
  transform: scale(1.02);
}

.ai-assistant .formatted-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  animation: fadeInUp 0.6s ease-out;
}

.ai-assistant .formatted-content table th {
  background: linear-gradient(135deg, #38733c, #78ac42);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-assistant .formatted-content table th:first-child {
  border-top-left-radius: 12px;
}

.ai-assistant .formatted-content table th:last-child {
  border-top-right-radius: 12px;
}

.ai-assistant .formatted-content table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.3s ease;
}

.ai-assistant .formatted-content table td:hover {
  background: rgba(102, 126, 234, 0.05);
}

.ai-assistant .formatted-content table tr:last-child td {
  border-bottom: none;
}

.ai-assistant .formatted-content table tr:nth-child(even) {
  background: rgba(102, 126, 234, 0.02);
}

.ai-assistant .formatted-content table tr:hover {
  background: rgba(102, 126, 234, 0.08);
  transform: scale(1.01);
}

.ai-assistant .formatted-content code {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  color: #38733c;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 13px;
  border: 1px solid rgba(102, 126, 234, 0.2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-assistant .formatted-content pre {
  background: linear-gradient(135deg, #2d3748, #1a202c);
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  border-left: 4px solid #38733c;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ai-assistant .formatted-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  border: none;
  box-shadow: none;
}

.ai-assistant .formatted-content blockquote {
  margin: 16px 0;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.1));
  border-left: 4px solid #38733c;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  position: relative;
}

.ai-assistant .formatted-content blockquote::before {
  content: '"';
  position: absolute;
  top: -5px;
  left: 10px;
  font-size: 40px;
  color: #38733c;
  opacity: 0.3;
}

.ai-assistant .formatted-content a {
  color: #38733c;
  text-decoration: none;
  position: relative;
  transition: all 0.3s ease;
  font-weight: bold;
}

.ai-assistant .formatted-content a:hover {
  text-decoration: underline;
  color: #78ac42;
}

.ai-assistant .welcome-message {
  border-radius: 8px;
  padding: 17px;
  border-left: 4px solid #38733c;
  position: relative;
  animation: slideInFromTop 0.6s ease-out;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.ai-assistant .welcome-message h3 {
  margin-bottom: 12px !important;
  color: #38733c !important;
}

.ai-assistant .welcome-message h3::after {
  display: none;
}

.ai-assistant .welcome-message p {
  margin-bottom: 8px;
  color: #555;
}

.ai-assistant .error-message {
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid #dc3545;
  animation: shake 0.5s ease-out;
  background: rgba(220, 53, 69, 0.05);
}

.ai-assistant .error-message h4 {
  color: #dc3545 !important;
  margin-bottom: 8px !important;
}

.ai-assistant .error-message h4::after {
  background: #dc3545;
}

.ai-assistant .product-recommendation {
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
  border-radius: 10px;
  border: 1px solid #e9ecef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.ai-assistant .product-recommendation:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.ai-assistant .product-recommendation h4 {
  color: #38733c !important;
  border-bottom: 2px solid rgba(102, 126, 234, 0.2);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.ai-assistant .product-recommendation img {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 8px;
  margin: 10px 0;
}

.ai-assistant .product-price {
  font-size: 18px;
  font-weight: bold;
  color: #78ac42;
  margin: 10px 0;
}

.ai-assistant .product-link {
  display: inline-block;
  background: linear-gradient(135deg, #38733c, #78ac42);
  color: white !important;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.ai-assistant .product-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  text-decoration: none !important;
  opacity: 0.8;
}

/* Animations */
@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

@keyframes expandLine {
  from {
    width: 0;
  }
  to {
    width: 30px;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}
