/* ============================================
   Neon Auto Transport — AI Chat Widget Styles
   Matches existing Stripe-inspired design system
   ============================================ */

/* ---- CSS Variables (inherit from site) ---- */
:root {
  --chat-primary: #635bff;
  --chat-primary-dark: #534be8;
  --chat-accent-cyan: #00d4ff;
  --chat-accent-green: #39FF14;
  --chat-dark: #0a2540;
  --chat-dark-mid: #1a385a;
  --chat-slate: #425466;
  --chat-light: #f6f9fc;
  --chat-border: #e6e6e6;
  --chat-white: #ffffff;
  --chat-shadow: 0 13px 27px -5px rgba(50, 50, 93, 0.25), 0 8px 16px -8px rgba(0, 0, 0, 0.3);
  --chat-shadow-lg: 0 30px 60px -12px rgba(50, 50, 93, 0.3), 0 18px 36px -18px rgba(0, 0, 0, 0.35);
  --chat-radius: 16px;
  --chat-width: 400px;
  --chat-height: 620px;
}

/* ---- Floating Action Button (Bubble) ---- */
#neon-chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), #7c3aed);
  color: var(--chat-white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(99, 91, 255, 0.5), 0 0 30px rgba(99, 91, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  animation: chatBubblePulse 3s ease-in-out infinite;
}

#neon-chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(99, 91, 255, 0.6), 0 0 40px rgba(99, 91, 255, 0.3);
}

#neon-chat-bubble svg {
  width: 28px;
  height: 28px;
  transition: transform 0.3s ease;
}

#neon-chat-bubble.open svg.chat-icon { display: none; }
#neon-chat-bubble.open svg.close-icon { display: block; }
#neon-chat-bubble:not(.open) svg.chat-icon { display: block; }
#neon-chat-bubble:not(.open) svg.close-icon { display: none; }

@keyframes chatBubblePulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(99, 91, 255, 0.5), 0 0 30px rgba(99, 91, 255, 0.2); }
  50% { box-shadow: 0 4px 30px rgba(99, 91, 255, 0.7), 0 0 50px rgba(99, 91, 255, 0.35); }
}

/* Badge / Notification Dot */
#neon-chat-bubble .chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--chat-accent-green);
  border: 2px solid var(--chat-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: var(--chat-dark);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
  animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badgePop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* ---- Chat Window ---- */
#neon-chat-window {
  position: fixed;
  bottom: 104px;
  right: 28px;
  z-index: 9999;
  width: var(--chat-width);
  height: var(--chat-height);
  max-height: calc(100vh - 140px);
  border-radius: var(--chat-radius);
  background: var(--chat-white);
  box-shadow: var(--chat-shadow-lg);
  border: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.165, 0.84, 0.44, 1),
              transform 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#neon-chat-window.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ---- Chat Header ---- */
.neon-chat-header {
  background: linear-gradient(135deg, var(--chat-dark), #0f3460);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.neon-chat-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(99, 91, 255, 0.15), rgba(0, 212, 255, 0.1));
  pointer-events: none;
}

.neon-chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.neon-chat-header-avatar svg {
  width: 22px;
  height: 22px;
  color: var(--chat-white);
}

.neon-chat-header-info {
  flex: 1;
  position: relative;
  z-index: 1;
}

.neon-chat-header-info h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--chat-white) !important;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.neon-chat-header-info p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin: 2px 0 0;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.neon-chat-header-info .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chat-accent-green);
  display: inline-block;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.neon-chat-header-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: rgba(255, 255, 255, 0.7);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.neon-chat-header-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--chat-white);
}

/* ---- Messages Container ---- */
.neon-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--chat-light);
  scroll-behavior: smooth;
}

/* Custom scrollbar for messages */
.neon-chat-messages::-webkit-scrollbar {
  width: 4px;
}
.neon-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.neon-chat-messages::-webkit-scrollbar-thumb {
  background: #cdd5df;
  border-radius: 2px;
}

/* ---- Message Bubbles ---- */
.neon-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 500;
  animation: msgSlideIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  word-wrap: break-word;
}

@keyframes msgSlideIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* AI (bot) message — left aligned */
.neon-msg.bot {
  align-self: flex-start;
  background: var(--chat-white);
  color: var(--chat-dark);
  border: 1px solid var(--chat-border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* User message — right aligned */
.neon-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--chat-primary), #7c3aed);
  color: var(--chat-white);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(99, 91, 255, 0.3);
}

/* Message timestamp */
.neon-msg-time {
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.5;
  font-weight: 400;
}

.neon-msg.bot .neon-msg-time { text-align: left; }
.neon-msg.user .neon-msg-time { text-align: right; }

/* ---- Typing Indicator ---- */
.neon-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
  background: var(--chat-white);
  border: 1px solid var(--chat-border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  animation: msgSlideIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.neon-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #adb5c4;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.neon-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.neon-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); background: #adb5c4; }
  30% { transform: translateY(-6px); background: var(--chat-primary); }
}

/* ---- Input Area ---- */
.neon-chat-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--chat-border);
  background: var(--chat-white);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.neon-chat-input {
  flex: 1;
  padding: 11px 16px !important;
  border: 1px solid var(--chat-border) !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 500 !important;
  color: var(--chat-dark) !important;
  background: var(--chat-light) !important;
  outline: none !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  box-shadow: none !important;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  line-height: 1.4 !important;
}

.neon-chat-input:focus {
  border-color: var(--chat-primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.15) !important;
  background: var(--chat-white) !important;
}

.neon-chat-input::placeholder {
  color: #a1b0c0 !important;
  font-weight: 400 !important;
}

.neon-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--chat-primary);
  color: var(--chat-white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(99, 91, 255, 0.3);
}

.neon-chat-send:hover {
  background: var(--chat-primary-dark);
  transform: scale(1.05);
}

.neon-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.neon-chat-send svg {
  width: 18px;
  height: 18px;
}

/* ---- Shipment Summary Card (Killer Feature) ---- */
.neon-shipment-summary {
  align-self: flex-start;
  width: 100%;
  max-width: 95%;
  background: var(--chat-white);
  border-radius: 16px;
  border: 2px solid var(--chat-accent-green);
  box-shadow: 0 4px 20px rgba(57, 255, 20, 0.15), 0 1px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  animation: summarySlideIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes summarySlideIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.neon-summary-header {
  background: linear-gradient(135deg, var(--chat-dark), #0f3460);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.neon-summary-header span {
  font-size: 14px;
  font-weight: 800;
  color: var(--chat-white);
  letter-spacing: 0.02em;
}

.neon-summary-body {
  padding: 16px 18px;
}

.neon-summary-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.neon-summary-row:last-child {
  border-bottom: none;
}

.neon-summary-row .icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.neon-summary-row .label {
  font-size: 10px;
  font-weight: 700;
  color: #a1b0c0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
  margin-bottom: 3px;
}

.neon-summary-row .value {
  font-size: 14px;
  font-weight: 700;
  color: var(--chat-dark);
  line-height: 1.3;
}

.neon-summary-route-arrow {
  color: var(--chat-primary);
  font-weight: 900;
  margin: 0 4px;
}

.neon-summary-footer {
  padding: 14px 18px;
  background: #f0fdf4;
  border-top: 1px solid #dcfce7;
  text-align: center;
}

.neon-summary-footer .success-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--chat-accent-green);
  color: var(--chat-dark);
  font-size: 12px;
  font-weight: 800;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
}

.neon-summary-footer p {
  font-size: 12px;
  color: var(--chat-slate);
  margin-top: 6px;
  font-weight: 500;
}

/* ---- Call CTA Button ---- */
.neon-chat-call-cta {
  align-self: flex-start;
  width: 100%;
  max-width: 95%;
  animation: msgSlideIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.neon-chat-call-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--chat-accent-green);
  color: var(--chat-dark);
  font-size: 16px;
  font-weight: 800;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
  transition: all 0.3s;
}

.neon-chat-call-cta a:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.5);
}

.neon-chat-call-cta a svg {
  width: 18px;
  height: 18px;
}

.neon-chat-call-cta .subtext {
  text-align: center;
  font-size: 11px;
  color: var(--chat-slate);
  margin-top: 6px;
  font-weight: 500;
}

/* ---- Quick Reply Buttons ---- */
.neon-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.neon-quick-reply {
  padding: 7px 14px;
  border: 1px solid var(--chat-border);
  border-radius: 20px;
  background: var(--chat-white);
  color: var(--chat-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.neon-quick-reply:hover {
  background: var(--chat-primary);
  color: var(--chat-white);
  border-color: var(--chat-primary);
  transform: translateY(-1px);
}

/* ---- Powered-by Footer ---- */
.neon-chat-powered {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: #a1b0c0;
  font-weight: 500;
  background: var(--chat-white);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.neon-chat-powered strong {
  color: var(--chat-primary);
  font-weight: 700;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 640px) {
  /* Hide chatbot entirely on mobile */
  #neon-chat-bubble,
  #neon-chat-window {
    display: none !important;
  }
}

/* ---- Disabled state (while AI is thinking) ---- */
.neon-chat-input-area.disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* ---- Welcome screen (initial state before first message) ---- */
.neon-chat-welcome {
  text-align: center;
  padding: 30px 20px;
}

.neon-chat-welcome h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--chat-dark) !important;
  margin-bottom: 6px;
}

.neon-chat-welcome p {
  font-size: 13px;
  color: var(--chat-slate);
  line-height: 1.5;
  font-weight: 500;
}
