/* ===== VIBECODE CHATBOT ===== */

.chatbot-wrapper {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  pointer-events: none;
}

/* ROBOT ICON */

.chatbot-icon {
  width: 140px;
  height: 200px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: .35s cubic-bezier(.2, .8, .2, 1);
  pointer-events: auto;
}

.chatbot-icon:hover {
  transform: translateY(-6px) scale(1.04);
}

/* Hide model-viewer default progress bar which appears as a line on load */
model-viewer::part(default-progress-bar) {
  display: none;
}

/* CHAT WINDOW */

.chatbot-window {

  width: 380px;
  height: 520px;

  background: rgba(255, 255, 255, .72);

  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);

  border: 1px solid rgba(0, 0, 0, .06);

  border-radius: 22px;

  box-shadow:
    0 20px 60px rgba(0, 0, 0, .08),
    0 8px 24px rgba(0, 0, 0, .05);

  display: flex;
  flex-direction: column;

  overflow: hidden;

  opacity: 0;
  transform: translateY(20px) scale(.96);

  pointer-events: none;

  transition:
    opacity .35s cubic-bezier(.2, .8, .2, 1),
    transform .35s cubic-bezier(.2, .8, .2, 1);
}

.chatbot-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* HEADER */

.chatbot-header {

  padding: 16px 22px;

  background: var(--dark);
  color: var(--light);

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

  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.chatbot-title {
  font-family: 'Krub', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.chatbot-title span {
  color: var(--cyan);
}

.chatbot-close {
  border: none;
  background: none;
  color: rgba(255, 255, 255, .6);
  cursor: pointer;
  font-size: 1.2rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transition: .2s;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

/* MESSAGES */

.chatbot-messages {
  flex: 1;
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {

  max-width: 82%;

  padding: 12px 16px;

  font-size: .92rem;
  line-height: 1.5;

  border-radius: 16px;

  animation: chatFade .25s ease forwards;

  opacity: 0;
  transform: translateY(8px);
}

@keyframes chatFade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* BOT MESSAGE */

.bot-message {
  align-self: flex-start;

  background: var(--gray-lt);

  border: 1px solid var(--gray-bd);

  color: var(--txt);

  border-bottom-left-radius: 6px;
}

/* USER MESSAGE */

.user-message {

  align-self: flex-end;

  background: linear-gradient(135deg,
      var(--cyan-dk),
      var(--cyan));

  color: #fff;

  font-weight: 500;

  border-bottom-right-radius: 6px;

  box-shadow: 0 4px 16px rgba(76, 208, 252, .25);
}

/* QUICK REPLIES */

.chatbot-quick-replies {

  display: flex;
  gap: 8px;

  padding: 0 20px 12px;

  overflow-x: auto;
}

.quick-reply-btn {

  background: var(--cyan-10);

  border: 1px solid var(--cyan-20);

  color: var(--cyan-dk);

  border-radius: 999px;

  padding: 7px 14px;

  font-size: .82rem;
  font-weight: 600;

  cursor: pointer;

  transition: .25s;
}

.quick-reply-btn:hover {

  background: var(--cyan);

  color: var(--dark);

  transform: translateY(-2px);

  box-shadow: 0 6px 18px rgba(76, 208, 252, .25);
}

/* INPUT AREA */

.chatbot-input-area {

  padding: 16px 20px;

  background: rgba(255, 255, 255, .6);

  border-top: 1px solid rgba(0, 0, 0, .05);

  display: flex;
  gap: 10px;
}

.chatbot-input-area input {

  flex: 1;

  border: 1px solid var(--gray-bd);

  border-radius: 999px;

  padding: 11px 18px;

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

  font-size: .9rem;

  outline: none;

  transition: .2s;
}

.chatbot-input-area input:focus {

  border-color: var(--cyan);

  box-shadow: 0 0 0 4px rgba(76, 208, 252, .15);
}

/* SEND BUTTON */

.chatbot-input-area button {

  width: 44px;
  height: 44px;

  border: none;

  border-radius: 50%;

  background: var(--dark);
  color: #fff;

  cursor: pointer;

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

  transition: .25s;
}

.chatbot-input-area button:hover {

  background: var(--cyan);
  color: var(--dark);

  transform: translateY(-2px);

  box-shadow: 0 6px 18px rgba(76, 208, 252, .35);
}

/* TYPING INDICATOR */

.typing-indicator {

  display: flex;
  gap: 5px;

  padding: 12px 16px;

  background: var(--gray-lt);

  border: 1px solid var(--gray-bd);

  border-radius: 16px;

  border-bottom-left-radius: 6px;

  align-self: flex-start;
}

.typing-dot {

  width: 7px;
  height: 7px;

  background: var(--gray);

  border-radius: 50%;

  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(2) {
  animation-delay: .2s
}

.typing-dot:nth-child(3) {
  animation-delay: .4s
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(.6);
    opacity: .5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }

}

/* =========================================
   RESPONSIVE DESIGN (EVERY DEVICE SIZE)
========================================= */

/* Tablets & Small Laptops */
@media(max-width: 1024px) {
  .chatbot-wrapper {
    right: 20px;
    bottom: 20px;
    gap: 14px;
  }
  .chatbot-window {
    width: 360px;
    height: 500px;
  }
  .chatbot-icon {
    width: 120px;
    height: 170px;
  }
}

/* Mobile Devices */
@media(max-width: 768px) {
  .chatbot-wrapper {
    right: 16px;
    bottom: 16px;
    flex-direction: column;
    align-items: flex-end;
  }

  .chatbot-window {
    width: calc(100vw - 32px);
    max-width: 400px;
    height: calc(100vh - 200px);
    max-height: 480px;
  }

  .chatbot-icon {
    width: 100px;
    height: 140px;
  }
}

/* Small Mobile Devices (e.g., iPhone SE) */
@media(max-width: 480px) {
  .chatbot-wrapper {
    right: 12px;
    bottom: 12px;
  }

  .chatbot-window {
    width: calc(100vw - 24px);
    height: calc(100vh - 160px);
    max-height: 500px;
  }

  .chatbot-icon {
    width: 85px;
    height: 110px;
  }
}

/* Landscape Mode (Short Heights) */
@media(max-height: 600px) {
  .chatbot-wrapper {
    flex-direction: row;
    bottom: 12px;
    right: 12px;
  }

  .chatbot-window {
    height: calc(100vh - 24px);
    width: 320px;
    max-width: calc(100vw - 120px);
  }

  .chatbot-icon {
    width: 85px;
    height: 120px;
  }
}

/* ROBOT HOVER GREETING */

.chatbot-icon {
  position: relative;
}

.chatbot-icon::after {
  content: "Hello!👋";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--dark);
  color: var(--light);
  padding: 6px 12px;
  font-size: .75rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  opacity: 0;
  transition: .25s ease;
  pointer-events: none;
  z-index: 10;
}

/* show on hover */
.chatbot-icon:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* little arrow */
.chatbot-icon::before {
  content: "";
  position: absolute;
  top: 26px; /* Right beneath the greeting tooltip */
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--dark);
  opacity: 0;
  transition: .25s;
  pointer-events: none;
  z-index: 10;
}

.chatbot-icon:hover::before {
  opacity: 1;
}