/* section */
.chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: chatPulse 2.5s ease-in-out infinite;
}

.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(37, 99, 235, 0.55);
}

.chat-fab.active {
  animation: none;
}

.chat-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4), 0 0 0 12px rgba(37, 99, 235, 0); }
}

.chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 56px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  z-index: 9999;
  box-shadow: 0 12px 48px rgba(15, 23, 42, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.show {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.chat-header {
  background: linear-gradient(135deg, #1a2332, #243245);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-header-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-header-info .status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-header-info .status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

.chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  animation: chatMsgIn 0.25s ease-out;
}

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

.chat-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.chat-msg.visitor {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  text-align: right;
}

.chat-msg.bot .chat-msg-time {
  color: #94a3b8;
}

.chat-msg.visitor .chat-msg-time {
  color: rgba(255, 255, 255, 0.6);
}

.chat-typing {
  align-self: flex-start;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  display: none;
  gap: 4px;
}

.chat-typing.show {
  display: flex;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typingDot 1.4s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
  background: #f8fafc;
  flex-shrink: 0;
}

.chat-quick-btn {
  background: #fff;
  border: 1px solid #2563eb;
  color: #2563eb;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chat-quick-btn:hover {
  background: #2563eb;
  color: #fff;
}

.chat-contact-form {
  padding: 12px 16px;
  background: #f0f4ff;
  border-top: 1px solid #dbeafe;
  flex-shrink: 0;
  display: none;
}

.chat-contact-form.show {
  display: block;
}

.chat-contact-form h4 {
  font-size: 13px;
  font-weight: 600;
  color: #1e40af;
  margin: 0 0 8px;
}

.chat-contact-form input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-contact-form input:focus {
  border-color: #2563eb;
}

.chat-contact-form .btn-submit {
  width: 100%;
  padding: 8px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-contact-form .btn-submit:hover {
  background: #1d4ed8;
}

.chat-input-area {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 80px;
  font-family: inherit;
  transition: border-color 0.2s;
  line-height: 1.5;
}

.chat-input:focus {
  border-color: #2563eb;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
}

.chat-welcome-banner {
  text-align: center;
  padding: 8px 16px;
  background: #eff6ff;
  font-size: 12px;
  color: #1e40af;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .chat-fab {
    bottom: 20px;
    right: 20px;
    width: 52px;
    height: 52px;
    font-size: 22px;
  }
  .chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}
