
/* Floating Icon - Moved to TOP right */
#chatbot-toggle {
  position: fixed;
  bottom: 100px; /* Moved from bottom to top */
  right: 24px;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  border-radius: 50%;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000; /* Higher z-index */
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

#chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

/* Chatbot Modal - Fixed positioning and overlay */
#chatbot-modal {
  width: 700px;
  height: 700px;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  position: fixed;
  top: 110px; /* Below the toggle button */
  right: 38px;
  transform: translateX(120%); /* Hidden to the right */
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 10001; /* Higher than toggle */
  opacity: 0;
}

/* Open State */
#chatbot-modal.open {
  transform: translateX(0);
  opacity: 1;
}

/* Overlay for modal background */
#chatbot-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999; /* Below modal but above everything else */
  display: none;
  backdrop-filter: blur(3px);
}

#chatbot-overlay.active {
  display: block;
}

/* Close Button */
#chatbot-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chatbot-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Iframe */
#chatbot-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Mobile */
@media (max-width: 768px) {
  #chatbot-toggle {
    top: auto;
    bottom: 24px;
    right: 24px;
  }
  
  #chatbot-modal {
    width: 100vw;
    height: 60vh;
    top: auto;
    bottom: 0;
    right: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  
  #chatbot-modal.open {
    transform: translateY(0);
    bottom: 100px;
  }
}

/* Desktop specific fixes */
@media (min-width: 769px) {
  /* Make sure chatbot doesn't cover footer */
  #chatbot-modal {
    max-height: 70vh;
    overflow: hidden;
  }
  
  /* Ensure footer links are clickable */
  .footer-links a {
    position: relative;
    z-index: 100;
  }
}

/* Chatbot when modal is open - prevent covering footer */
#chatbot-modal.open + .footer,
#chatbot-modal.open ~ .footer {
  position: relative;
  z-index: 1;
}