/* Jimmy chat widget — Kuvhima Safaris
   Platform-template. Per-outfitter values: --jimmy-accent. */

:root {
  --jimmy-accent: #6b4423;
  --jimmy-bg: #fffaf3;
  --jimmy-fg: #1a1a1a;
  --jimmy-muted: #555;
  --jimmy-bubble-user: #6b4423;
  --jimmy-bubble-assistant: #f5f1ea;
  --jimmy-border: #e3dccd;
}

/* Floating launcher button (same slot as ex-WhatsApp button) */
#jimmy-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1500;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--jimmy-accent);
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  padding: 0;
}
#jimmy-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.24);
}
#jimmy-launcher img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}
#jimmy-launcher .jimmy-launcher-fallback {
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

/* Expanded chat panel */
#jimmy-panel {
  position: fixed;
  bottom: 104px;
  right: 28px;
  z-index: 1500;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: var(--jimmy-bg);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
  color: var(--jimmy-fg);
}
#jimmy-panel.open {
  display: flex;
}

#jimmy-header {
  padding: 14px 18px;
  background: var(--jimmy-accent);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#jimmy-header img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
#jimmy-header .jimmy-title-block {
  flex: 1;
  min-width: 0;
}
#jimmy-header .title {
  font-weight: 600;
  font-size: 1rem;
}
#jimmy-header .subtitle {
  font-size: 0.78rem;
  opacity: 0.85;
}
#jimmy-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0 4px;
}

#jimmy-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jimmy-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 0.94rem;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.jimmy-msg-assistant {
  background: var(--jimmy-bubble-assistant);
  color: var(--jimmy-fg);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.jimmy-msg-user {
  background: var(--jimmy-bubble-user);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.jimmy-msg-system {
  font-style: italic;
  color: var(--jimmy-muted);
  align-self: center;
  font-size: 0.85rem;
  max-width: 95%;
  text-align: center;
}

.jimmy-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.jimmy-typing span {
  width: 6px;
  height: 6px;
  background: var(--jimmy-muted);
  border-radius: 50%;
  animation: jimmyDot 1.2s infinite ease-in-out;
}
.jimmy-typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.jimmy-typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes jimmyDot {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

#jimmy-input-wrap {
  border-top: 1px solid var(--jimmy-border);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
#jimmy-input {
  flex: 1;
  border: 1px solid #d5cab3;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 40px;
}
#jimmy-input:focus {
  border-color: var(--jimmy-accent);
}
#jimmy-send {
  background: var(--jimmy-accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}
#jimmy-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#jimmy-footer {
  padding: 6px 12px 10px;
  font-size: 0.72rem;
  color: var(--jimmy-muted);
  text-align: center;
  flex-shrink: 0;
}

/* Mobile */
@media (max-width: 480px) {
  #jimmy-launcher {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  #jimmy-launcher img {
    width: 38px;
    height: 38px;
  }
  #jimmy-panel {
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}
