/* ===== PRCtrip AI Chat Widget ===== */

/* Chat Toggle Button */
#ai-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary, #c0392b), var(--primary-dark, #96281b));
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(192, 57, 43, 0.4);
  transition: all 0.3s ease;
  z-index: 99999;
  animation: chatPulse 3s ease-in-out infinite;
}

#ai-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(192, 57, 43, 0.55);
}

#ai-chat-toggle.active {
  animation: none;
  transform: rotate(90deg) scale(1);
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(192, 57, 43, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(192, 57, 43, 0.65); }
}

/* Chat Window */
#ai-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  animation: chatSlideUp 0.35s ease;
}

#ai-chat-window.open {
  display: flex;
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Chat Header */
.ai-chat-header {
  background: linear-gradient(135deg, #c0392b, #96281b);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ai-chat-header .ai-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;
}

.ai-chat-header .ai-info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.ai-chat-header .ai-info p {
  margin: 0;
  font-size: 11px;
  opacity: 0.85;
  font-weight: 400;
}

.ai-chat-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  padding: 4px;
}

.ai-chat-close:hover {
  opacity: 1;
}

/* Chat Messages */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fa;
}

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

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

/* Message Bubbles */
.ai-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
}

.ai-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ai-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #c0392b, #96281b);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-msg.bot a {
  color: #c0392b;
  text-decoration: underline;
}

/* Typing Indicator */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
  background: #fff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ai-typing span {
  width: 7px;
  height: 7px;
  background: #999;
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Quick Suggestions */
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 4px;
  background: #f8f9fa;
}

.ai-suggestion-btn {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  color: #c0392b;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.ai-suggestion-btn:hover {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}

/* Chat Input */
.ai-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}

.ai-chat-input input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.ai-chat-input input:focus {
  border-color: #c0392b;
}

.ai-chat-input input::placeholder {
  color: #aaa;
}

.ai-chat-input button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c0392b, #96281b);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-chat-input button:hover {
  transform: scale(1.08);
}

.ai-chat-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Error message */
.ai-msg.error {
  background: #fff3f3;
  color: #c0392b;
  border: 1px solid #fdd;
}

/* Responsive */
@media (max-width: 480px) {
  #ai-chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  #ai-chat-toggle {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
    font-size: 22px;
  }
}
