/* =========================================
   GLOSSY CHAT WIDGET (BUBBL + CHATBASE THEME)
   ========================================= */

#chat-widget-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  font-family: "Inter", sans-serif;
  pointer-events: none;
}

/* 1. THE PILL BUTTON (Under Sprite) */
#chat-open-btn {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #1a1a1a;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 10px;
  pointer-events: auto;
}

#chat-open-btn {
  /* Keep your existing pill button styles, but make sure this transition is there: */
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  will-change: transform;
}

#chat-open-btn {
  /* Keep your existing pill button styles, but make sure this transition is there: */
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  will-change: transform;
}

#chat-open-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

#chat-open-btn:active {
  transform: scale(0.95) !important; /* Satisfying click depression */
}

#chat-open-btn:active {
  transform: scale(0.95) !important; /* Satisfying click depression */
}

#chat-window-popup {
  width: 380px;
  height: 580px;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  transform: rotate(0deg) scale(1) translateY(0) !important;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}

.hidden {
  opacity: 0;
  transform: scale(0.8) translateY(40px);
  pointer-events: none;
}

/* 3. HEADER AREA */
.chat-header {
  background: rgba(255, 255, 255, 0.3);
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.chat-header-title {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #1a1a1a;
}

.chat-close-x {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: 0.2s;
}

.chat-close-x:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* 4. CHAT MESSAGES */
#chat-display {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.msg {
  max-width: 85%;
  padding: 12px 18px;
  font-size: 14.5px;
  line-height: 1.5;
  border-radius: 20px;
  font-weight: 500;
}

.bot {
  background: rgba(255, 255, 255, 0.7);
  color: #1a1a1a;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.user {
  background: #000;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* 5. INPUT SECTION */
.chat-input-area {
  padding: 20px;
  background: rgba(255, 255, 255, 0.2);
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50px;
  padding: 5px 10px 5px 20px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#user-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 0;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  color: #1a1a1a;
}

#send-btn-icon {
  background: #000;
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

#send-btn-icon:hover {
  transform: scale(1.05);
  background: #333;
}

/* 6. SPRITE CONTAINER */
#sprite-ask-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  cursor: pointer;
  text-align: center;
  z-index: 1001;
  transform-origin: bottom right;
  pointer-events: none;
}

#bot-sprite {
  width: 200px;
  height: 110px;
  background-image: url("/static/images/spritesheet.webp");
  background-size: 80000px 110px;
  margin: 0 auto -5px auto;
  pointer-events: auto;

  transform: scale(2);
  transform-origin: bottom center;
}

#sprite-ask-container.chat-open {
  bottom: 610px;
  transform: scale(0.5);
  opacity: 0.9;
}

#sprite-ask-container.chat-open #chat-open-btn {
  display: none;
}

/* =========================================
   CHAT WIDGET INVISIBLE SHIELD FIX
   ========================================= */

#chat-widget-container {
  pointer-events: none !important;
}

#chat-open-btn,
#sprite-ask-container,
#bot-sprite {
  pointer-events: auto !important;
}

#chat-window-popup {
  pointer-events: auto !important;
  will-change: transform, opacity, visibility;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1) !important;
  transform-origin: bottom right;
}

#chat-window-popup.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(0.85) translateY(20px) rotate(2deg) !important;
}
/* =========================================
   MOBILE RESPONSIVE TWEAKS (PHONES ONLY)
   ========================================= */
@media screen and (max-width: 600px) {
  /* Bring it closer to the edges on small screens */
  #chat-widget-container {
    bottom: 15px;
    right: 15px;
  }

  /* Shrink the chat window to fit mobile screens */
  #chat-window-popup {
    width: calc(100vw - 30px); /* Leaves a 15px gap on both sides */
    height: 380px; /* Much shorter so the keyboard doesn't crush it */
    margin-bottom: 10px;
  }

  /* Make the Sprite and Text smaller */
  #bot-sprite {
    width: 100px;
    height: 55px;
    /* Math: 400 frames * 100px = 40000px */
    background-size: 40000px 55px;
    margin: 0 auto -5px auto;
  }

  #chat-open-btn {
    padding: 8px 14px;
    font-size: 11.5px;
  }

  #sprite-ask-container {
    bottom: 15px;
    right: 15px;
  }

  /* Calculate exact position of sprite when chat is open on mobile */
  #sprite-ask-container.chat-open {
    bottom: 410px; /* 380px height + 15px bottom + 15px gap */
    transform: scale(0.4);
  }

  /* Tighten up chat bubbles for mobile */
  .msg {
    max-width: 90%;
    font-size: 12px;
    padding: 8px 12px;
  }
}
