/* help.css - AI Chat Assistant styles for Rate The Plate */

/* Floating chat button */
.help-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.25s ease;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-btn:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
  transform: scale(1.08);
}

.help-btn:focus {
  outline: 3px solid #f39c12;
  outline-offset: 2px;
}

/* Chat window container */
.ai-chat-container {
  position: fixed;
  bottom: 84px;
  right: 20px;
  width: 340px;
  max-height: 480px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.ai-chat-container.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.ai-chat-header {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-chat-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.ai-chat-title {
  color: white;
  font-weight: 600;
  font-size: 14px;
  font-family: "Poppins", sans-serif;
}

.ai-chat-subtitle {
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
  font-family: "Poppins", sans-serif;
}

.ai-chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}

.ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Messages area */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Message rows */
.ai-chat-message {
  display: flex;
}

.ai-chat-message--user {
  justify-content: flex-end;
}

.ai-chat-message--bot {
  justify-content: flex-start;
}

/* Bubbles */
.ai-chat-bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  font-family: "Poppins", sans-serif;
  word-break: break-word;
}

.ai-chat-message--user .ai-chat-bubble {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.ai-chat-message--bot .ai-chat-bubble {
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.ai-chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.ai-chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  animation: ai-bounce 1.2s infinite ease-in-out;
}

.ai-chat-typing span:nth-child(1) {
  animation-delay: 0s;
}

.ai-chat-typing span:nth-child(2) {
  animation-delay: 0.18s;
}

.ai-chat-typing span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes ai-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* Input row */
.ai-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.ai-chat-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: "Poppins", sans-serif;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  transition: border-color 0.15s;
}

.ai-chat-input:focus {
  border-color: #2563eb;
  background: #ffffff;
}

.ai-chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ai-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.ai-chat-send-btn:hover {
  opacity: 0.88;
  transform: scale(1.06);
}

.ai-chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Dark mode */
body.dark-mode .help-btn {
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.35);
}

body.dark-mode .ai-chat-container {
  background: #1e293b;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body.dark-mode .ai-chat-message--bot .ai-chat-bubble {
  background: #334155;
  color: #e2e8f0;
}

body.dark-mode .ai-chat-input {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .ai-chat-input:focus {
  border-color: #60a5fa;
  background: #1e293b;
}

body.dark-mode .ai-chat-input-row {
  border-top-color: #334155;
}

body.dark-mode .ai-chat-typing span {
  background: #64748b;
}

/* Accessibility mode */
body.accessibility-mode .help-btn {
  background: linear-gradient(135deg, #000080 0%, #000050 100%) !important;
  border: 3px solid #ffcc00 !important;
  color: #ffff00 !important;
}

body.accessibility-mode .ai-chat-container {
  background: #fffef0 !important;
  border: 3px solid #000 !important;
}

body.accessibility-mode .ai-chat-header {
  background: linear-gradient(135deg, #000080 0%, #000050 100%) !important;
  border-bottom: 3px solid #ffcc00 !important;
}

body.accessibility-mode .ai-chat-message--bot .ai-chat-bubble {
  background: #ffff99 !important;
  color: #000 !important;
  border: 1px solid #000;
}

body.accessibility-mode .ai-chat-message--user .ai-chat-bubble {
  background: #000080 !important;
  color: #ffff00 !important;
}

body.accessibility-mode .ai-chat-input {
  background: #fff !important;
  border: 2px solid #000 !important;
  color: #000 !important;
}

body.accessibility-mode .ai-chat-send-btn {
  background: #000080 !important;
  border: 2px solid #ffcc00 !important;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .ai-chat-container {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 80px;
  }
}
