/* ==========================================================================
   Monty Chat Widget — Bellmont Cabinet Co.
   A friendly mountain mascot chatbot
   ========================================================================== */

/* ---------- Chat Bubble (FAB) ---------- */
.monty-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 950;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d6b5e 0%, #2c5a4e 100%);
  box-shadow: 0 4px 20px rgba(61, 107, 94, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: monty-bounce 3s ease-in-out infinite;
  border: none;
  outline: none;
}
.monty-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(61, 107, 94, 0.55);
}
.monty-fab.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.5);
  pointer-events: none;
}
.monty-fab svg {
  width: 40px;
  height: 40px;
}

@keyframes monty-bounce {
  0%, 100% { transform: translateY(0); }
  15% { transform: translateY(-6px); }
  30% { transform: translateY(0); }
  45% { transform: translateY(-3px); }
  60% { transform: translateY(0); }
}
.monty-fab:hover {
  animation: none;
  transform: scale(1.08);
}

/* ---------- Chat Panel ---------- */
.monty-panel {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 951;
  width: 380px;
  max-height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.monty-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ---------- Panel Header ---------- */
.monty-header {
  background: linear-gradient(135deg, #3d6b5e 0%, #2c5a4e 100%);
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.monty-header-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.monty-header-avatar svg {
  width: 36px;
  height: 36px;
}
.monty-header-text h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}
.monty-header-text span {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.05em;
}
.monty-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s;
}
.monty-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ---------- Messages Area ---------- */
.monty-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f7f5f2;
  min-height: 280px;
  max-height: 380px;
}
.monty-messages::-webkit-scrollbar { width: 4px; }
.monty-messages::-webkit-scrollbar-track { background: transparent; }
.monty-messages::-webkit-scrollbar-thumb { background: #d4d0ca; border-radius: 2px; }

/* ---------- Message Bubbles ---------- */
.monty-msg {
  display: flex;
  gap: 0.5rem;
  max-width: 88%;
  animation: monty-msg-in 0.3s ease-out;
}
.monty-msg--bot {
  align-self: flex-start;
}
.monty-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.monty-msg-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  margin-top: 2px;
}
.monty-msg-avatar svg {
  width: 28px;
  height: 28px;
}
.monty-msg--user .monty-msg-avatar {
  display: none;
}
.monty-msg-bubble {
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #333;
}
.monty-msg--bot .monty-msg-bubble {
  background: #fff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.monty-msg--user .monty-msg-bubble {
  background: #3d6b5e;
  color: #fff;
  border-bottom-right-radius: 4px;
}

@keyframes monty-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Typing Indicator ---------- */
.monty-typing {
  display: flex;
  gap: 0.5rem;
  align-self: flex-start;
  max-width: 88%;
}
.monty-typing-dots {
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 0.65rem 1rem;
  display: flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.monty-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa;
  animation: monty-dot-bounce 1.4s ease-in-out infinite;
}
.monty-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.monty-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes monty-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Input Area ---------- */
.monty-input-area {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e1db;
  display: flex;
  gap: 0.5rem;
  background: #fff;
  flex-shrink: 0;
}
.monty-input {
  flex: 1;
  border: 1.5px solid #e5e1db;
  border-radius: 24px;
  padding: 0.55rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: #333;
  outline: none;
  transition: border-color 0.2s;
  background: #f7f5f2;
}
.monty-input:focus {
  border-color: #c8a86e;
  background: #fff;
}
.monty-input::placeholder {
  color: #aaa;
}
.monty-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #c8a86e;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.monty-send:hover {
  background: #b89858;
  transform: scale(1.05);
}
.monty-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.monty-send svg {
  width: 18px;
  height: 18px;
}

/* ---------- Powered By ---------- */
.monty-powered {
  text-align: center;
  padding: 0.35rem;
  font-size: 0.65rem;
  color: #bbb;
  font-family: 'Inter', sans-serif;
  background: #fff;
}

/* ---------- Hide sticky CTA when Monty panel open ---------- */
body.monty-open .sticky-cta {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
  .monty-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 16px 16px 0 0;
  }
  .monty-messages {
    max-height: calc(100dvh - 160px);
    min-height: 200px;
  }
  .monty-fab {
    bottom: 1rem;
    right: 1rem;
    width: 56px;
    height: 56px;
  }
  .monty-fab svg {
    width: 34px;
    height: 34px;
  }
}
