/* Tripsesim AI support — shopper chat widget */
:root {
  --tsm-ai-accent: #0b6e4f;
  --tsm-ai-accent-hover: #085a40;
  --tsm-ai-bg: #f7f9f8;
  --tsm-ai-panel: #ffffff;
  --tsm-ai-text: #1a2b24;
  --tsm-ai-muted: #5a6f66;
  --tsm-ai-border: #d5e0db;
  --tsm-ai-shadow: 0 12px 40px rgba(10, 40, 30, 0.18);
}

.tsm-ai-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: var(--tsm-ai-accent);
  color: #fff;
  font: 600 14px/1.2 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  box-shadow: var(--tsm-ai-shadow);
  transition: background 0.15s ease, transform 0.15s ease;
}

.tsm-ai-launcher:hover,
.tsm-ai-launcher:focus-visible {
  background: var(--tsm-ai-accent-hover);
  outline: none;
}

.tsm-ai-launcher[aria-expanded="true"] {
  transform: scale(0.96);
}

.tsm-ai-panel {
  position: fixed;
  right: 20px;
  bottom: 76px;
  z-index: 99991;
  width: min(380px, calc(100vw - 24px));
  height: min(520px, calc(100vh - 100px));
  display: flex;
  flex-direction: column;
  background: var(--tsm-ai-panel);
  border: 1px solid var(--tsm-ai-border);
  border-radius: 16px;
  box-shadow: var(--tsm-ai-shadow);
  overflow: hidden;
}

.tsm-ai-panel[hidden] {
  display: none !important;
}

.tsm-ai-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0b6e4f 0%, #12805c 100%);
  color: #fff;
}

.tsm-ai-head h2 {
  margin: 0;
  font: 650 15px/1.3 "Segoe UI", system-ui, sans-serif;
}

.tsm-ai-head p {
  margin: 2px 0 0;
  font: 400 12px/1.3 "Segoe UI", system-ui, sans-serif;
  opacity: 0.9;
}

.tsm-ai-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.tsm-ai-close:hover,
.tsm-ai-close:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.tsm-ai-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 8px;
  background: var(--tsm-ai-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tsm-ai-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  font: 400 13.5px/1.45 "Segoe UI", system-ui, sans-serif;
  color: var(--tsm-ai-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.tsm-ai-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--tsm-ai-border);
}

.tsm-ai-msg--user {
  align-self: flex-end;
  background: #e6f4ef;
  border: 1px solid #c5ddd3;
}

.tsm-ai-msg--pending {
  opacity: 0.7;
  font-style: italic;
}

.tsm-ai-chips {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
  background: var(--tsm-ai-bg);
}

.tsm-ai-chip {
  border: 1px solid var(--tsm-ai-border);
  background: #fff;
  color: var(--tsm-ai-muted);
  font: 500 12px/1.2 "Segoe UI", system-ui, sans-serif;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.tsm-ai-chip:hover,
.tsm-ai-chip:focus-visible {
  border-color: var(--tsm-ai-accent);
  color: var(--tsm-ai-accent);
  outline: none;
}

.tsm-ai-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--tsm-ai-border);
  background: #fff;
}

.tsm-ai-form textarea {
  flex: 1 1 auto;
  resize: none;
  min-height: 44px;
  max-height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--tsm-ai-border);
  border-radius: 10px;
  font: 400 14px/1.4 "Segoe UI", system-ui, sans-serif;
  color: var(--tsm-ai-text);
}

.tsm-ai-form textarea:focus {
  outline: 2px solid rgba(11, 110, 79, 0.35);
  border-color: var(--tsm-ai-accent);
}

.tsm-ai-send {
  flex: 0 0 auto;
  align-self: flex-end;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--tsm-ai-accent);
  color: #fff;
  font: 600 13px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.tsm-ai-send:hover:not(:disabled),
.tsm-ai-send:focus-visible:not(:disabled) {
  background: var(--tsm-ai-accent-hover);
  outline: none;
}

.tsm-ai-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tsm-ai-hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
}

@media (max-width: 480px) {
  .tsm-ai-launcher {
    right: 12px;
    bottom: 12px;
  }

  .tsm-ai-panel {
    right: 8px;
    left: 8px;
    bottom: 68px;
    width: auto;
    height: min(70vh, 560px);
  }
}
