/* ============================================================================
   widget.css : Magpies chat widget styling
   ============================================================================ */

.magpies-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.mag-bubble {
  background: #fec300;
  color: #000;
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, box-shadow 0.15s;
}
.mag-bubble:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.mag-panel {
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 48px);
  background: #fec300;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (max-width: 480px) {
  .mag-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 48px);
  }
}

.mag-header {
  background: #fec300;
  color: #000;
  padding: 10px 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.mag-title {
  font-weight: 600;
  font-size: 15px;
  color: #000;
}
.mag-close {
  background: transparent;
  color: #000;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  /* 44x44 meets WCAG 2.5.5 AAA target size — important for touch and for
     users with motor impairments. Previously was 28x28. */
  width: 44px;
  height: 44px;
  border-radius: 8px;
}
.mag-close:hover,
.mag-close:focus-visible {
  background: rgba(0, 0, 0, 0.08);
  outline: none;
}
.mag-close:focus-visible {
  box-shadow: 0 0 0 2px #000;
}

/* Visually-hidden text for screen readers — kept off-screen but still
   announced. Used for the textarea label. */
.mag-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicator on the chat-trigger bubble — visible for keyboard users.
   The :hover style already covers mouse users. */
.mag-bubble:focus-visible {
  outline: 3px solid #000;
  outline-offset: 2px;
}

/* Send button needs a visible focus ring too. */
.mag-form button:focus-visible {
  outline: 2px solid #fec300;
  outline-offset: 2px;
}

.mag-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fec300;
}

.mag-logo {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 0 auto 8px;
}

.mag-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.mag-assistant {
  background: #fff;
  color: #000;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.mag-user {
  background: #fff;
  color: #000;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.mag-thinking {
  opacity: 0.6;
  font-style: italic;
}

.mag-img-bubble {
  padding: 6px;
  max-width: 90%;
}
.mag-product-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  border-radius: 8px;
}

.mag-form {
  display: flex;
  padding: 12px;
  gap: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
  background: #fec300;
}
.mag-form textarea {
  flex: 1;
  resize: none;
  border: 1px solid #000;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  min-height: 96px;
  max-height: 200px;
  line-height: 1.4;
  background: #fff;
  color: #000;
}
.mag-form textarea:focus {
  border-color: #000;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}
.mag-form button {
  background: #000;
  color: #fec300;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.mag-form button:hover {
  background: #222;
}
