/* Thunder EV Smart Assistant — right stack between product search & WhatsApp */
.tev-ev-assistant {
  position: fixed;
  right: 1.25rem;
  left: auto;
  bottom: 5.35rem;
  z-index: 1003;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: min(380px, calc(100vw - 2.5rem));
  pointer-events: none;
  font-family: 'Poppins', system-ui, sans-serif;
}

.tev-ev-assistant > * {
  pointer-events: auto;
}

.tev-ev-assistant__panel {
  display: none;
  flex-direction: column;
  width: min(360px, calc(100vw - 2.5rem));
  max-height: min(70vh, 520px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(37, 99, 235, 0.2);
  overflow: hidden;
}

.tev-ev-assistant.is-open .tev-ev-assistant__panel {
  display: flex;
}

.tev-ev-assistant__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  color: #fff;
}

.tev-ev-assistant__header h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
}

.tev-ev-assistant__header p {
  margin: 0;
  font-size: 0.62rem;
  opacity: 0.9;
}

.tev-ev-assistant__header-actions {
  display: flex;
  gap: 0.35rem;
}

.tev-ev-assistant__header-actions button {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.tev-ev-assistant__messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  background: #f8fafc;
  min-height: 200px;
  max-height: 320px;
}

.tev-ev-assistant__msg {
  margin-bottom: 0.65rem;
  max-width: 92%;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.tev-ev-assistant__msg--user {
  margin-left: auto;
  background: #2563eb;
  color: #fff;
  padding: 0.5rem 0.65rem;
  border-radius: 12px 12px 4px 12px;
}

.tev-ev-assistant__msg--bot {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  padding: 0.5rem 0.65rem;
  border-radius: 12px 12px 12px 4px;
}

.tev-ev-assistant__msg--bot.marketplace {
  border-left: 3px solid #22c55e;
}

.tev-ev-assistant__msg--typing {
  opacity: 0.7;
  font-style: italic;
}

.tev-ev-assistant__source {
  font-size: 0.58rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.tev-ev-assistant__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}

.tev-ev-assistant__quick button {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 99px;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #1e40af;
  cursor: pointer;
}

.tev-ev-assistant__quick button:hover {
  background: #dbeafe;
}

.tev-ev-assistant__input-row {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}

.tev-ev-assistant__input-row input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  outline: none;
}

.tev-ev-assistant__input-row button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-weight: 700;
  font-size: 0.72rem;
  cursor: pointer;
}

.tev-ev-assistant__fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #1e3a8a, #0ea5e9);
  color: #fff;
  box-shadow: 0 6px 22px rgba(14, 165, 233, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tev-ev-assistant__fab:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.tev-ev-assistant__fab .tev-ev-assistant__pulse {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
}

/* Hide assistant panel when planner modal is open */
body.tev-planner-modal-open .tev-ev-assistant__panel {
  display: none !important;
}

body.tev-planner-modal-open .tev-ev-assistant.is-open .tev-ev-assistant__fab {
  opacity: 0.85;
}

/* Collapse floating search when assistant is open (avoid dual panels on small screens) */
@media (max-width: 640px) {
  .tev-ev-assistant {
    right: 1rem;
    left: auto;
    bottom: 4.85rem;
    max-width: calc(100vw - 2rem);
  }
  body.tev-assistant-open .floating-ai-search-panel {
    opacity: 0.35;
    pointer-events: none;
  }
}

@media (max-width: 480px) {
  .tev-ev-assistant__panel {
    width: calc(100vw - 2rem);
    max-height: 65vh;
  }
}
