/* Active chatbot menu link */
#openChatbotMenu.active-chatbot {
  color: #007bff;
  font-weight: 600;
  position: relative;
}



/* === Chatbot Button === */
#chatbot-btn, .chatbot-btn {
  position: fixed;
  bottom: 300px;
  right: 25px;
  background: linear-gradient(135deg, #007bff, #004aad);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.25s ease;
  z-index: 10000;

  touch-action: none;

  /* ADD THIS */
  animation: chatbotPulse 2s infinite;
}


#chatbot-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px; /* space between icon and text */
  padding: 0 12px;
  border-radius: 30px; /* slightly pill-shaped */
  width: auto; 
  height: 60px;
  font-size: 22px;
  transition: all 0.3s ease;
}

.send-btn {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}


#chatbot-btn .chat-label {
  font-size: 16px;
  font-weight: 600;
  color: white;
  opacity: 0.9;
}

#chatbot-btn:hover {
  transform: scale(1.1);
}


#chatbot-btn:hover, .chatbot-btn:hover {
  transform: scale(1.1);
}

#chatbot-box, .chatbot-box {
  position: fixed;
  top: 80px;                 /* slightly higher */
  right: 25px;

  width: 720px;             /* wider */
  max-width: 94vw;

  height: 860px;            /* taller */
  max-height: 90vh;         /* more screen usage */

  overflow: hidden;

  background: rgba(79, 126, 227, 0.75);
  backdrop-filter: blur(10px);

  border-radius: 16px;
  box-shadow: 1px 5px 25px rgba(36, 24, 206, 0.25);

  display: none;
  flex-direction: column;
  z-index: 1000;

  font-family: 'Poppins', sans-serif;
  transition: all 0.25s ease;
}



.chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;     /* IMPORTANT: prevents overflow at high zoom */
  width: 100%;
  padding: 10px;       /* Add vertical padding so header can grow */
  background: rgba(1, 25, 65, 0.9);
  color: white;
  box-sizing: border-box;
  font-size: 1.2rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.chatbot-header h4 {
  margin: 0;
  font-weight: 500;
  
}


.chatbot-header .close-btn {
  font-size: 1.5rem;
  line-height: 1;
  border: none;
  background: none;
  color: white;
  cursor: pointer;
  flex-shrink: 0; 
  position: static; 

}


#close-chat, .close-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 30px;
  cursor: pointer;
}

/* unify close button styling */
.close-btn,
#close-chat {
  background: none;
  border: none;
  color: white;
  cursor: pointer;

  font-size: 26px;     /* consistent size */
  line-height: 1;
  flex-shrink: 0;      /* prevent shrinking or disappearing */
  z-index: 1000;       /* ensure visibility */
}

#chatbot-messages, .chatbot-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px;
  overflow-y: auto;      
  scroll-behavior: smooth;
  gap: 10px;
  background: transparent;
  min-height: 0;        
}

/* Inner wrapper to push messages to bottom */
#chatbot-messages-inner {
  display: flex;
  flex-direction: column;
  margin-top: auto; 
  gap: 10px;
}


.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 19px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap 
}

/* User Message */
.message.user {
  background: #051fc7; 
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

/* Bot Message */
.message.bot {
  background: #e9ecef; 
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

/* === Input Section === */
#chatbot-input, .chatbot-input {
  display: flex;
  border-top: 2px solid #1644da;
  background: rgba(4, 34, 86, 0.9); 
}

#user-input, .chatbot-input input {
  flex: 1;
  padding: 12px;
  border: none;
  outline: none;
  font-size: 24px;
  color: white;
  background: transparent;
}

#send-btn, .chatbot-input button {
  background: rgba(4, 56, 215, 0.9);
  color: white;
  border: none;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
}

/* === Typing Dots Animation === */
.typing-dots {
  display: inline-flex;
  align-items: center;   
  gap: 4px;              
  line-height: 1;        
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background-color: #060947;
  border-radius: 50%;
  animation: blink 1.4s infinite;
}

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

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

@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

/* === Responsive Design === */
@media (max-width: 480px) {
  #chatbot-box, .chatbot-box {
    width: 92%;
    height: 80%;
    position: fixed;
    left: 50%;
    bottom: 0px;
    top: auto;
    transform: translateX(-50%); 
    right: auto; 
  }

  #chatbot-btn, .chatbot-btn {
    width: 40px;
    height: 40px;
    font-size: 12px;
    bottom: 20px;
  }

  .message {
    font-size: 0.9rem;
  }

  #chatbot-header, .chatbot-header {
    font-size: 0.9rem;
     padding: 0 5px;
}
#user-input, .chatbot-input input {
  font-size: 1.2rem;
}

  #chatbot-input, .chatbot-input {
    flex-direction: row;
  }

  #user-input, .chatbot-input input {
    font-size: 1rem;    
    padding: 10px;
  }

  #send-btn, .chatbot-input button {
    padding: 10px 12px;   
    font-size: 14px;      
    flex-shrink: 0;       
  }

  #close-chat, .close-btn {
  font-size: 20px;
  padding-top: 5px;
  padding-bottom: 5px;
}
#chatbot-btn .chat-label {
  font-size: 0.7rem;
  margin-left: -5px;
}

#user-input {
  min-height: 40px;
  max-height: 120px; /* prevent it from growing too tall */
  resize: none;
  overflow-y: auto;
  transition: height 0.15s ease;
}


}


/* === Floating Chatbot Button === */
#chatbot-btn {
  display: flex !important;              
  position: fixed !important;            
  bottom: 200px !important;               
  right: 20px !important;                
  width: 60px !important;                
  height: 60px !important;
  padding: 0 12px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #007bff, #004aad) !important;
  color: #fff !important;
  font-size: 26px !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999 !important;              /* above everything else */
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transition: all 0.25s ease;
  touch-action: none;
}

/* Optional: hide text label on small screens */
@media (max-width: 900px) {
  #chatbot-btn .chat-label {
    display: none;
  }
}

/* Hide the floating chatbot button when chatbot is open */
.chatbot-open #chatbot-btn {
  display: none !important;
}


/* Make chatbot button smaller on phones */
@media (max-width: 600px) {
  #chatbot-btn {
    width: 40px !important;
    height: 40px !important;
    bottom: 100px !important; 
    right: 20px !important;
    font-size: 20px !important;
  }
}


@media (max-width: 600px) {
  #chatbot-box {
    bottom: auto !important;       /* normal bottom spacing */
    top: 20px !important;          
    width: 92% !important;
    max-height: 85% !important;
    height: 55% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    overflow: hidden;
  }

  #close-chat, .close-btn {
    font-size: 20px;
    z-index: 1000;
  }
}

body.chatbot-open #chatbot-btn {
  animation: none;
}

* Input container */
.chatbot-input {
  display: flex;
  align-items: flex-end;
  padding-left: 15px;
  gap: 8px;
  background: rgba(4, 34, 86, 0.9);
  border-top: 1px solid rgba(255,255,255,0.15);
}

/* WhatsApp-style auto-expanding textarea */
#user-input {
  flex: 1;
  min-height: 20px;        /* single-line height */
  max-height: 120px;       /* limit (about 5 lines) */
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.2;
  color: white;
  background: transparent;
  border: none;
  outline: none;
  overflow-y: auto;        /* show scroll when max height reached */
  resize: none;            /* prevent manual resize */
  white-space: pre-wrap;   /* allow wrapping */
  font-family: 'Poppins', sans-serif;
}

/* Send button */
#send-btn {
  background: rgba(4, 56, 215, 0.9);
  color: white;
  border: none;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 600;
  border-radius: 6px;
}


/* Responsive adjustments for small screens */
@media screen and (max-width: 480px) {
  #send-btn {
    padding: 10px 12px;
    font-size: 14px;
  }

  #user-input {
    font-size: 1.1rem;
    min-height: 25px;
    max-height: 80px;
  }

  .chatbot-input {
    padding: 3px 1px;
    
  }
}



.bot-reply {
  line-height: 1.6;
  white-space: normal;
  text-align: left;
  font-size: 1.2rem;
}

.bot-reply strong {
  color: #004aad;
  font-weight: 400;
}

.bot-reply em {
  color: #007bff;
}

.bot-reply br + br {
  margin-bottom: 6px;
  display: block;
  content: "";
}



/* 🌞 Light Mode */
.bot-reply strong {
  color: #0078ff;
}


/* === Chatbot Attention Pulse === */
@keyframes chatbotPulse {

  0% {
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.6);
  }

  70% {
    box-shadow: 0 0 0 16px rgba(0, 123, 255, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
  }

}

/* =========================
CHATBOT MOBILE OPTIMIZATION
========================= */
@media (max-width:600px){

  /* Floating button: better placement */
  #chatbot-btn,
  .chatbot-btn{
    width:44px !important;
    height:44px !important;
    font-size:20px !important;
    bottom:80px !important;
    right:14px !important;
  }

  /* Chat window: more natural mobile modal */
  #chatbot-box,
  .chatbot-box{
    width:94% !important;
    height:75vh !important;
    top:auto !important;
    bottom:10px !important;
    right:auto !important;
    left:50% !important;
    transform:translateX(-50%) !important;
    border-radius:14px;
  }

  /* Header smaller + tighter */
  .chatbot-header{
    font-size:1rem;
    padding:8px 10px;
  }

  #close-chat,
  .close-btn{
    font-size:22px;
  }

  /* Messages spacing reduced */
  #chatbot-messages,
  .chatbot-messages{
    padding:10px;
    gap:8px;
  }

  /* Message bubbles smaller */
  .message{
    font-size:0.95rem;
    max-width:85%;
    padding:8px 10px;
  }

  /* Input area tighter */
  .chatbot-input{
    padding:6px;
  }

  #user-input,
  .chatbot-input input{
    font-size:1rem !important;
    padding:10px;
  }

  #send-btn,
  .chatbot-input button{
    padding:10px 12px;
    font-size:14px;
  }
}

/* =========================
   CHATBOT TEXT - 420px SCREENS
========================= */
@media (max-width:420px){

  .message,
  .message.user,
  .message.bot,
  .bot-reply{
    font-size:0.9rem !important;
    line-height:1.5;
  }

}

/* =========================
   CHATBOT KEYBOARD MODE
========================= */
@media (max-width:420px){

  .chatbot-keyboard-open #chatbot-box,
  .chatbot-keyboard-open .chatbot-box{

    height:55vh !important;
    top:10px !important;
    bottom:auto !important;

    transform:translateX(-50%) !important;

    transition:
      height 0.25s ease,
      top 0.25s ease;

  }

  /* Keep header visible */
  .chatbot-keyboard-open .chatbot-header{
    position:sticky;
    top:0;
    z-index:50;
  }

  .chatbot-header h4{
   font-size: 0.8rem;
  }

}

@media (max-width:420px){

  #chatbot-box,
  .chatbot-box{
    width:94% !important;
    height:80vh !important;

    top:auto !important;
    bottom:20px !important;

    right:auto !important;
    left:50% !important;

    transform:translateX(-50%) !important;

    border-radius:14px;
  }

}

@media (max-width:420px){

  .chatbot-keyboard-open #chatbot-box,
  .chatbot-keyboard-open .chatbot-box{

    height:55vh !important;
    top:10px !important;
    bottom:auto !important;

    transform:translateX(-50%) !important;

    transition:
      height 0.25s ease,
      top 0.25s ease;

  }

}


/* =========================
   CHATBOT KEYBOARD MODE
========================= */
@media (max-width:420px){

.chatbot-keyboard-open #chatbot-box,
.chatbot-keyboard-open .chatbot-box{


  top:auto !important;
  bottom:0 !important;

  left:50% !important;
  transform:translateX(-50%) !important;

  transition:
    height 0.25s ease,
    bottom 0.25s ease;

}

  /* Keep header ALWAYS visible */
  .chatbot-keyboard-open .chatbot-header{
    position:sticky;
    top:0;
    z-index:999;
  }

  .chatbot-header h4{
    font-size:0.85rem;
  }

}

.chatbot-keyboard-open #chatbot-box,
.chatbot-keyboard-open .chatbot-box{

    top:auto !important;
    bottom:0 !important;

    left:50% !important;
    transform:translateX(-50%) !important;

    transition:
      height 0.25s ease;

}

/* =========================
   CHATBOT KEYBOARD MODE
========================= */
@media (max-width:420px){

  body.chatbot-keyboard-open #chatbot-box{

    position: fixed !important;

    top: 10px !important;
    bottom: 10px !important;

    left: 50% !important;
    transform: translateX(-50%) !important;

    width: 94% !important;

    

    border-radius: 14px !important;

    transition: all 0.25s ease;
  }

  /* Header always visible */
  body.chatbot-keyboard-open .chatbot-header{
    position: sticky;
    top: 0;
    z-index: 9999;
    background: rgba(1,25,65,0.96);
  }

}

/* =========================
   CHATBOT KEYBOARD MODE
========================= */
@media (max-width:420px){

  body.chatbot-keyboard-open #chatbot-box{

    position: fixed !important;

    left: 50% !important;
    transform: translateX(-50%) !important;

    width: 94% !important;

    top: 10px !important;
    bottom: auto !important;

    /* SHRINK CHATBOT */
    height: 55vh !important;
    max-height: 55vh !important;

    border-radius: 14px !important;

    transition:
      height 0.25s ease,
      top 0.25s ease;
  }

  /* Keep header visible */
  body.chatbot-keyboard-open .chatbot-header{
    position: sticky;
    top: 0;
    z-index: 9999;
    background: rgba(1,25,65,0.96);
  }

  .chatbot-header .close-btn {
    font-size: 1.4;
    font-weight: 450;
  }

}

#user-input {
  flex: 1;

  height: 35px;          /* fixed single-line start */
  min-height: 35px;

  max-height: 100px;

  padding: 5px 12px;

  line-height: 1.4;

  font-size: 20px;

  color: white;
  background: transparent;

  border: none;
  outline: none;

  overflow-y: auto;
  resize: none;

  white-space: pre-wrap;

  font-family: 'Poppins', sans-serif;

  box-sizing: border-box;   /* VERY IMPORTANT */
}

/* ==========================================
   CHATBOT BACKDROP OVERLAY
========================================== */

.chatbot-overlay{
  position: fixed;
  inset: 0;

  background: rgba(0,0,0,0.55);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  opacity: 0;
  visibility: hidden;

  transition:
    opacity .25s ease,
    visibility .25s ease;

  z-index: 9998;
}

/* Active state */
.chatbot-overlay.active{
  opacity: 1;
  visibility: visible;
}

/* Chatbot stays above overlay */
#chatbot-box{
  z-index: 9999 !important;
}


/* =========================
   CHATBOT ASSISTANT LABEL
   ABOVE BUTTON
========================= */
.chatbot-label {

  position: fixed;

  /* PLACE ABOVE BUTTON */
  bottom: 280px;
  right: 20px;

  display: flex;
  align-items: center;
  justify-content: center;

  max-width: 260px;

  padding: 12px 18px;

  border-radius: 16px;

  background: linear-gradient(
    135deg,
    rgba(0,123,255,0.98),
    rgba(0,74,173,0.96)
  );

  color: white;

  font-size: 16px;
  font-weight: 600;

  line-height: 1.4;
  text-align: center;

  box-shadow:
    0 10px 30px rgba(0,123,255,0.35),
    0 0 20px rgba(0,123,255,0.25);

  z-index: 9998;

   animation:
    chatbotLabelBounce 3.8s ease-in-out infinite,
    labelGlow 3s ease-in-out infinite;

  transition: all 0.3s ease;

  cursor: pointer;
}

/* POINTER NOW POINTS DOWN TO BUTTON */
.chatbot-label::after {

  content: "";

  position: absolute;

  bottom: -8px;
  right: 30px;

  width: 16px;
  height: 16px;

  background: #0066dd;

  transform: rotate(45deg);

  border-radius: 2px;
}

/* =========================
   TABLET
========================= */
@media (max-width:900px){

  .chatbot-label{
    bottom: 210px;
    right: 16px;
  }

}

/* =========================
   MOBILE
========================= */
@media (max-width:600px){

  .chatbot-label{

    bottom: 150px;
    right: 12px;

    max-width: 180px;

    font-size: 11px;
  }

}

/* =========================
   420px DEVICES
========================= */
@media (max-width:420px){

  .chatbot-label{

    bottom: 140px;
    right: 10px;

    max-width: 150px;

    font-size: 10px;
  
  }

}

/* =========================
   CHATBOT LABEL ANIMATION
========================= */
.chatbot-label {

 animation:
  chatbotLabelBounce 5s ease-in-out infinite,
  labelGlow 4s ease-in-out infinite;  

}


@keyframes chatbotLabelBounce {

  0% {
    transform: translateY(0);
  }

  25% {
    transform: translateY(-6px);
  }

  50% {
    transform: translateY(0);
  }

  75% {
    transform: translateY(-3px);
  }

  100% {
    transform: translateY(0);
  }

}

.chatbot-label{
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}

/* ===================================
   FORM SUCCESS MESSAGE
=================================== */

.form-success-message{
  display:none;
  background:#ecfdf3;
  color:#065f46;
  border:1px solid #10b981;
  padding:14px 16px;
  border-radius:12px;
  margin-bottom:18px;
  font-weight:600;
  line-height:1.5;
  animation:fadeIn .4s ease;
}

.form-success-message.show{
  display:block;
}

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