/* Floating Action Button - Modern Design */
.floating-action-menu {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9998;
}

/* Main FAB Button */
.fab-main {
  position: relative;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 25px rgba(var(--primary-color-rgb), 0.5);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 10;
}

.fab-main:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 8px 30px rgba(var(--primary-color-rgb), 0.7);
}

.fab-main.active {
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

.fab-main i {
  color: white;
  font-size: 28px;
  transition: transform 0.3s ease;
}

/* Sub Menu Items */
.fab-menu {
  position: absolute;
  bottom: 75px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.fab-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Individual Menu Items */
.fab-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  animation: fadeInUp 0.3s ease forwards;
  opacity: 0;
}

.fab-menu.active .fab-item:nth-child(1) {
  animation-delay: 0.05s;
}

.fab-menu.active .fab-item:nth-child(2) {
  animation-delay: 0.1s;
}

.fab-menu.active .fab-item:nth-child(3) {
  animation-delay: 0.15s;
}

.fab-label {
  background: white;
  color: #333;
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.fab-item:hover .fab-label {
  opacity: 1;
  transform: translateX(0);
}

.fab-button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
}

.fab-button:hover {
  transform: scale(1.15);
}

.fab-button i {
  color: white;
  font-size: 24px;
}

/* WhatsApp Button */
.fab-whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.fab-whatsapp:hover {
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

/* Chatbot Button */
.fab-chatbot {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.fab-chatbot:hover {
  box-shadow: 0 6px 20px rgba(var(--primary-color-rgb), 0.5);
}

/* Back to Top Button */
.fab-scroll-top {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

.fab-scroll-top:hover {
  box-shadow: 0 6px 20px rgba(var(--secondary-color-rgb), 0.5);
}

/* Notification Badge */
.fab-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ff4757;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  border: 2px solid white;
  animation: pulse-badge 1.5s infinite;
}

/* Chatbot Widget */
.chatbot-widget {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 380px;
  height: 550px;
  min-width: 300px;
  min-height: 400px;
  max-width: 600px;
  max-height: 800px;
  background: white;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9997;
  animation: slideUpFade 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  resize: both;
}

/* Resize Handle */
.chatbot-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, var(--primary-color) 50%);
  border-bottom-right-radius: 24px;
  z-index: 10;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.chatbot-resize-handle:hover {
  opacity: 1;
}

.chatbot-resize-handle::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}

/* Chatbot Size Controls */
.chatbot-size-controls {
  display: flex;
  gap: 8px;
  margin-right: 10px;
}

.chatbot-size-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
}

.chatbot-size-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Chatbot Expanded State */
.chatbot-widget.expanded {
  width: 500px !important;
  height: 650px !important;
}

.chatbot-widget.minimized {
  width: 300px !important;
  height: 450px !important;
}

.chatbot-widget.active {
  display: flex;
}

.chatbot-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chatbot-avatar {
  width: 42px;
  height: 42px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-size: 20px;
}

.chatbot-title h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.chatbot-status {
  font-size: 13px;
  opacity: 0.95;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

.chatbot-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

.chatbot-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
}

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

.chatbot-body::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chatbot-body::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.chatbot-message {
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  animation: messageSlide 0.3s ease;
}

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

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

.message-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}

.message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chatbot-message.bot .message-content {
  background: white;
  color: #333;
  border-bottom-left-radius: 4px;
  font-size: 14px;
  line-height: 1.6;
}

/* Styling untuk HTML elements di bot message */
.chatbot-message.bot .message-content strong {
  font-weight: 600;
  color: #2563eb;
}

.chatbot-message.bot .message-content em {
  font-style: italic;
  color: #666;
}

.chatbot-message.bot .message-content ul {
  margin: 8px 0;
  padding-left: 20px;
  list-style: none;
}

.chatbot-message.bot .message-content ul li {
  margin: 4px 0;
  position: relative;
}

.chatbot-message.bot .message-content ul li::before {
  content: "•";
  color: var(--primary-color);
  font-weight: bold;
  position: absolute;
  left: -15px;
}

.chatbot-message.user .message-content {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  animation: fadeIn 0.5s ease;
}

.quick-reply-btn {
  background: white;
  border: 2px solid #e0e0e0;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.quick-reply-btn:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}

.chatbot-footer {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e8e8e8;
}

.chatbot-input-container {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #f5f5f5;
  padding: 6px;
  border-radius: 28px;
  transition: all 0.3s ease;
}

.chatbot-input-container:focus-within {
  background: #ebebeb;
  box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.chatbot-input {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
}

.chatbot-send-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.4);
}

.chatbot-send-btn:active {
  transform: scale(0.95);
}

/* Message Time */
.message-time {
  display: block;
  font-size: 11px;
  opacity: 0.6;
  margin-top: 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

/* Chatbot Actions */
.chatbot-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.action-link {
  background: none;
  border: none;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}

.action-link:hover {
  color: #ff4757;
}

/* Error Message */
.error-message {
  background: #ff6b6b !important;
  color: white !important;
}

/* Message Action Buttons */
.message-actions {
  display: flex;
  gap: 8px;
  margin: 10px 0 4px 0;
  flex-wrap: wrap;
}

.chatbot-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.chatbot-action-btn.whatsapp-btn {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.chatbot-action-btn.whatsapp-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.5);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(255, 71, 87, 0);
  }
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.8);
  }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
  .floating-action-menu {
    bottom: 20px;
    right: 20px;
  }

  .fab-main {
    width: 56px;
    height: 56px;
  }

  .fab-main i {
    font-size: 26px;
  }

  .fab-button {
    width: 48px;
    height: 48px;
  }

  .fab-button i {
    font-size: 22px;
  }

  .fab-label {
    display: none;
  }

  .chatbot-widget {
    width: calc(100vw - 40px);
    height: calc(100vh - 140px);
    bottom: 90px;
    right: 20px;
    border-radius: 20px;
  }
}

@media screen and (max-width: 480px) {
  .floating-action-menu {
    bottom: 15px;
    right: 15px;
  }

  .fab-main {
    width: 52px;
    height: 52px;
  }

  .fab-main i {
    font-size: 24px;
  }

  .fab-button {
    width: 46px;
    height: 46px;
  }

  .fab-button i {
    font-size: 20px;
  }

  .chatbot-widget {
    width: 100vw;
    height: calc(100vh - 70px);
    bottom: 70px;
    right: 0;
    border-radius: 20px 20px 0 0;
  }
}
