/* 
================================================================================
   ZION BAZAAR - CHATBOT STYLES
   Table of Contents:
   1. CHATBOT FLOATING BUTTON
   2. CHATBOT WINDOW (HEADER & CONTENT)
   3. CHATBOX & MESSAGE STYLING
   4. CHAT INPUT & TEXTAREA
   5. RESPONSIVE MEDIA QUERIES
================================================================================
*/

/* =============================================================================
   1. CHATBOT FLOATING BUTTON
   ============================================================================= */
.chatbot-toggler {
  position: fixed;
  bottom: 30px;
  right: 35px;
  outline: none;
  border: none;
  height: 50px;
  width: 50px;
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #0047ab;
  transition: all 0.2s ease;
  z-index: 9999;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.chatbot-toggler span {
  color: #fff;
  position: absolute;
  font-size: 1.5rem;
}

/* =============================================================================
   2. CHATBOT WINDOW (HEADER & CONTENT)
   ============================================================================= */
.chatbot {
  position: fixed;
  right: 35px;
  bottom: 90px;
  width: 350px;
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5);
  transform-origin: bottom right;
  box-shadow: 0 0 128px 0 rgba(0,0,0,0.1),
              0 32px 64px -48px rgba(0,0,0,0.5);
  transition: all 0.1s ease;
  z-index: 9999;
}

.show-chatbot .chatbot {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.chatbot header {
  padding: 16px 0;
  position: relative;
  text-align: center;
  color: #fff;
  background: #0047ab;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chatbot header h2 {
  font-size: 1.4rem;
  margin: 0;
}

.chatbot header span {
  position: absolute;
  right: 15px;
  top: 50%;
  color: #fff;
  cursor: pointer;
  display: block; 
  transform: translateY(-50%);
  font-size: 1.3rem;
}

/* =============================================================================
   3. CHATBOX & MESSAGE STYLING
   ============================================================================= */
.chatbot .chatbox {
  overflow-y: auto;
  height: 400px;
  padding: 30px 20px 100px;
}

/* --- Scrollbar Styling --- */
.chatbot :where(.chatbox, textarea)::-webkit-scrollbar {
  width: 6px;
}
.chatbot :where(.chatbox, textarea)::-webkit-scrollbar-track {
  background: #fff;
  border-radius: 25px;
}
.chatbot :where(.chatbox, textarea)::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 25px;
}

/* --- Chat Bubbles --- */
.chatbox .chat {
  display: flex;
  list-style: none;
  margin-bottom: 20px;
}

.chatbox .incoming span {
  width: 32px;
  height: 32px;
  color: #fff;
  cursor: default;
  text-align: center;
  line-height: 32px;
  align-self: flex-end;
  background: #0047ab;
  border-radius: 4px;
  margin: 0 10px 7px 0;
  font-size: 1rem;
}

.chatbox .chat p {
  white-space: pre-wrap;
  padding: 12px 16px;
  border-radius: 10px 10px 0 10px;
  max-width: 75%;
  color: #fff;
  font-size: 0.95rem;
  background: #0047ab;
}

.chatbox .incoming p {
  border-radius: 10px 10px 10px 0;
  color: #000;
  background: #f2f2f2;
}

.chatbox .chat p.error {
  color: #721c24;
  background: #f8d7da;
}

/* =============================================================================
   4. CHAT INPUT & TEXTAREA
   ============================================================================= */
.chatbot .chat-input {
  display: flex;
  gap: 5px;
  position: absolute;
  bottom: 0;
  width: 100%;
  background: #fff;
  padding: 3px 20px;
  border-top: 1px solid #ddd;
}

.chat-input textarea {
  height: 55px;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  max-height: 180px;
  padding: 15px 15px 15px 0;
  font-size: 0.95rem;
}

.chat-input span {
  align-self: flex-end;
  color: #0047ab;
  cursor: pointer;
  height: 55px;
  display: flex;
  align-items: center;
  font-size: 1.35rem;
}

.chat-input span:hover {
    color: #003b8e;
}

/* =============================================================================
   5. RESPONSIVE MEDIA QUERIES
   ============================================================================= */
@media (max-width: 768px) {
  .has-mobile-action-bar .chatbot-toggler {
    bottom: 85px; /* Moves above the mobile action bar */
  }
  .has-mobile-action-bar .chatbot {
    bottom: 145px; /* Moves above the toggler */
  }
}

@media (max-width: 490px) {
  .chatbot-toggler {
    right: 20px;
    bottom: 20px;
  }
  .has-mobile-action-bar .chatbot-toggler {
    bottom: 85px; /* Keeps it above even on smaller mobiles */
  }
  .chatbot {
    right: 0;
    bottom: 0;
    height: 100%;
    border-radius: 0;
    width: 100%;
  }
  .has-mobile-action-bar .chatbot {
    bottom: 0; /* Reset bottom to 0 for full-screen mobile view */
  }
  .chatbot .chatbox {
    height: 90%;
    padding: 25px 15px 100px;
  }
  .chatbot .chat-input {
    padding: 5px 15px;
  }
  .chatbot header span {
    display: block;
  }
}
