/* ==========================================================
   Jivi — Jeevora Experience's on-site assistant
   ========================================================== */

.jivi-widget { position: fixed; right: 24px; bottom: 98px; z-index: 10001; font-family: var(--sans) }

/* ---- Floating action button ---- */
.jivi-fab {
  position: relative; width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(145deg, var(--forest) 0%, var(--jungle) 100%);
  box-shadow: 0 10px 30px rgba(13,31,23,.4), 0 0 0 3px rgba(207,174,98,.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s ease, box-shadow .25s ease;
}
.jivi-fab:hover { transform: scale(1.08); box-shadow: 0 14px 38px rgba(13,31,23,.48), 0 0 0 4px rgba(207,174,98,.5) }
.jivi-fab-avatar {
  width: 44px; height: 44px; object-fit: contain; position: relative; z-index: 2;
  border-radius: 50%; background: #fff; padding: 6px; box-shadow: 0 0 0 2px rgba(207,174,98,.55);
}
.jivi-fab-pulse {
  position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--gold-soft);
  animation: jivi-pulse 2.4s ease-out infinite;
}
@keyframes jivi-pulse {
  0%   { transform: scale(.85); opacity: .8 }
  70%  { transform: scale(1.35); opacity: 0 }
  100% { opacity: 0 }
}
.jivi-widget.open .jivi-fab-pulse { display: none }

/* ---- Invitation bubble ---- */
.jivi-bubble-hint {
  position: absolute; right: 72px; bottom: 4px; width: 232px;
  background: #fff; color: var(--forest); border-radius: 16px 16px 4px 16px;
  padding: 14px 30px 14px 16px; font-size: 13.5px; line-height: 1.5; font-weight: 500;
  box-shadow: 0 12px 32px rgba(13,31,23,.22); border: 1px solid var(--line);
  opacity: 0; transform: translateX(12px) scale(.94); pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
}
.jivi-bubble-hint.show { opacity: 1; transform: translateX(0) scale(1); pointer-events: auto }
.jivi-bubble-close {
  position: absolute; top: 6px; right: 8px; background: none; border: none; cursor: pointer;
  font-size: 16px; line-height: 1; color: var(--muted); padding: 2px;
}

/* ---- Chat panel ---- */
.jivi-panel {
  position: fixed; right: 24px; bottom: 172px; z-index: 10002;
  width: 380px; max-width: calc(100vw - 32px); height: min(520px, calc(100vh - 200px));
  background: var(--ivory); border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(13,31,23,.35); border: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform-origin: bottom right;
  opacity: 0; transform: translateY(16px) scale(.94); pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
}
.jivi-widget.open .jivi-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto }

.jivi-header {
  background: linear-gradient(120deg, var(--forest) 0%, var(--jungle) 100%);
  color: #fff; padding: 16px 16px 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0;
}
.jivi-header-info { display: flex; align-items: center; gap: 12px }
.jivi-avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: contain; padding: 7px;
  background: #fff; box-shadow: 0 0 0 2px rgba(207,174,98,.55);
}
.jivi-header-info b { font-family: var(--serif); font-size: 18px; display: block; line-height: 1.2 }
.jivi-status { font-size: 11.5px; color: rgba(255,255,255,.72); display: flex; align-items: center; gap: 5px }
.jivi-dot { width: 7px; height: 7px; border-radius: 50%; background: #57e08a; display: inline-block; box-shadow: 0 0 6px #57e08a }
.jivi-header-actions { display: flex; align-items: center; gap: 10px }
.jivi-lang-toggle { display: flex; background: rgba(255,255,255,.14); border-radius: 999px; padding: 2px }
.jivi-lang-toggle button {
  border: none; background: none; color: rgba(255,255,255,.75); font-size: 11px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; cursor: pointer; transition: .2s; letter-spacing: .02em;
}
.jivi-lang-toggle button.on { background: var(--gold); color: var(--brown) }
.jivi-close, .jivi-icon-btn { border: none; background: rgba(255,255,255,.14); color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .2s; font-size: 13px }
.jivi-close:hover, .jivi-icon-btn:hover { background: rgba(255,255,255,.26) }

.jivi-messages { flex: 1; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth }
.jivi-messages::-webkit-scrollbar { width: 5px }
.jivi-messages::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px }

.jivi-msg { display: flex; gap: 9px; max-width: 92%; animation: jivi-msg-in .32s ease }
@keyframes jivi-msg-in { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
.jivi-msg.user { align-self: flex-end; flex-direction: row-reverse; max-width: 88% }
.jivi-msg-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: contain; padding: 5px; background: var(--forest); flex-shrink: 0; align-self: flex-end }
.jivi-msg-bubble {
  background: #fff; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px;
  padding: 11px 14px; font-size: 13.8px; line-height: 1.55; color: #3c4642; white-space: pre-line;
  box-shadow: 0 3px 10px rgba(13,31,23,.05);
}
.jivi-msg.user .jivi-msg-bubble {
  background: var(--forest); color: #fff; border: none; border-radius: 16px 16px 4px 16px;
}

.jivi-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 9px }
.jivi-card {
  display: flex; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 8px; text-decoration: none; transition: .2s; align-items: center;
}
.jivi-card:hover { border-color: var(--gold); box-shadow: 0 6px 18px rgba(207,174,98,.22); transform: translateY(-1px) }
.jivi-card img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex-shrink: 0 }
.jivi-card-body b { display: block; font-size: 13px; color: var(--forest); font-family: var(--serif); line-height: 1.3 }
.jivi-card-body span { display: block; font-size: 11px; color: var(--gold-dark); font-weight: 600; margin-top: 2px }

.jivi-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px }
.jivi-link-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--gold); color: var(--brown);
  font-size: 12.5px; font-weight: 700; padding: 7px 14px; border-radius: 999px; text-decoration: none; transition: .2s;
}
.jivi-link-btn:hover { background: var(--gold-dark); color: #fff }

.jivi-quick { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; padding-left: 37px }
.jivi-quick button {
  background: var(--forest-50); border: 1px solid rgba(31,61,46,.14); color: var(--forest);
  font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: 999px; cursor: pointer; transition: .2s;
}
.jivi-quick button:hover { background: var(--gold); border-color: var(--gold); color: var(--brown) }
.jivi-quick button.jivi-menu-chip {
  background: transparent; border: 1px dashed rgba(31,61,46,.3); color: var(--muted);
}
.jivi-quick button.jivi-menu-chip:hover { background: var(--forest); border-color: var(--forest); border-style: solid; color: #fff }

.jivi-typing { display: none; align-items: center; gap: 9px; padding: 0 14px 10px }
.jivi-typing.show { display: flex }
.jivi-avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: contain; padding: 5px; background: var(--forest) }
.jivi-typing-dots { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 13px }
.jivi-typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: jivi-bounce 1.1s infinite ease-in-out }
.jivi-typing-dots span:nth-child(2) { animation-delay: .15s }
.jivi-typing-dots span:nth-child(3) { animation-delay: .3s }
@keyframes jivi-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5 } 30% { transform: translateY(-5px); opacity: 1 } }

.jivi-support-strip {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 12px; font-size: 12px; font-weight: 600; color: var(--forest);
  background: var(--forest-50); text-decoration: none; flex-shrink: 0;
  border-top: 1px solid var(--line); transition: .2s;
}
.jivi-support-strip:hover { background: rgba(207,174,98,.18); color: var(--gold-dark) }

.jivi-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fff; flex-shrink: 0 }
.jivi-input-row input {
  flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px; font-size: 13.5px;
  font-family: var(--sans); outline: none; transition: .2s; background: var(--ivory);
}
.jivi-input-row input:focus { border-color: var(--gold); background: #fff }
.jivi-input-row button {
  width: 42px; height: 42px; border-radius: 50%; border: none; background: var(--forest); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: .2s;
}
.jivi-input-row button:hover { background: var(--forest-700) }

/* ---- Mobile: full-screen takeover ---- */
@media (max-width: 560px) {
  .jivi-widget { right: 16px; bottom: 88px }
  .jivi-bubble-hint { width: 200px; right: 66px }
  .jivi-fab { width: 56px; height: 56px }
  .jivi-panel {
    right: 0; left: 0; bottom: 0; top: 0; width: 100%; max-width: 100%; height: 100%;
    border-radius: 0; transform: translateY(100%);
  }
  .jivi-widget.open .jivi-panel { transform: translateY(0) }
  .jivi-quick { padding-left: 0 }
}
