/* ========== FLOATING CONTACT BUTTONS ========== */
.floating-contact {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.contact-btn:hover {
  transform: scale(1.15) translateY(-2px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.contact-btn:active {
  transform: scale(1.05);
}

.contact-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.contact-btn .material-symbols-rounded {
  font-size: 24px;
  color: #fff;
}

/* Facebook Button */
.contact-btn.messenger {
  background: linear-gradient(135deg, #1877f2 0%, #42a5f5 50%, #1976d2 100%);
  position: relative;
}

.contact-btn.messenger::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.contact-btn.messenger:hover::before {
  opacity: 1;
}

/* TikTok Button */
.contact-btn.tiktok {
  background: linear-gradient(135deg, #000000 0%, #333333 50%, #000000 100%);
  position: relative;
}

.contact-btn.tiktok .tiktok-logo {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-btn.tiktok .tiktok-svg {
  width: 24px;
  height: 24px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Lớp màu đỏ - lệch sang phải và lên trên */
.contact-btn.tiktok .tiktok-red {
  transform: translate(calc(-50% + 0.8px), calc(-50% - 0.8px));
  mix-blend-mode: screen;
  opacity: 0.9;
}

/* Lớp màu trắng - ở giữa */
.contact-btn.tiktok .tiktok-white {
  transform: translate(-50%, -50%);
  z-index: 1;
}

/* Lớp màu xanh ngọc - lệch sang trái và xuống dưới */
.contact-btn.tiktok .tiktok-cyan {
  transform: translate(calc(-50% - 0.8px), calc(-50% + 0.8px));
  mix-blend-mode: screen;
  opacity: 0.9;
}

.contact-btn.tiktok::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.contact-btn.tiktok:hover {
  background: linear-gradient(135deg, #333333 0%, #000000 50%, #333333 100%);
}

.contact-btn.tiktok:hover::before {
  opacity: 1;
}

/* ChatGPT Button */
.contact-btn.chatbot {
  background: linear-gradient(135deg, #2f6f44 0%, #10a37f 50%, #1a7f64 100%);
  position: relative;
}

.contact-btn.chatbot::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.contact-btn.chatbot:hover::before {
  opacity: 1;
}

/* Tooltip */
.contact-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.contact-btn::before {
  content: '';
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-left-color: rgba(0, 0, 0, 0.9);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.contact-btn:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(-5px);
}

.contact-btn:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(-5px);
}

/* ========== CHATBOT POPUP ========== */
.chatbot-popup {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 380px;
  height: 520px;
  background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(47, 111, 68, 0.15), 0 0 0 1px rgba(47, 111, 68, 0.1);
  z-index: 1001;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(47, 111, 68, 0.1);
}

.chatbot-popup.show {
  display: flex;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Typing indicator animation */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
  border-radius: 20px;
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(47, 111, 68, 0.1);
  max-width: 80px;
  margin-bottom: 1.25rem;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: rgba(47, 111, 68, 0.6);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #2f6f44 0%, #10a37f 50%, #1a7f64 100%);
  color: #fff;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 20px 20px 0 0;
  position: relative;
  overflow: hidden;
}

.chat-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  pointer-events: none;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.chat-header .material-symbols-rounded {
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  z-index: 1;
  padding: 4px;
  border-radius: 50%;
}

.chat-header .material-symbols-rounded:hover {
  transform: scale(1.15) rotate(90deg);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Chat Body */
.chat-body {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
  position: relative;
}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-track {
  background: rgba(47, 111, 68, 0.1);
  border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb {
  background: rgba(47, 111, 68, 0.3);
  border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
  background: rgba(47, 111, 68, 0.5);
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  animation: messageSlide 0.3s ease-out;
}

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

.bot-message {
  justify-content: flex-start;
}

.user-message {
  justify-content: flex-end;
}

.message-text {
  max-width: 80%;
  padding: 0.875rem 1.125rem;
  border-radius: 20px;
  font-size: 0.9rem;
  line-height: 1.5;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.message-text:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bot-message .message-text {
  background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
  color: #2d4a2d;
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(47, 111, 68, 0.1);
}

.user-message .message-text {
  background: linear-gradient(135deg, #2f6f44 0%, #10a37f 100%);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(47, 111, 68, 0.2);
}

/* Chat Footer */
.chat-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(47, 111, 68, 0.1);
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 0 0 20px 20px;
  position: relative;
}

.chat-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(47, 111, 68, 0.2) 50%, transparent 100%);
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-input {
  width: 100%;
  border: 2px solid rgba(47, 111, 68, 0.2);
  border-radius: 25px;
  padding: 0.875rem 1.125rem;
  font-size: 0.9rem;
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(47, 111, 68, 0.1);
}

.message-input:focus {
  border-color: #2f6f44;
  box-shadow: 0 4px 16px rgba(47, 111, 68, 0.2), 0 0 0 3px rgba(47, 111, 68, 0.1);
  transform: translateY(-1px);
}

.message-input::placeholder {
  color: rgba(47, 111, 68, 0.6);
  font-weight: 500;
}

.chat-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
}

.chat-controls button {
  width: 40px;
  height: 40px;
  border: none;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: rgba(47, 111, 68, 0.7);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 2px 8px rgba(47, 111, 68, 0.1);
  border: 1px solid rgba(47, 111, 68, 0.1);
}

.chat-controls button:hover {
  background: linear-gradient(135deg, #2f6f44 0%, #10a37f 100%);
  color: #fff;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(47, 111, 68, 0.3);
}

.chat-controls button:active {
  transform: translateY(0) scale(0.95);
}

#send-message {
  background: linear-gradient(135deg, #2f6f44 0%, #10a37f 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(47, 111, 68, 0.3);
}

#send-message:hover {
  background: linear-gradient(135deg, #1f4f2f 0%, #0d7a5f 100%);
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 8px 25px rgba(47, 111, 68, 0.4);
}

.file-upload-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-upload-wrapper img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 767.98px) {
  .floating-contact {
    bottom: 15px;
    right: 15px;
    gap: 12px;
  }

  .contact-btn {
    width: 52px;
    height: 52px;
  }

  .contact-btn img {
    width: 100%;
    height: 100%;
  }

  .contact-btn .material-symbols-rounded {
    font-size: 22px;
  }

  .contact-btn::after {
    right: 60px;
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  .chatbot-popup {
    width: 90vw;
    height: 75vh;
    bottom: 80px;
    right: 5vw;
    border-radius: 16px;
  }

  .chat-header {
    padding: 1rem;
    border-radius: 16px 16px 0 0;
  }

  .logo-text {
    font-size: 1.1rem;
  }

  .chat-body {
    padding: 1rem;
  }

  .chat-footer {
    padding: 1rem;
    border-radius: 0 0 16px 16px;
  }

  .message-input {
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 20px;
  }

  .chat-controls button {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 480px) {
  .floating-contact {
    bottom: 10px;
    right: 10px;
  }

  .contact-btn {
    width: 48px;
    height: 48px;
  }

  .chatbot-popup {
    width: 95vw;
    height: 65vh;
    right: 2.5vw;
    border-radius: 12px;
  }
}

/* ========== ANIMATIONS ========== */
.contact-btn {
  animation: float 4s ease-in-out infinite;
}

.contact-btn.tiktok {
  animation-delay: 0.8s;
}

.contact-btn.chatbot {
  animation-delay: 1.6s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-8px) rotate(1deg);
  }
  50% {
    transform: translateY(-12px) rotate(0deg);
  }
  75% {
    transform: translateY(-8px) rotate(-1deg);
  }
}

.contact-btn:hover {
  animation: none;
}

/* Pulse animation for chatbot */
.contact-btn.chatbot {
  animation: float 4s ease-in-out infinite, pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(47, 111, 68, 0.15);
  }
  50% {
    box-shadow: 0 8px 25px rgba(47, 111, 68, 0.3), 0 0 0 8px rgba(47, 111, 68, 0.1);
  }
}
