/* ============================================================
   Boondock or Bust — Chatbot Widget Styles
   ============================================================ */

:root {
  --bob-primary: #2d6a4f;       /* forest green */
  --bob-primary-dark: #1b4332;
  --bob-accent: #f4a261;        /* warm amber */
  --bob-bg: #ffffff;
  --bob-msg-user-bg: #2d6a4f;
  --bob-msg-user-text: #ffffff;
  --bob-msg-bot-bg: #f0f4f1;
  --bob-msg-bot-text: #1a1a1a;
  --bob-radius: 16px;
  --bob-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  --bob-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bob-z: 9999;
}

/* ── Wrapper ─────────────────────────────────────────────── */
.bob-chat-wrapper {
  position: fixed;
  bottom: 24px;
  z-index: var(--bob-z);
  font-family: var(--bob-font);
  font-size: 15px;
  line-height: 1.5;
  box-sizing: border-box;
}

.bob-chat-wrapper * {
  box-sizing: border-box;
}

.bob-chat--right {
  right: 24px;
}

.bob-chat--left {
  left: 24px;
}

/* ── Launcher button ─────────────────────────────────────── */
.bob-chat-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bob-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--bob-shadow);
  transition: background 0.2s, transform 0.2s;
  margin-left: auto;
}

.bob-chat--left .bob-chat-launcher {
  margin-left: 0;
  margin-right: auto;
}

.bob-chat-launcher:hover {
  background: var(--bob-primary-dark);
  transform: scale(1.05);
}

.bob-chat-launcher--open {
  background: var(--bob-primary-dark);
}

.bob-chat-launcher svg {
  width: 28px;
  height: 28px;
}

/* ── Chat window ─────────────────────────────────────────── */
.bob-chat-window {
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 110px);
  border-radius: var(--bob-radius);
  background: var(--bob-bg);
  box-shadow: var(--bob-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 12px;

  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bob-chat-window--open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ── Header ──────────────────────────────────────────────── */
.bob-chat-header {
  background: var(--bob-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.bob-chat-title {
  font-weight: 600;
  font-size: 15px;
}

.bob-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.bob-chat-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.bob-chat-close svg {
  width: 20px;
  height: 20px;
}

/* ── Messages ────────────────────────────────────────────── */
.bob-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.bob-chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  word-break: break-word;
  white-space: pre-wrap;
  animation: bob-fade-in 0.15s ease;
}

@keyframes bob-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bob-chat-bubble--user {
  align-self: flex-end;
  background: var(--bob-msg-user-bg);
  color: var(--bob-msg-user-text);
  border-bottom-right-radius: 4px;
}

.bob-chat-bubble--assistant {
  align-self: flex-start;
  background: var(--bob-msg-bot-bg);
  color: var(--bob-msg-bot-text);
  border-bottom-left-radius: 4px;
}

/* ── Typing indicator ────────────────────────────────────── */
.bob-chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.bob-chat-typing span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #aaa;
  border-radius: 50%;
  animation: bob-bounce 1.2s infinite ease-in-out;
}

.bob-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.bob-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bob-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-7px); }
}

/* ── Input area ──────────────────────────────────────────── */
.bob-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e8ecef;
  flex-shrink: 0;
}

.bob-chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--bob-font);
  font-size: 14px;
  resize: none;
  line-height: 1.4;
  max-height: 120px;
  overflow-y: auto;
  outline: none;
  transition: border-color 0.15s;
  background: #f9fafb;
  color: #1a1a1a;
}

.bob-chat-input:focus {
  border-color: var(--bob-primary);
  background: #fff;
}

.bob-chat-input::placeholder {
  color: #9ca3af;
}

.bob-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bob-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}

.bob-chat-send:hover:not(:disabled) {
  background: var(--bob-primary-dark);
  transform: scale(1.05);
}

.bob-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bob-chat-send svg {
  width: 18px;
  height: 18px;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .bob-chat-wrapper {
    bottom: 16px;
  }

  .bob-chat--right { right: 16px; }
  .bob-chat--left  { left: 16px; }

  .bob-chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    max-height: none;
  }
}
