/* ─── Jyoti AI Chat Widget ────────────────────────────────────────────────── */

/* Import a clean, regal font for the chatbot header */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500&display=swap');

/* FAB Button */
#jyoti-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a84c 0%, #8b5e3c 100%);
  box-shadow: 0 6px 24px rgba(201, 168, 76, 0.45);
  border: none;
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#jyoti-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 32px rgba(201, 168, 76, 0.6);
}
#jyoti-fab svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  transition: opacity 0.2s;
}
#jyoti-fab.open svg.icon-chat { opacity: 0; position: absolute; }
#jyoti-fab.open svg.icon-close { opacity: 1; position: relative; }
#jyoti-fab:not(.open) svg.icon-chat { opacity: 1; position: relative; }
#jyoti-fab:not(.open) svg.icon-close { opacity: 0; position: absolute; }

/* Chat Window */
#jyoti-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 130px);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 9997;
  background: rgba(15, 12, 25, 0.82);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(201, 168, 76, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(201, 168, 76, 0.12);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
#jyoti-window.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#jyoti-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.18), rgba(139, 94, 60, 0.12));
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
#jyoti-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a84c, #8b5e3c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
#jyoti-header-text h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: #e8d5a3;
  margin: 0;
  letter-spacing: 0.04em;
}
#jyoti-header-text p {
  font-size: 0.72rem;
  color: rgba(201, 168, 76, 0.7);
  margin: 0;
  margin-top: 2px;
}
#jyoti-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  margin-left: auto;
  flex-shrink: 0;
  box-shadow: 0 0 6px #22c55e;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Context Badge */
#jyoti-context-badge {
  padding: 6px 14px;
  background: rgba(201, 168, 76, 0.08);
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  font-size: 0.7rem;
  color: rgba(201, 168, 76, 0.65);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Messages */
#jyoti-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
#jyoti-messages::-webkit-scrollbar { width: 4px; }
#jyoti-messages::-webkit-scrollbar-track { background: transparent; }
#jyoti-messages::-webkit-scrollbar-thumb { background: rgba(201, 168, 76, 0.25); border-radius: 4px; }

/* Message Bubbles */
.jyoti-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: msg-in 0.25s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.jyoti-msg.user { align-self: flex-end; align-items: flex-end; }
.jyoti-msg.ai   { align-self: flex-start; align-items: flex-start; }

.jyoti-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
}
.jyoti-msg.user .jyoti-bubble {
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.28), rgba(139, 94, 60, 0.2));
  border: 1px solid rgba(201, 168, 76, 0.3);
  color: #f0e6c8;
  border-bottom-right-radius: 4px;
}
.jyoti-msg.ai .jyoti-bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ddd6c8;
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.jyoti-typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
}
.jyoti-typing-indicator span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.6);
  animation: bounce-dot 1.2s infinite;
}
.jyoti-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.jyoti-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1.1); opacity: 1; }
}

/* Follow-up chips */
#jyoti-followups {
  padding: 10px 16px 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex-shrink: 0;
}
.jyoti-chip {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(201, 168, 76, 0.35);
  background: rgba(201, 168, 76, 0.08);
  color: #d4b96a;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.jyoti-chip:hover {
  background: rgba(201, 168, 76, 0.2);
  border-color: rgba(201, 168, 76, 0.6);
  color: #e8d5a3;
}

/* Input Area */
#jyoti-input-area {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(201, 168, 76, 0.15);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
#jyoti-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  color: #e8d5a3;
  font-size: 0.875rem;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  outline: none;
  line-height: 1.4;
  transition: border-color 0.2s;
}
#jyoti-input::placeholder { color: rgba(201, 168, 76, 0.35); }
#jyoti-input:focus { border-color: rgba(201, 168, 76, 0.5); }
#jyoti-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a84c, #8b5e3c);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
  align-self: flex-end;
}
#jyoti-send:hover { transform: scale(1.08); }
#jyoti-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
#jyoti-send svg { width: 16px; height: 16px; fill: #fff; }

/* Unavailable state */
#jyoti-unavailable {
  padding: 20px;
  text-align: center;
  color: rgba(201, 168, 76, 0.55);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* Mobile responsive */
@media (max-width: 480px) {
  #jyoti-window {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    height: 70vh;
  }
  #jyoti-fab {
    bottom: 20px;
    right: 20px;
  }
}
