/* chat-widget.css – 100% FIXED: no top cutoff + never goes off-screen */

#chat-container .message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.5;
  animation: fadeIn 0.4s ease-out;
}
#chat-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px 12px !important;  /* ← generous top padding */
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
}

/* BEAUTIFUL QUICK ACTION BUTTONS */
#chat-container .buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
  justify-content: flex-start;
}

#chat-container .button {
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  text-align: center;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.2s;
  text-decoration: none !important;
  font-size: 15px;
}

#chat-container .button.primary {
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #1F2937;
}

#chat-container .button.secondary {
  background: #374151;
  color: white;
}

#chat-container .button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

#chat-container::-webkit-scrollbar { width: 6px; }
#chat-container::-webkit-scrollbar-track { background: transparent; }
#chat-container::-webkit-scrollbar-thumb { 
  background: rgba(0,0,0,0.2); 
  border-radius: 3px; 
}
.dark #chat-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); }

#chat-container .user {
  align-self: flex-end;
  background: #FBBF24;
  color: #1F2937;
  border-bottom-right-radius: 4px;
}
#chat-container .assistant {
  align-self: flex-start;
  background: #E5E7EB;
  color: #1F2937;
  border-bottom-left-radius: 4px;
}
.dark #chat-container .assistant { 
  background: #374151; 
  color: #F3F4F6; 
}
#chat-container .assistant.typing::after {
  content: "...";
  animation: blink 1.5s infinite;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* =============== PANEL POSITIONING – NEVER OFF-SCREEN =============== */
#chat-panel {
  position: fixed !important;
  bottom: 100px !important;        /* space for the yellow bubble */
  top: auto !important;
  right: 16px;
  left: 16px;
  max-width: 420px;
  width: calc(100vw - 32px);
  /* Height is now dynamic and safe */
  height: auto;
  max-height: calc(100vh - 120px) !important; /* ← THIS IS THE KEY LINE */
  min-height: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  background: white;
  overflow: hidden;
  transform-origin: bottom right;
  transition: all 0.3s ease;
}

/* Open state */
#chat-panel.open {
  opacity: 1;
  scale: 1;
  pointer-events: auto;
}

/* Desktop */
@media (min-width: 640px) {
  #chat-panel {
    bottom: 100px !important;   /* same value again for desktop */
    height: 600px !important;   /* your nice tall height */
    max-height: calc(100vh - 120px) !important;
    width: 420px;
    left: auto;
  }
}

/* Mobile – almost full screen */
@media (max-width: 640px) {
  #chat-panel {
    bottom: 100px !important;
    height: calc(100vh - 160px);
    max-height: none;
    border-radius: 20px;
  }
  #wavecomm-chat-widget button#chat-toggle {
    bottom: 20px;
    right: 20px;
  }
}
