/* ===== AI Chat Widget - Simple & Light ===== */

/* Floating Button */
.ai-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #2d8a4e;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

.ai-fab-icon {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-fab-icon img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.ai-fab-close {
  display: none;
  color: #fff;
  font-size: 1.2rem;
}
.ai-fab.active .ai-fab-icon {
  display: none;
}
.ai-fab.active .ai-fab-close {
  display: block;
}

/* Chat Box */
.ai-chat-box {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 320px;
  height: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-box.active {
  display: flex;
}

/* Header */
.ai-chat-header {
  background: #2d8a4e;
  color: #fff;
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chat-title span {
  font-size: 1.2rem;
}
.ai-chat-title strong {
  font-size: 0.95rem;
}
.ai-chat-title small {
  display: none;
}

.ai-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
}

/* Messages */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f5f5f5;
}

.ai-message {
  max-width: 85%;
}

.ai-message p {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0;
  word-wrap: break-word;
}

.ai-message.ai-user {
  align-self: flex-end;
}

.ai-message.ai-user p {
  background: #2d8a4e;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-message.ai-bot {
  align-self: flex-start;
}

.ai-message.ai-bot p {
  background: #fff;
  color: #333;
  border-bottom-left-radius: 4px;
}

/* Typing */
.ai-typing p {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.ai-typing .dot {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: typing 1s infinite;
}

.ai-typing .dot:nth-child(2) {
  animation-delay: 0.15s;
}
.ai-typing .dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* Input */
.ai-chat-input {
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.ai-chat-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 0.88rem;
  outline: none;
}

.ai-chat-input input:focus {
  border-color: #2d8a4e;
}

.ai-chat-input button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2d8a4e;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Dark Mode */
[data-theme="dark"] .ai-chat-box {
  background: #111;
}
[data-theme="dark"] .ai-chat-messages {
  background: #0a0a0a;
}
[data-theme="dark"] .ai-message.ai-bot p {
  background: #1a1a1a;
  color: #ddd;
}
[data-theme="dark"] .ai-chat-input {
  background: #111;
  border-top-color: #222;
}
[data-theme="dark"] .ai-chat-input input {
  background: #1a1a1a;
  border-color: #333;
  color: #fff;
}

/* Mobile */
@media (max-width: 500px) {
  .ai-fab {
    bottom: 15px;
    right: 15px;
    width: 48px;
    height: 48px;
  }

  .ai-chat-box {
    bottom: 70px;
    right: 10px;
    left: 10px;
    width: auto;
    height: 55vh;
    max-height: 400px;
  }
}
