/* AI Chat Widget Styles */

/* Chat Button — mirrors scroll-to-top: same size, same bottom offset, right side */
.ai-chat-btn {
  position: fixed;
  right: 3vw;
  bottom: 3vw;
  width: 3.2vw;
  height: 3.2vw;
  border-radius: 50%;
  background-color: var(--ai-chat-primary, #31B939);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(49, 185, 57, 0.3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M20 2H4C2.9 2 2 2.9 2 4v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 55%;
}

.ai-chat-btn:hover {
  background-color: var(--ai-chat-primary-dark, #279e2f);
  transform: scale(1.1);
}

/* Chat Widget Container */
.ai-chat-widget {
  position: fixed;
  right: 3vw;
  bottom: 7.5vw;
  width: 25vw;
  max-height: 31.25vw;
  background: #fff;
  border-radius: 1.0416666667vw;
  box-shadow: 0 0.5208333333vw 2.0833333333vw rgba(0, 0, 0, 0.15);
  z-index: 49;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.ai-chat-widget.active {
  display: flex;
}

/* Chat Header */
.ai-chat-header {
  padding: 1.0416666667vw 1.5625vw;
  background-color: var(--ai-chat-primary, #31B939);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-title {
  font-size: 1.0416666667vw;
  font-weight: 600;
  margin: 0;
}

.ai-chat-close {
  cursor: pointer;
  font-size: 1.5625vw;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  padding: 0;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.ai-chat-close:hover {
  opacity: 1;
}

/* Chat Messages Container */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5625vw 1.0416666667vw 1.0416666667vw 1.0416666667vw;
  background: #f8fafb;
}

.ai-chat-message {
  margin-bottom: 0.78125vw;
  display: flex;
  flex-direction: column;
}

.ai-chat-message.user {
  align-items: flex-end;
}

.ai-chat-message.bot {
  align-items: flex-start;
}

.ai-chat-message-content {
  max-width: 80%;
  padding: 0.625vw 0.9375vw;
  border-radius: 0.625vw;
  font-size: 0.8333333333vw;
  line-height: 1.25vw;
}

.ai-chat-message.user .ai-chat-message-content {
  background-color: var(--ai-chat-primary, #31B939);
  color: #fff;
}

.ai-chat-message.bot .ai-chat-message-content {
  background-color: #e5e5e5;
  color: #333;
}

.ai-chat-message-time {
  font-size: 0.625vw;
  color: #999;
  margin-top: 0.2604166667vw;
}

/* Contact Form in Chat */
.ai-chat-contact-form {
  padding: 1.5625vw;
  background: linear-gradient(135deg, #f8fdf9 0%, #ffffff 100%);
  border: 2px solid var(--ai-chat-primary, #31B939);
  border-radius: 0.7291666667vw;
  box-shadow: 0 0.2604166667vw 1.0416666667vw rgba(49, 185, 57, 0.2);
  margin-top: 0.5208333333vw;
}

.ai-chat-contact-form p {
  font-size: 0.9375vw;
  color: #333;
  margin: 0 0 1.0416666667vw 0;
  font-weight: 600;
  line-height: 1.4;
}

.ai-chat-contact-input {
  width: 100%;
  padding: 0.9375vw 1.0416666667vw;
  border: 2px solid #e0e0e0;
  border-radius: 0.5208333333vw;
  font-size: 0.9375vw;
  margin-bottom: 0.9375vw;
  background: #fff;
  transition: all 0.3s ease;
  font-family: inherit;
  color: #333;
  box-sizing: border-box;
}

.ai-chat-contact-input:focus {
  border-color: var(--ai-chat-primary, #31B939);
  outline: none;
  box-shadow: 0 0 0 3px rgba(49, 185, 57, 0.1);
}

.ai-chat-contact-input::placeholder {
  color: #999;
  font-size: 0.8333333333vw;
}

.ai-chat-contact-submit {
  width: 100%;
  padding: 1.0416666667vw;
  background-color: var(--ai-chat-primary, #31B939);
  color: #fff;
  border: none;
  border-radius: 0.5208333333vw;
  font-size: 0.9375vw;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ai-chat-contact-submit:hover {
  background-color: var(--ai-chat-primary-dark, #279e2f);
  transform: translateY(-2px);
  box-shadow: 0 0.3125vw 0.7291666667vw rgba(49, 185, 57, 0.3);
}

.ai-chat-contact-submit:active {
  transform: translateY(0);
}

/* Chat Input */
.ai-chat-input-wrapper {
  padding: 0.78125vw 1.0416666667vw;
  background: #fff;
  border-top: 1px solid #e5e5e5;
  display: flex;
  gap: 0.625vw;
}

.ai-chat-input {
  flex: 1;
  padding: 0.625vw;
  border: 1px solid #ddd;
  border-radius: 0.3125vw;
  font-size: 0.8333333333vw;
  font-family: inherit;
  outline: none;
}

.ai-chat-input:focus {
  border-color: var(--ai-chat-primary, #31B939);
}

.ai-chat-send {
  padding: 0.625vw 1.0416666667vw;
  background-color: var(--ai-chat-primary, #31B939);
  color: #fff;
  border: none;
  border-radius: 0.3125vw;
  cursor: pointer;
  transition: background-color 0.3s;
  font-weight: 600;
}

.ai-chat-send:hover {
  background-color: var(--ai-chat-primary-dark, #279e2f);
}

.ai-chat-send:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* Typing indicator */
.ai-chat-typing {
  display: none;
  padding: 0.625vw 0.9375vw;
  background-color: #e5e5e5;
  border-radius: 0.625vw;
  max-width: fit-content;
}

.ai-chat-typing.active {
  display: block;
}

.ai-chat-typing span {
  display: inline-block;
  width: 0.4166666667vw;
  height: 0.4166666667vw;
  background-color: #666;
  border-radius: 50%;
  margin-right: 0.2604166667vw;
  animation: typing 1.4s infinite;
}

.ai-chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-chat-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-0.2604166667vw);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .ai-chat-btn {
    width: 8vw;
    height: 8vw;
    right: 5vw;
    bottom: 5vw;
  }

  .ai-chat-btn svg {
    width: 4vw;
    height: 4vw;
  }

  .ai-chat-widget {
    right: 5vw;
    left: 5vw;
    bottom: 18vw;
    width: auto;
    max-height: 75vh;
  }

  .ai-chat-title {
    font-size: 4.375vw;
  }

  .ai-chat-close {
    font-size: 6.25vw;
  }

  .ai-chat-message-content {
    font-size: 3.75vw;
    line-height: 5vw;
    padding: 2.5vw 3.75vw;
  }

  .ai-chat-message-time {
    font-size: 3.125vw;
  }

  .ai-chat-contact-form {
    padding: 4vw;
  }

  .ai-chat-contact-form p {
    font-size: 4vw;
    margin-bottom: 3vw;
  }

  .ai-chat-contact-input {
    font-size: 4vw;
    padding: 3.5vw 4vw;
    margin-bottom: 3vw;
    border-width: 2px;
  }

  .ai-chat-contact-input::placeholder {
    font-size: 3.5vw;
  }

  .ai-chat-contact-submit {
    font-size: 4.5vw;
    padding: 3.5vw;
    font-weight: 700;
  }

  .ai-chat-input {
    font-size: 3.75vw;
    padding: 2.5vw;
  }

  .ai-chat-send {
    font-size: 3.75vw;
    padding: 2.5vw;
  }

  .ai-chat-typing span {
    width: 2vw;
    height: 2vw;
  }
}
