/* ─── Toggle Button ─────────────────────────────────────────── */
#chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0d0d0d;
  border: none;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-toggle:focus {
  outline: 2px solid #f5f5f5; /* subtle white ring instead of blue glow */
  outline-offset: 1px;
}

/* ─── Chat Window ────────────────────────────────────────────── */
#chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  height: 560px; /* larger default — assumes user needs the space */
  /* background: #1a1a1a; */
  background: white;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* fully hidden — toggle button brings it back */
#chat-window.hidden {
  display: none;
}

/* ─── Header ─────────────────────────────────────────────────── */
#chat-header {
  background: #2A2A2D;
  color: white;
  padding: 18px 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0; /* stays fixed at top, never shrinks */
}

#chat-header-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Close button — sits right side of header */
#close-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}

/* Refresh button — matches close, no hover animation */
#refresh-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
}


/* ─── Messages ───────────────────────────────────────────────── */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  padding: 8px 12px;
  border-radius: 18px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.5; /* breathing room for longer replies */
}

.message.bot {
  background: #EFEFEF;
  color: #333;
  align-self: flex-start;
}

.message.user {
  background: #2A2A2D;
  color: white;
  align-self: flex-end;
}

/* ─── Starter Prompts ────────────────────────────────────────── */
#starter-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid #EFEFEF;
}

/* Tappable suggestion buttons */
.starter-btn {
  background: #EFEFEF;
  color: #333;
  border: none;
  border-radius: 18px;
  padding: 8px 12px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.starter-btn:hover {
  background: #2A2A2D;
  color: white;
}

/* ─── Input Row ──────────────────────────────────────────────── */
#chat-input-row {
  display: flex;
  padding: 8px;
  border-top: 1px solid #EFEFEF;
  flex-shrink: 0; /* always visible at bottom */
}

#chat-input {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid white;
  background: transparent;
  color: #333;
}

#chat-input:focus {
  outline: 1px solid #EFEFEF;
  border-color: #EFEFEF;
}

#chat-send {
  margin-left: 8px;
  padding: 8px 22px;
  background: #2A2A2D;
  color: white;
  border: none;
  border-radius: 22px;
  cursor: pointer;
}

/* ─── Scroll Nudge ───────────────────────────────────────────── */
/* Desktop only — hidden on mobile via media query at bottom */
#chat-nudge {
  cursor: pointer;
  position: fixed;
  bottom: 90px; /* sits just above the toggle button */
  right: 20px;
  background: #2A2A2D; /* matches header color — reads clearly against both light page and dark footer */
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  max-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 999;
  opacity: 1;
  transition: opacity 0.4s ease; /* smooth fade out on dismiss */
}

#chat-nudge.hidden {
  display: none;
}

#chat-nudge.fade-out {
  opacity: 0; /* fade before removing from DOM */
  pointer-events: none;
}

/* Close button inside nudge */
#nudge-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0; /* prevents button from shrinking */
}

/* Hide nudge entirely on mobile — chat toggle is prominent enough */
@media (max-width: 480px) {
  #chat-nudge {
    display: none !important;
  }
}

/* ANIMATIONS CONSIDERATIONS */
/* Keyframe: slides up slightly and fades in on open */
@keyframes chatSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply to chat window when visible — remove hidden class triggers this */
#chat-window:not(.hidden) {
  animation: chatSlideUp 0.25s ease;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  #chat-window {
    width: calc(100vw - 40px); /* full width minus small margin on each side */
    height: 61vh; /* caps height so it doesn't overtake the whole screen */
    right: 20px;
    bottom: 88px;
  }
}