/**
 * Amdi Group Chatbot Widget Styles
 * Matches existing amdigrp.com visual language
 */

.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--sans, Arial, Helvetica, sans-serif);
}

.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ink, #142d31);
  color: var(--white, #fffef9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(20, 45, 49, 0.25);
  transition: transform 0.2s, background 0.2s;
  position: relative;
}

.chat-toggle:hover {
  transform: scale(1.05);
  background: var(--forest, #143d38);
}

.chat-toggle:focus-visible {
  outline: 3px solid #59811c;
  outline-offset: 3px;
}

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #d6f18b;
  color: var(--ink, #142d31);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: var(--paper, #f4f3ec);
  border: 1px solid var(--line, #ccd2cb);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 45, 49, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: var(--ink, #142d31);
  color: var(--white, #fffef9);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.chat-status {
  font-size: 12px;
  margin: 4px 0 0;
  opacity: 0.75;
}

.chat-close {
  background: transparent;
  border: none;
  color: currentColor;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.chat-close:hover {
  opacity: 1;
}

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

.chat-message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent, #d6f18b);
  color: var(--ink, #142d31);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-bubble {
  background: var(--white, #fffef9);
  color: var(--ink, #142d31);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 75%;
  border: 1px solid var(--line, #ccd2cb);
}

.chat-message.user .chat-bubble {
  background: var(--ink, #142d31);
  color: var(--white, #fffef9);
  border-color: var(--ink, #142d31);
}

.chat-calendly-btn {
  display: inline-block;
  background: var(--accent, #d6f18b);
  color: var(--ink, #142d31);
  padding: 10px 18px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  margin-top: 8px;
  transition: background 0.2s;
}

.chat-calendly-btn:hover {
  background: #c2df6f;
}

.typing-indicator .chat-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
}

.typing-indicator .chat-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted, #546469);
  animation: typing-bounce 1.4s infinite ease-in-out;
}

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

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

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.chat-input-form {
  border-top: 1px solid var(--line, #ccd2cb);
  padding: 16px;
  display: flex;
  gap: 10px;
  background: var(--white, #fffef9);
}

.chat-input {
  flex: 1;
  border: 1px solid var(--line, #ccd2cb);
  border-radius: 4px;
  padding: 12px;
  font-size: 14px;
  background: var(--paper, #f4f3ec);
  color: var(--ink, #142d31);
}

.chat-input:focus {
  outline: 2px solid var(--accent, #d6f18b);
  outline-offset: 0;
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: var(--ink, #142d31);
  color: var(--white, #fffef9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.chat-send:hover {
  background: var(--forest, #143d38);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .chat-widget {
    bottom: 16px;
    right: 16px;
  }

  .chat-toggle {
    width: 56px;
    height: 56px;
  }

  .chat-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
    bottom: 72px;
  }

  .chat-bubble {
    max-width: 85%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-toggle,
  .chat-calendly-btn,
  .chat-send,
  .chat-close {
    transition: none;
  }

  .typing-indicator .chat-bubble span {
    animation: none;
  }
}
