/* ================================================================
   KumbhGuide Chat Widget — SVAS Nashik Kumbh Mela 2027
   ================================================================ */

/* ── FAB button ─────────────────────────────────────────────────── */
#kg-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9000;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #5a0a14, #ff7a1a);
  border: none; cursor: pointer; color: #fff; font-size: 1.35rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(90,10,20,.45);
  transition: transform .2s, box-shadow .2s;
}
#kg-fab:hover { transform: scale(1.1); box-shadow: 0 6px 32px rgba(90,10,20,.55); }

.kg-fab-pulse {
  position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid rgba(255,122,26,.55);
  animation: kg-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes kg-pulse {
  0%   { transform: scale(1); opacity: .8; }
  100% { transform: scale(1.6); opacity: 0; }
}

.kg-badge {
  position: absolute; top: -1px; right: -1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff;
}

/* ── Panel ───────────────────────────────────────────────────────── */
#kg-panel {
  position: fixed; bottom: 92px; right: 24px; z-index: 9001;
  width: 340px; border-radius: 18px;
  background: #fff8ec; display: flex; flex-direction: column;
  box-shadow: 0 8px 48px rgba(90,10,20,.22), 0 2px 8px rgba(0,0,0,.1);
  overflow: hidden; max-height: 520px;
  transform-origin: bottom right;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s, max-height .35s ease;
}
#kg-panel.kg-hidden  { transform: scale(.82) translateY(12px); opacity: 0; pointer-events: none; }
#kg-panel.kg-minimized { max-height: 56px; }

/* ── Header ──────────────────────────────────────────────────────── */
.kg-header {
  background: linear-gradient(135deg, #5a0a14 0%, #3a060d 100%);
  padding: 11px 13px; display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; min-height: 56px;
}
.kg-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #f4b83a, #ff7a1a);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.18);
}
.kg-header-info { flex: 1; min-width: 0; }
.kg-title  { color: #f4b83a; font-weight: 700; font-size: .88rem; line-height: 1.2; font-family: 'Manrope', sans-serif; }
.kg-status { color: rgba(255,248,236,.55); font-size: .69rem; display: flex; align-items: center; gap: 4px; margin-top: 1px; }
.kg-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; display: inline-block; flex-shrink: 0; }
.kg-header-btns { display: flex; gap: 3px; }
.kg-header-btns button {
  background: rgba(255,255,255,.1); border: none; color: rgba(255,248,236,.75);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: .76rem;
  display: flex; align-items: center; justify-content: center; transition: background .15s; flex-shrink: 0;
}
.kg-header-btns button:hover { background: rgba(255,255,255,.22); color: #fff; }

/* ── Messages ────────────────────────────────────────────────────── */
.kg-messages {
  flex: 1; overflow-y: auto; padding: 12px 11px;
  display: flex; flex-direction: column; scroll-behavior: smooth;
}
.kg-messages::-webkit-scrollbar { width: 3px; }
.kg-messages::-webkit-scrollbar-thumb { background: rgba(90,10,20,.16); border-radius: 4px; }

.kg-row { display: flex; gap: 6px; }
.kg-row.kg-user { flex-direction: row-reverse; }
.kg-row.kg-mt-first { margin-top: 10px; }
.kg-row.kg-mt-cont  { margin-top: 3px; }

.kg-bot-avatar {
  width: 27px; height: 27px; border-radius: 50%;
  background: linear-gradient(135deg, #f4b83a, #ff7a1a);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; color: #fff; flex-shrink: 0; align-self: flex-end; margin-bottom: 2px;
}
.kg-avatar-spacer { width: 27px; flex-shrink: 0; }

.kg-bubble {
  max-width: 78%; padding: 8px 12px; border-radius: 16px;
  font-size: .81rem; line-height: 1.55; word-break: break-word; overflow-wrap: anywhere;
  font-family: 'Manrope', sans-serif;
}
.kg-row.kg-bot .kg-bubble {
  background: #fff; color: #2d0a10;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 5px rgba(90,10,20,.09);
}
.kg-row.kg-user .kg-bubble {
  background: linear-gradient(135deg, #5a0a14, #8b1a2a);
  color: #fff8ec; border-radius: 16px 4px 16px 16px;
}

/* ── Typing dots ──────────────────────────────────────────────────── */
.kg-typing { display: flex; gap: 4px; align-items: center; padding: 3px 2px; }
.kg-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(90,10,20,.3);
  animation: kg-dot 1.2s ease-in-out infinite;
  display: block;
}
.kg-typing span:nth-child(2) { animation-delay: .18s; }
.kg-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes kg-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .3; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Action cards ─────────────────────────────────────────────────── */
.kg-card {
  margin-top: 5px; margin-left: 33px;
  background: #fff; border: 1px solid rgba(90,10,20,.11);
  border-radius: 12px; padding: 9px 11px;
  box-shadow: 0 1px 6px rgba(90,10,20,.07); font-family: 'Manrope', sans-serif;
}
.kg-card-title { font-weight: 700; color: #5a0a14; font-size: .76rem; margin-bottom: 7px; }
.kg-card-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 99px;
  background: linear-gradient(135deg, #5a0a14, #ff7a1a);
  color: #fff; text-decoration: none; font-size: .74rem; font-weight: 700;
  transition: opacity .2s;
}
.kg-card-btn:hover { opacity: .88; color: #fff; }
.kg-emg-btns { display: flex; flex-direction: column; gap: 5px; }
.kg-emg-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  background: rgba(239,68,68,.07); border: 1px solid rgba(239,68,68,.2);
  color: #2d0a10; text-decoration: none; font-size: .74rem; font-weight: 600;
  transition: background .15s;
}
.kg-emg-btn:hover { background: rgba(239,68,68,.15); }
.kg-emg-btn .fas { color: #ef4444; font-size: .7rem; flex-shrink: 0; }
.kg-emg-btn strong { margin-left: auto; color: #5a0a14; }

/* ── Chips ────────────────────────────────────────────────────────── */
.kg-chips {
  padding: 7px 9px; display: flex; flex-wrap: wrap; gap: 5px;
  border-top: 1px solid rgba(90,10,20,.07); background: rgba(255,248,236,.7);
  flex-shrink: 0;
}
.kg-chips:empty { border-top: none; padding: 0; }
.kg-chip {
  padding: 4px 10px; border-radius: 99px;
  border: 1px solid rgba(90,10,20,.2); background: transparent;
  color: #5a0a14; font-size: .7rem; font-weight: 600; cursor: pointer;
  transition: all .15s; font-family: 'Manrope', sans-serif;
}
.kg-chip:hover { background: #5a0a14; color: #fff8ec; border-color: #5a0a14; }

/* ── Input row ────────────────────────────────────────────────────── */
.kg-input-row {
  display: flex; gap: 7px; padding: 9px 10px;
  border-top: 1px solid rgba(90,10,20,.07); background: #fff;
  flex-shrink: 0; align-items: center;
}
.kg-input {
  flex: 1; border: 1px solid rgba(90,10,20,.14); border-radius: 99px;
  padding: 7px 13px; font-size: .8rem; outline: none;
  background: #fff8ec; color: #2d0a10; font-family: 'Manrope', sans-serif;
  transition: border-color .2s;
}
.kg-input:focus { border-color: #ff7a1a; }
.kg-input::placeholder { color: rgba(90,10,20,.32); }
.kg-send {
  width: 33px; height: 33px; border-radius: 50%;
  background: linear-gradient(135deg, #5a0a14, #ff7a1a);
  border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; flex-shrink: 0; transition: transform .15s, opacity .15s;
}
.kg-send:hover:not(:disabled) { transform: scale(1.1); }
.kg-send:disabled { opacity: .38; cursor: not-allowed; }

/* ── Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 420px) {
  #kg-panel { width: calc(100vw - 28px); right: 14px; bottom: 82px; }
  #kg-fab   { right: 14px; bottom: 18px; }
}

/* ── Dark mode ────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  #kg-panel { background: #1a0508; }
  .kg-messages { background: #1a0508; }
  .kg-row.kg-bot .kg-bubble { background: #2d0a10; color: #fff8ec; box-shadow: 0 1px 5px rgba(0,0,0,.3); }
  .kg-chips { background: rgba(45,10,16,.7); border-top-color: rgba(255,122,26,.12); }
  .kg-chip { color: #f4b83a; border-color: rgba(244,184,58,.28); }
  .kg-chip:hover { background: #f4b83a; color: #1a0508; border-color: #f4b83a; }
  .kg-input-row { background: #2d0a10; border-top-color: rgba(255,122,26,.12); }
  .kg-input { background: #1a0508; color: #fff8ec; border-color: rgba(255,122,26,.22); }
  .kg-input::placeholder { color: rgba(255,248,236,.35); }
  .kg-card { background: #2d0a10; border-color: rgba(255,122,26,.18); }
  .kg-emg-btn { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.25); color: #fff8ec; }
  .kg-emg-btn:hover { background: rgba(239,68,68,.22); }
}
[data-theme="dark"] #kg-panel { background: #1a0508; }
[data-theme="dark"] .kg-messages { background: #1a0508; }
[data-theme="dark"] .kg-row.kg-bot .kg-bubble { background: #2d0a10; color: #fff8ec; box-shadow: 0 1px 5px rgba(0,0,0,.3); }
[data-theme="dark"] .kg-chips { background: rgba(45,10,16,.7); border-top-color: rgba(255,122,26,.12); }
[data-theme="dark"] .kg-chip { color: #f4b83a; border-color: rgba(244,184,58,.28); }
[data-theme="dark"] .kg-chip:hover { background: #f4b83a; color: #1a0508; border-color: #f4b83a; }
[data-theme="dark"] .kg-input-row { background: #2d0a10; border-top-color: rgba(255,122,26,.12); }
[data-theme="dark"] .kg-input { background: #1a0508; color: #fff8ec; border-color: rgba(255,122,26,.22); }
[data-theme="dark"] .kg-input::placeholder { color: rgba(255,248,236,.35); }
[data-theme="dark"] .kg-card { background: #2d0a10; border-color: rgba(255,122,26,.18); }
[data-theme="dark"] .kg-emg-btn { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.25); color: #fff8ec; }
[data-theme="dark"] .kg-emg-btn:hover { background: rgba(239,68,68,.22); }
