/* ==========================================================================
   AI CUSTOMER SUPPORT CHATBOT STYLES
   ========================================================================== */

:root {
  --ai-primary: #e60012; /* Signature Honda Red */
  --ai-primary-hover: #cc0010;
  --ai-primary-light: #fff0f1;
  --ai-dark: #1e293b;
  --ai-gray-bg: #f8fafc;
  --ai-gray-border: #e2e8f0;
  --ai-text-main: #0f172a;
  --ai-text-muted: #64748b;
  --ai-shadow: 0 12px 36px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(230, 0, 18, 0.1);
  --ai-radius: 16px;
}

/* Floating Trigger Button */
.ai-chat-toggle-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e60012 0%, #111827 100%);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 24px rgba(230, 0, 18, 0.35);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.ai-chat-toggle-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(230, 0, 18, 0.5);
}

.ai-chat-toggle-btn:active {
  transform: scale(0.95);
}

/* Pulsing Badge & Notification Ring */
.ai-chat-pulse-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid #e60012;
  animation: aiPulse 2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes aiPulse {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.15);
    opacity: 0;
  }
  100% {
    transform: scale(0.95);
    opacity: 0;
  }
}

.ai-chat-unread-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #22c55e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Main Chat Modal Container */
.ai-chat-modal {
  position: fixed;
  bottom: 98px;
  right: 25px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 590px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: var(--ai-radius);
  box-shadow: var(--ai-shadow);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-chat-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.ai-chat-header {
  background: linear-gradient(135deg, #e60012 0%, #b3000e 100%);
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.ai-avatar-wrapper {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ai-avatar-wrapper img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.ai-avatar-icon {
  font-size: 20px;
  color: var(--ai-primary);
}

.ai-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.ai-chat-header-text h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}

.ai-chat-header-text span {
  font-size: 11px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.ai-header-btn {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
}

.ai-header-btn:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* Chat Messages Container */
.ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

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

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

/* Date / Intro Divider */
.ai-chat-divider {
  text-align: center;
  margin: 4px 0;
}

.ai-chat-divider span {
  background: #e2e8f0;
  color: #64748b;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

/* Message Rows */
.ai-msg-row {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: aiMsgFadeIn 0.3s ease-out;
}

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

.ai-msg-row.ai {
  align-self: flex-start;
}

.ai-msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e60012 0%, #111827 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.ai-msg-bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
  position: relative;
}

.ai-msg-row.ai .ai-msg-bubble {
  background: #ffffff;
  color: var(--ai-text-main);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #f1f5f9;
}

.ai-msg-row.user .ai-msg-bubble {
  background: linear-gradient(135deg, #e60012 0%, #c80010 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(230, 0, 18, 0.2);
}

.ai-msg-time {
  font-size: 10px;
  color: var(--ai-text-muted);
  margin-top: 4px;
  display: block;
}

.ai-msg-row.user .ai-msg-time {
  color: rgba(255, 255, 255, 0.8);
  text-align: right;
}

/* Rich Card Inside Chat */
.ai-product-card {
  margin-top: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

.ai-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.ai-product-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  background: #f1f5f9;
}

.ai-product-info {
  padding: 10px 12px;
}

.ai-product-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--ai-text-main);
  margin: 0 0 6px 0;
  line-height: 1.3;
}

.ai-product-prices {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ai-product-price {
  color: var(--ai-primary);
  font-weight: 700;
  font-size: 14px;
}

.ai-product-oldprice {
  color: #94a3b8;
  font-size: 11px;
  text-decoration: line-through;
}

.ai-product-btn {
  display: inline-block;
  width: 100%;
  padding: 8px 0;
  background: var(--ai-primary);
  color: #ffffff !important;
  text-align: center;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.ai-product-btn:hover {
  background: var(--ai-primary-hover);
}

/* Quick Suggestion Chips */
.ai-quick-chips-wrapper {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-chip-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ai-chip-btn:hover {
  background: var(--ai-primary);
  border-color: var(--ai-primary);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Typing Indicator Animation */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  border: 1px solid #f1f5f9;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: aiTypingBounce 1.4s infinite ease-in-out both;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes aiTypingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Footer / Input Bar */
.ai-chat-footer {
  padding: 12px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
}

.ai-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  border: 1.5px solid transparent;
  transition: all 0.2s;
}

.ai-input-form:focus-within {
  background: #ffffff;
  border-color: var(--ai-primary);
  box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.12);
}

.ai-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--ai-text-main);
  padding: 6px 0;
}

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

.ai-send-btn {
  background: linear-gradient(135deg, #e60012 0%, #c80010 100%);
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 2px 6px rgba(230, 0, 18, 0.3);
}

.ai-send-btn:hover {
  transform: scale(1.05);
}

.ai-send-btn:active {
  transform: scale(0.92);
}

.ai-footer-branding {
  text-align: center;
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 6px;
}

.ai-footer-branding i {
  color: var(--ai-primary);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .ai-chat-modal {
    right: 12px;
    bottom: 85px;
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
  }
  .ai-chat-toggle-btn {
    bottom: 18px;
    right: 18px;
    width: 56px;
    height: 56px;
  }
}
