/* ============================================================
   M&S Butcher Equipment chat widget — visual style
   Matches the storefront brand:
     - burgundy primary (#8b1a2e)
     - clean white background
     - bold condensed sans-serif headings (Oswald)
     - friendly readable body (Inter)
     - pill-shaped buttons
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600&display=swap");

:root {
  --ms-burgundy: #8b1a2e;
  --ms-burgundy-deep: #6e1424;
  --ms-burgundy-soft: rgba(139, 26, 46, 0.08);
  --ms-charcoal: #1f1f23;
  --ms-text: #2a2a2f;
  --ms-muted: #6b6b73;
  --ms-bg: #ffffff;
  --ms-bg-alt: #f6f6f7;
  --ms-border: #e6e6e8;
  --ms-shadow: 0 12px 36px rgba(20, 20, 30, 0.14);
  --ms-shadow-launcher: 0 6px 18px rgba(139, 26, 46, 0.35);
  --ms-radius-window: 16px;
  --ms-radius-bubble: 14px;
  --ms-radius-pill: 999px;
  --ms-font-heading: "Oswald", "Bebas Neue", "Arial Narrow", sans-serif;
  --ms-font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ============================================================
   Launcher (the chat bubble button bottom-right of the page)
   ============================================================ */

.ms-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999998;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--ms-radius-pill);
  background: var(--ms-charcoal);
  color: #fff;
  font-family: var(--ms-font-heading);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(20, 20, 30, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}
.ms-chat-launcher:hover {
  transform: translateY(-1px);
  background: #000;
}
.ms-chat-launcher .ms-chat-launcher__icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.ms-chat-launcher .ms-chat-launcher__dot {
  width: 8px;
  height: 8px;
  background: #5cdc9b;
  border-radius: 50%;
  margin-right: 2px;
}

/* ============================================================
   Chat window
   ============================================================ */

.ms-chat-window {
  position: fixed;
  right: 24px;
  bottom: 88px;
  z-index: 999999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: var(--ms-bg);
  border-radius: var(--ms-radius-window);
  box-shadow: var(--ms-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--ms-font-body);
  color: var(--ms-text);
}
.ms-chat-window.is-open {
  display: flex;
}

/* Header */
.ms-chat-header {
  background: var(--ms-burgundy);
  color: #fff;
  padding: 16px 18px 14px;
  position: relative;
}
.ms-chat-header__title {
  font-family: var(--ms-font-heading);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
  margin: 0;
}
.ms-chat-header__subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.ms-chat-header__status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ms-chat-header__status::before {
  content: "";
  width: 7px;
  height: 7px;
  background: #5cdc9b;
  border-radius: 50%;
  display: inline-block;
}
.ms-chat-header__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s ease;
}
.ms-chat-header__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Message scroll area */
.ms-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--ms-bg-alt);
  scrollbar-width: thin;
  scrollbar-color: #c8c8cc transparent;
}
.ms-chat-messages::-webkit-scrollbar {
  width: 6px;
}
.ms-chat-messages::-webkit-scrollbar-thumb {
  background: #c8c8cc;
  border-radius: 3px;
}

/* Message bubbles */
.ms-msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: var(--ms-radius-bubble);
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
}
.ms-msg--bot {
  background: #fff;
  color: var(--ms-text);
  align-self: flex-start;
  border: 1px solid var(--ms-border);
  border-top-left-radius: 4px;
}
.ms-msg--user {
  background: var(--ms-burgundy);
  color: #fff;
  align-self: flex-end;
  border-top-right-radius: 4px;
}
.ms-msg--system {
  background: var(--ms-burgundy-soft);
  color: var(--ms-burgundy-deep);
  align-self: stretch;
  text-align: center;
  font-size: 12.5px;
  border: 1px dashed rgba(139, 26, 46, 0.35);
}
.ms-msg strong {
  font-weight: 600;
}
.ms-msg a {
  color: inherit;
  text-decoration: underline;
}
.ms-msg--user a {
  color: #fff;
}

/* Typing indicator */
.ms-typing {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--ms-border);
  padding: 12px 14px;
  border-radius: var(--ms-radius-bubble);
  display: inline-flex;
  gap: 4px;
}
.ms-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ms-burgundy);
  opacity: 0.4;
  animation: ms-typing-bounce 1.2s infinite ease-in-out;
}
.ms-typing span:nth-child(2) { animation-delay: 0.15s; }
.ms-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ms-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Suggested question chips */
.ms-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 0;
  background: var(--ms-bg-alt);
}
.ms-suggestion {
  appearance: none;
  border: 1.5px solid var(--ms-burgundy);
  background: #fff;
  color: var(--ms-burgundy);
  padding: 7px 14px;
  border-radius: var(--ms-radius-pill);
  font-family: var(--ms-font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ms-suggestion:hover {
  background: var(--ms-burgundy);
  color: #fff;
}

/* Input row */
.ms-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 14px 10px;
  background: var(--ms-bg);
  border-top: 1px solid var(--ms-border);
  align-items: center;
}
.ms-chat-input__field {
  flex: 1 1 auto;
  border: 1.5px solid var(--ms-border);
  background: #fff;
  border-radius: var(--ms-radius-pill);
  padding: 10px 16px;
  font-family: var(--ms-font-body);
  font-size: 14px;
  color: var(--ms-text);
  outline: none;
  transition: border-color 0.15s ease;
}
.ms-chat-input__field:focus {
  border-color: var(--ms-burgundy);
}
.ms-chat-input__field::placeholder {
  color: #9b9ba3;
}
.ms-chat-input__send {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--ms-burgundy);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}
.ms-chat-input__send:hover {
  background: var(--ms-burgundy-deep);
  transform: translateY(-1px);
}
.ms-chat-input__send:disabled {
  background: #c8c8cc;
  cursor: not-allowed;
  transform: none;
}
.ms-chat-input__send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Footer disclaimer */
.ms-chat-disclaimer {
  font-size: 11px;
  color: var(--ms-muted);
  text-align: center;
  padding: 0 14px 10px;
  background: var(--ms-bg);
  line-height: 1.4;
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 480px) {
  .ms-chat-window {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .ms-chat-launcher {
    right: 16px;
    bottom: 16px;
  }
}
