/* Cool Craftz AI Chatbot */

.fab-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 72px;
  height: 72px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 40, 85, 0.45);
  z-index: 200;
  padding: 8px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  font-family: inherit;
}

.fab-chatbot i {
  font-size: 22px;
}

.fab-chatbot:hover,
.fab-chatbot[aria-expanded="true"] {
  background: var(--red);
  transform: scale(1.05);
}

.fab-chatbot[aria-expanded="true"] {
  box-shadow: 0 4px 24px rgba(196, 18, 48, 0.5);
}

.chatbot-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 26, 61, 0.45);
  z-index: 210;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.chatbot-overlay.open {
  opacity: 1;
  visibility: visible;
}

.chatbot-panel {
  position: fixed;
  bottom: 108px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 40, 85, 0.22);
  z-index: 220;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.28s, visibility 0.28s, transform 0.28s;
}

.chatbot-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chatbot-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: var(--white);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chatbot-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.chatbot-header-text {
  flex: 1;
  min-width: 0;
}

.chatbot-header-text h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.chatbot-header-text p {
  font-size: 12px;
  margin: 2px 0 0;
  opacity: 0.85;
}

.chatbot-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chatbot-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
}

.chatbot-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--white);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chatbot-msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  animation: chatbotMsgIn 0.3s ease;
}

@keyframes chatbotMsgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chatbot-msg.bot {
  align-self: flex-start;
  background: var(--white);
  color: #334155;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chatbot-msg.user {
  align-self: flex-end;
  background: var(--red);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.chatbot-msg.typing {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid #e2e8f0;
  padding: 14px 18px;
}

.chatbot-typing-dots {
  display: flex;
  gap: 5px;
}

.chatbot-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--navy);
  opacity: 0.4;
  animation: chatbotDot 1.2s infinite;
}

.chatbot-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.chatbot-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chatbotDot {
  0%, 60%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.chatbot-footer {
  flex-shrink: 0;
  background: var(--white);
  border-top: 1px solid #e2e8f0;
  padding: 12px 0 14px;
}

.chatbot-suggestions-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-text);
  padding: 0 16px 8px;
}

.chatbot-suggestions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.chatbot-suggestions::-webkit-scrollbar {
  height: 5px;
}

.chatbot-suggestions::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chatbot-suggestion {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  font-family: inherit;
}

.chatbot-suggestion:hover {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.chatbot-input-row {
  display: flex;
  gap: 8px;
  padding: 0 14px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 12px 18px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chatbot-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0, 40, 85, 0.12);
}

.chatbot-input::placeholder {
  color: #94a3b8;
}

.chatbot-send {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.chatbot-send:hover {
  background: var(--red-hover);
  transform: scale(1.05);
}

.chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 480px) {
  .chatbot-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 85vh;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
  }

  .fab-chatbot {
    bottom: 16px;
    right: 16px;
  }
}
