/**
 * Copyright since 2026 SaaS
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License version 3.0
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * @author    SaaS
 * @copyright Since 2026 SaaS
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
 */

.psm-chat-widget-hidden,
.psm-chat-modal[hidden] {
  display: none !important;
}

.psm-chat-widget-loading {
  display: none !important;
}

.psm-chat-widget,
.psm-chat-modal {
  --psm-chat-border: #d9e2ec;
  --psm-chat-muted: #627386;
  --psm-chat-text: #142033;
  --psm-chat-surface: #ffffff;
  --psm-chat-soft: #f6f8fb;
  --psm-chat-chat-bg: #e2e8f0;
  --psm-chat-chrome-bg: rgba(226, 232, 240, 0.72);
  --psm-chat-chrome-fade: 12px;
  --psm-chat-header-height: 72px;
  --psm-chat-form-height: 76px;
  --psm-chat-inset-top: 72px;
  --psm-chat-inset-bottom: 76px;
  --psm-chat-primary: #2563eb;
  --psm-chat-primary-dark: #1d4ed8;
  --psm-chat-primary-soft: #dbeafe;
  --psm-chat-primary-ring: rgba(37, 99, 235, 0.22);
  --psm-chat-error: #b91c1c;
  color: var(--psm-chat-text);
}

.psm-chat-widget {
  margin-top: 18px;
}

.psm-chat-launcher {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.psm-chat-section-title {
  color: var(--psm-chat-primary);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 12px;
}

.psm-chat-header {
  align-items: center;
  background: transparent;
  display: flex;
  gap: 10px;
  isolation: isolate;
  justify-content: space-between;
  left: 0;
  padding: 10px 12px;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 6;
}

/* Frosted chrome fades toward the messages (clearer at the bottom edge).
   Fade stays within the existing messageGap (12px), insets unchanged. */
.psm-chat-header::before {
  -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(100% - var(--psm-chat-chrome-fade)),
    transparent 100%
  );
  backdrop-filter: blur(14px);
  background: var(--psm-chat-chrome-bg);
  bottom: calc(-1 * var(--psm-chat-chrome-fade));
  content: "";
  left: 0;
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(100% - var(--psm-chat-chrome-fade)),
    transparent 100%
  );
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 0;
}

.psm-chat-header > * {
  position: relative;
  z-index: 1;
}

.psm-chat-header-left {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.psm-chat-header-center {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.psm-chat-header-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.psm-chat-menu-toggle {
  align-items: center;
  background: var(--psm-chat-soft);
  border: 1px solid var(--psm-chat-border);
  border-radius: 999px;
  color: var(--psm-chat-text);
  cursor: pointer;
  display: flex;
  height: 40px;
  justify-content: center;
  padding: 0;
  width: 40px;
}

.psm-chat-menu-toggle:hover,
.psm-chat-menu-toggle:focus-visible {
  background: var(--psm-chat-primary-soft);
  border-color: var(--psm-chat-primary);
  outline: none;
}

.psm-chat-menu-icon,
.psm-chat-menu-icon::before,
.psm-chat-menu-icon::after {
  background: currentColor;
  border-radius: 1px;
  display: block;
  height: 2px;
  position: relative;
  width: 16px;
}

.psm-chat-menu-icon::before,
.psm-chat-menu-icon::after {
  content: "";
  left: 0;
  position: absolute;
}

.psm-chat-menu-icon::before {
  top: -5px;
}

.psm-chat-menu-icon::after {
  top: 5px;
}

.psm-chat-conversations {
  /* Legacy dropdown styles kept for safety; drawer layout overrides below. */
  background: var(--psm-chat-surface);
  border-bottom: 1px solid var(--psm-chat-border);
  box-shadow: 0 12px 24px rgba(8, 15, 28, 0.12);
  left: 0;
  max-height: min(320px, 45vh);
  overflow: auto;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 2;
}

.psm-chat-history-drawer {
  background: var(--psm-chat-surface);
  border-right: 1px solid var(--psm-chat-border);
  display: none;
  flex: 0 0 20vw;
  flex-direction: column;
  height: 100%;
  max-width: 20vw;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  width: 20vw;
}

.psm-chat-shell--history-open .psm-chat-history-drawer {
  box-shadow: -18px 0 42px rgba(8, 15, 28, 0.22);
  display: flex;
}

.psm-chat-conversation-new {
  background: var(--psm-chat-surface);
  border: none;
  border-bottom: 1px solid var(--psm-chat-border);
  color: var(--psm-chat-primary-dark);
  cursor: pointer;
  display: block;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 16px;
  text-align: left;
  width: 100%;
}

.psm-chat-conversation-new:hover,
.psm-chat-conversation-new:focus-visible {
  background: var(--psm-chat-primary-soft);
  outline: none;
}

.psm-chat-conversations-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 8px;
}

.psm-chat-conversations-list > li {
  margin: 0;
  min-width: 0;
}

.psm-chat-conversation-item {
  background: var(--psm-chat-surface);
  border: 1px solid var(--psm-chat-border);
  border-radius: 12px;
  cursor: pointer;
  display: block;
  margin: 0;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.psm-chat-conversation-item:hover,
.psm-chat-conversation-item:focus-visible {
  background: var(--psm-chat-soft);
  outline: none;
}

.psm-chat-conversation-item-active {
  background: var(--psm-chat-primary-soft);
  border-color: var(--psm-chat-primary);
}

.psm-chat-conversation-item-row {
  align-items: flex-start;
  display: flex;
  gap: 12px;
}

.psm-chat-conversation-item-image {
  border-radius: 10px;
  flex: 0 0 auto;
  height: 44px;
  object-fit: cover;
  width: 44px;
}

.psm-chat-conversation-item-info {
  flex: 1 1 auto;
  min-width: 0;
}

.psm-chat-conversation-title {
  color: var(--psm-chat-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psm-chat-conversation-reference {
  color: var(--psm-chat-muted);
  font-size: 11px;
  line-height: 1.3;
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psm-chat-conversation-preview {
  color: var(--psm-chat-muted);
  font-size: 12px;
  line-height: 1.35;
  margin: 4px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psm-chat-conversation-meta {
  color: var(--psm-chat-muted);
  font-size: 11px;
  margin: 4px 0 0;
}

.psm-chat-conversations-empty,
.psm-chat-conversations-loading {
  color: var(--psm-chat-muted);
  font-size: 13px;
  margin: 0;
  padding: 16px;
}

.psm-chat-kicker,
.psm-chat-intro,
.psm-chat-status,
.psm-chat-empty {
  margin: 0;
}

.psm-chat-intro {
  color: var(--psm-chat-muted);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 8px;
}

.psm-chat-question-list {
  display: grid;
  gap: 10px;
}

.psm-chat-question {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--psm-chat-border);
  border-radius: 14px;
  color: var(--psm-chat-text);
  cursor: pointer;
  display: flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: flex-start;
  line-height: 1.35;
  min-height: 46px;
  padding: 11px 13px;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  width: 100%;
}

.psm-chat-question:hover,
.psm-chat-question:focus {
  background: var(--psm-chat-primary-soft);
  border-color: var(--psm-chat-primary);
  box-shadow: 0 10px 22px rgba(20, 32, 51, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.psm-chat-question-custom {
  background: var(--psm-chat-primary);
  border-color: var(--psm-chat-primary);
  color: #ffffff;
  justify-content: space-between;
}

.psm-chat-question-custom::after {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  box-sizing: border-box;
  content: "";
  display: block;
  flex: 0 0 auto;
  height: 9px;
  margin-left: 12px;
  position: relative;
  left: -1.5px;
  transform: rotate(-45deg);
  width: 9px;
}

.psm-chat-question-custom:hover,
.psm-chat-question-custom:focus {
  background: var(--psm-chat-primary-dark);
  border-color: var(--psm-chat-primary-dark);
}

.psm-chat-modal {
  /* Above Crisp (~1e6) and typical sticky theme headers. Modal is also
     moved to document.body in JS to escape parent stacking contexts. */
  --psm-chat-modal-z-index: 2147483000;
  --psm-chat-panel-duration: 220ms;
  --psm-chat-panel-ease: cubic-bezier(0.22, 1, 0.36, 1);
  bottom: 0;
  isolation: isolate;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 2147483000;
  z-index: var(--psm-chat-modal-z-index);
}

.psm-chat-backdrop {
  background: transparent;
  bottom: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 0;
}

.psm-chat-dialog {
  background: var(--psm-chat-chat-bg);
  box-shadow: -18px 0 42px rgba(8, 15, 28, 0.22);
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  margin-left: auto;
  max-width: 100vw;
  min-width: 0;
  position: relative;
  width: 40vw;
  z-index: 1;
}

.psm-chat-shell {
  bottom: 0;
  display: flex;
  flex-direction: row;
  height: 100vh;
  height: 100dvh;
  margin-left: auto;
  max-width: 100vw;
  position: absolute;
  right: 0;
  top: 0;
  transform: translateX(100%);
  transition: transform var(--psm-chat-panel-duration) var(--psm-chat-panel-ease);
  width: 40vw;
  will-change: transform;
  z-index: 1;
}

.psm-chat-modal--open .psm-chat-shell {
  transform: translateX(0);
}

.psm-chat-modal--closing .psm-chat-shell {
  transform: translateX(100%);
}

.psm-chat-shell--history-open {
  width: 60vw;
}

.psm-chat-shell--history-open .psm-chat-dialog {
  box-shadow: none;
}

.psm-chat-close {
  align-items: center;
  background: var(--psm-chat-soft);
  border: 1px solid var(--psm-chat-border);
  border-radius: 999px;
  color: var(--psm-chat-text);
  cursor: pointer;
  display: flex;
  flex: 0 0 auto;
  font-size: 24px;
  height: 40px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 40px;
}

.psm-chat-close:hover,
.psm-chat-close:focus {
  background: var(--psm-chat-primary-soft);
  border-color: var(--psm-chat-primary);
  outline: none;
}

.psm-chat-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 0;
  position: relative;
}

.psm-chat-messages-wrap {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.psm-chat-messages {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-sizing: border-box;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overscroll-behavior: contain;
  overflow-x: hidden;
  overflow-y: auto;
  padding: var(--psm-chat-inset-top) 14px var(--psm-chat-inset-bottom);
}

.psm-chat-empty {
  color: var(--psm-chat-muted);
  font-size: 14px;
  padding: 32px 10px;
  text-align: center;
}

.psm-chat-message {
  border-radius: 16px;
  box-shadow: 0 8px 16px rgba(20, 32, 51, 0.06);
  font-size: 14px;
  line-height: 1.45;
  margin: 8px 0;
  max-width: 92%;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.psm-chat-message-visitor {
  background: var(--psm-chat-primary);
  color: #ffffff;
  margin-left: auto;
}

.psm-chat-message-assistant {
  background: #ffffff;
  border: 1px solid var(--psm-chat-border);
  color: var(--psm-chat-text);
  margin-right: auto;
}

.psm-chat-feedback {
  display: flex;
  gap: 2px;
  margin: 4px 0 0;
  max-width: 92%;
}

.psm-chat-feedback-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.psm-chat-feedback-btn:focus-visible {
  outline: 2px solid var(--psm-chat-primary-ring, rgba(37, 99, 235, 0.35));
  outline-offset: 1px;
}

.psm-chat-feedback-icon {
  display: block;
  fill: none;
  flex-shrink: 0;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  transition: fill 0.15s ease, stroke 0.15s ease;
  width: 16px;
}

.psm-chat-feedback-btn--up:hover,
.psm-chat-feedback-btn--up:focus-visible,
.psm-chat-feedback-btn--up.is-active {
  color: #4ade80;
}

.psm-chat-feedback-btn--down:hover,
.psm-chat-feedback-btn--down:focus-visible,
.psm-chat-feedback-btn--down.is-active {
  color: #f87171;
}

.psm-chat-feedback-btn--up:hover .psm-chat-feedback-icon,
.psm-chat-feedback-btn--up:focus-visible .psm-chat-feedback-icon,
.psm-chat-feedback-btn--up.is-active .psm-chat-feedback-icon,
.psm-chat-feedback-btn--down:hover .psm-chat-feedback-icon,
.psm-chat-feedback-btn--down:focus-visible .psm-chat-feedback-icon,
.psm-chat-feedback-btn--down.is-active .psm-chat-feedback-icon {
  fill: currentColor;
}

.psm-chat-feedback-btn:disabled {
  cursor: default;
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  .psm-chat-feedback-btn,
  .psm-chat-feedback-icon {
    transition: none;
  }
}

.psm-chat-message-group {
  box-sizing: border-box;
  margin: 8px 0;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.psm-chat-message-group .psm-chat-message {
  margin: 0;
  max-width: 92%;
}

.psm-chat-followup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: auto;
  margin-top: 8px;
  max-width: 92%;
  width: max-content;
  align-items: flex-end;
}

.psm-chat-followup-question {
  box-shadow: 0 8px 16px rgba(20, 32, 51, 0.06);
  max-width: 100%;
  text-align: right;
  width: fit-content;
}

.psm-chat-recommendations {
  box-sizing: border-box;
  margin-top: 10px;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  padding: 4px 0 0;
  width: 100%;
}

.psm-chat-recommendation-viewport {
  align-items: center;
  display: flex;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.psm-chat-recommendation-nav {
  align-items: center;
  background: var(--psm-chat-primary);
  border: 1px solid var(--psm-chat-primary);
  border-radius: 999px;
  box-shadow: 0 4px 10px var(--psm-chat-primary-ring);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0;
  height: 32px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
  width: 32px;
}

.psm-chat-recommendation-nav[hidden] {
  display: none;
}

.psm-chat-recommendation-nav::before {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  box-sizing: border-box;
  content: "";
  display: block;
  height: 9px;
  width: 9px;
}

.psm-chat-recommendation-previous::before {
  position: relative;
  left: 1.5px;
  transform: rotate(135deg);
}

.psm-chat-recommendation-next::before {
  position: relative;
  left: -1.5px;
  transform: rotate(-45deg);
}

.psm-chat-recommendation-nav:hover,
.psm-chat-recommendation-nav:focus-visible {
  background: var(--psm-chat-primary-dark);
  border-color: var(--psm-chat-primary-dark);
  box-shadow: 0 0 0 3px var(--psm-chat-primary-ring);
  outline: none;
  transform: translateY(-1px);
}

.psm-chat-recommendation-nav:disabled,
.psm-chat-recommendation-nav:disabled:hover,
.psm-chat-recommendation-nav:disabled:focus {
  background: var(--psm-chat-soft);
  border-color: var(--psm-chat-border);
  box-shadow: none;
  color: var(--psm-chat-muted);
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.psm-chat-recommendation-track {
  align-items: stretch;
  box-sizing: border-box;
  display: flex;
  flex: 1 1 auto;
  flex-flow: row nowrap;
  gap: 12px;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  padding: 3px 0 12px;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-y;
  width: 100%;
}

.psm-chat-recommendation-track:focus,
.psm-chat-recommendation-track:focus-visible {
  border-radius: 12px;
  box-shadow: 0 0 0 3px var(--psm-chat-primary-ring);
  outline: none;
}

.psm-chat-recommendation-track::-webkit-scrollbar {
  display: none;
}

.psm-chat-recommendation-card {
  background:
    linear-gradient(180deg, var(--psm-chat-primary-soft) 0, var(--psm-chat-surface) 74px);
  border: 1px solid var(--psm-chat-primary);
  border-radius: 16px;
  box-sizing: border-box;
  display: flex;
  flex: 0 0 calc((100% - 12px) / 2);
  flex-direction: column;
  max-width: calc((100% - 12px) / 2);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.psm-chat-recommendation-content {
  color: var(--psm-chat-text);
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  min-width: 0;
  padding: 12px;
  text-decoration: none !important;
}

a.psm-chat-recommendation-content:hover {
  color: var(--psm-chat-primary-dark);
  text-decoration: none !important;
}

a.psm-chat-recommendation-content:focus,
a.psm-chat-recommendation-content:focus-visible {
  box-shadow: inset 0 0 0 3px var(--psm-chat-primary-ring);
  outline: none;
}

.psm-chat-recommendation-image {
  aspect-ratio: 4 / 3;
  background: var(--psm-chat-surface);
  border: 1px solid var(--psm-chat-border);
  border-radius: 12px;
  display: block;
  height: 150px;
  object-fit: contain;
  width: 100%;
}

.psm-chat-recommendation-name {
  color: var(--psm-chat-primary-dark);
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.psm-chat-recommendation-meta,
.psm-chat-recommendation-reason,
.psm-chat-recommendation-unavailable {
  color: var(--psm-chat-muted);
  display: block;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.psm-chat-recommendation-price {
  color: var(--psm-chat-primary-dark);
  display: block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin-top: 2px;
}

.psm-chat-recommendation-reason {
  background: var(--psm-chat-primary-soft);
  border-radius: 8px;
  color: var(--psm-chat-text);
  margin-top: 3px;
  padding: 8px 9px;
}

.psm-chat-recommendation-unavailable {
  color: var(--psm-chat-error);
  font-weight: 700;
}

.psm-chat-recommendation-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding: 0 12px 12px;
}

.psm-chat-recommendation-add-to-cart {
  align-items: center;
  background: var(--psm-chat-primary);
  border: 1px solid var(--psm-chat-primary);
  border-radius: 10px;
  box-shadow: 0 4px 10px var(--psm-chat-primary-ring);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
  line-height: 1.3;
  min-height: 42px;
  padding: 10px 12px;
  text-align: center;
  width: 100%;
}

.psm-chat-recommendation-add-to-cart:hover,
.psm-chat-recommendation-add-to-cart:focus-visible {
  background: var(--psm-chat-primary-dark);
  border-color: var(--psm-chat-primary-dark);
  outline: none;
}

.psm-chat-recommendation-add-to-cart:disabled,
.psm-chat-recommendation-add-to-cart.is-loading {
  cursor: wait;
  opacity: 0.78;
}

.psm-chat-recommendation-add-to-cart.is-success {
  background: #15803d;
  border-color: #15803d;
  box-shadow: none;
  cursor: default;
  opacity: 1;
}

.psm-chat-streaming::after {
  animation: psm-chat-pulse 1s infinite;
  content: " ...";
}

.psm-chat-typing {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--psm-chat-border);
  border-radius: 16px;
  color: var(--psm-chat-muted);
  display: block;
  font-size: 13px;
  font-style: italic;
  line-height: 1.4;
  margin: 8px 0;
  max-width: 92%;
  padding: 12px 14px;
  width: max-content;
}

.psm-chat-status {
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  background: var(--psm-chat-chrome-bg);
  bottom: var(--psm-chat-form-height);
  box-sizing: border-box;
  color: var(--psm-chat-muted);
  font-size: 13px;
  left: 0;
  min-height: 0;
  padding: 0 16px;
  position: absolute;
  right: 0;
  z-index: 6;
}

.psm-chat-status:not(:empty) {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  padding: 6px 16px 2px;
}

.psm-chat-status-loading {
  color: var(--psm-chat-primary-dark);
}

.psm-chat-status-error {
  color: var(--psm-chat-error);
}

.psm-chat-form {
  background: transparent;
  bottom: 0;
  box-sizing: border-box;
  flex: 0 0 auto;
  isolation: isolate;
  left: 0;
  padding: 12px 14px 14px;
  position: absolute;
  right: 0;
  z-index: 6;
}

/* Frosted chrome fades toward the messages (clearer at the top edge).
   Fade stays short so follow-ups keep the previous bottom spacing. */
.psm-chat-form::before {
  -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(
    to top,
    #000 0%,
    #000 calc(100% - var(--psm-chat-chrome-fade)),
    transparent 100%
  );
  backdrop-filter: blur(14px);
  background: var(--psm-chat-chrome-bg);
  bottom: 0;
  content: "";
  left: 0;
  mask-image: linear-gradient(
    to top,
    #000 0%,
    #000 calc(100% - var(--psm-chat-chrome-fade)),
    transparent 100%
  );
  pointer-events: none;
  position: absolute;
  right: 0;
  top: calc(-1 * var(--psm-chat-chrome-fade));
  z-index: 0;
}

.psm-chat-form > * {
  position: relative;
  z-index: 1;
}

.psm-chat-composer {
  align-items: flex-end;
  background: #f4f5f7;
  border-radius: 24px;
  box-sizing: border-box;
  display: flex;
  gap: 2px;
  min-height: 48px;
  padding: 4px 6px 4px 16px;
  transition: box-shadow 0.15s ease;
}

.psm-chat-composer:focus-within {
  box-shadow: 0 0 0 3px var(--psm-chat-primary-ring);
}

.psm-chat-input {
  background: transparent;
  border: 0;
  box-sizing: border-box;
  color: var(--psm-chat-text);
  display: block;
  flex: 1 1 auto;
  font: inherit;
  font-size: 15px;
  line-height: 1.35;
  max-height: calc(1.35em * 9 + 16px);
  min-height: 40px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  overflow-wrap: anywhere;
  padding: 8px 8px 8px 0;
  resize: none;
  white-space: pre-wrap;
  width: 100%;
  word-break: break-word;
}

.psm-chat-input::placeholder {
  color: #8b95a5;
}

.psm-chat-input:focus {
  outline: none;
}

.psm-chat-composer-actions {
  align-items: center;
  align-self: flex-end;
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  padding-bottom: 2px;
}

.psm-chat-composer-icon {
  display: block;
  height: 20px;
  width: 20px;
}

.psm-chat-speech,
.psm-chat-submit {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #6b7685;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  height: 36px;
  justify-content: center;
  padding: 0;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
  width: 36px;
}

.psm-chat-speech[hidden] {
  display: none;
}

.psm-chat-speech:hover,
.psm-chat-speech:focus-visible,
.psm-chat-submit:hover:not(:disabled),
.psm-chat-submit:focus-visible:not(:disabled) {
  color: var(--psm-chat-primary);
  outline: none;
}

.psm-chat-speech--listening {
  color: var(--psm-chat-primary);
}

.psm-chat-speech--listening .psm-chat-composer-icon {
  animation: psm-chat-pulse 1.2s ease-in-out infinite;
}

.psm-chat-submit--ready {
  background: var(--psm-chat-primary);
  color: #ffffff;
}

.psm-chat-submit--ready:hover,
.psm-chat-submit--ready:focus-visible {
  background: var(--psm-chat-primary-dark);
  color: #ffffff;
}

.psm-chat-submit:disabled {
  cursor: default;
  opacity: 0.45;
  pointer-events: none;
}

html.psm-chat-modal-open,
body.psm-chat-modal-open {
  /* Do not set overflow:hidden here: it breaks Elementor position:sticky columns. */
  overscroll-behavior: none;
}

/* Hide third-party floaters while our product chat is open.
 * Google Store Quality often lives in float-dashboard / CDK overlays;
 * display:none is required because opacity/visibility can be ignored. */
body.psm-chat-modal-open .crisp-client,
body.psm-chat-modal-open #crisp-chatbox,
body.psm-chat-modal-open float-dashboard,
body.psm-chat-modal-open .float-mv-button,
body.psm-chat-modal-open button.float-mv-button,
body.psm-chat-modal-open button[dialoglabel*="Store quality"],
body.psm-chat-modal-open button[aria-label*="Store Quality"],
body.psm-chat-modal-open button[aria-label*="Store\00a0Quality"],
body.psm-chat-modal-open .rating-button-post-collapse-text-container {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

@keyframes psm-chat-pulse {
  0% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
  }
}

@keyframes psm-chat-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@media (max-width: 1199px) and (min-width: 768px) {
  .psm-chat-shell {
    width: 45vw;
  }

  .psm-chat-shell--history-open {
    width: 70vw;
  }

  .psm-chat-history-drawer {
    flex-basis: 25vw;
    max-width: 25vw;
    width: 25vw;
  }

  .psm-chat-dialog {
    width: 45vw;
  }

  .psm-chat-shell--history-open .psm-chat-dialog {
    width: 45vw;
  }
}

@media (max-width: 767px) {
  .psm-chat-shell,
  .psm-chat-shell--history-open,
  .psm-chat-dialog {
    width: 100vw;
  }

  .psm-chat-history-drawer {
    flex-basis: 80vw;
    max-width: 80vw;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 80vw;
    z-index: 3;
  }

  .psm-chat-header {
    padding: 10px 12px;
  }

  .psm-chat-product-context-add {
    padding: 8px 10px;
  }

  .psm-chat-message {
    max-width: 96%;
  }

  .psm-chat-message-group {
    max-width: 100%;
  }

  .psm-chat-recommendation-card {
    flex-basis: 100%;
    max-width: 100%;
  }

  .psm-chat-fab {
    right: 12px;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .psm-chat-question,
  .psm-chat-recommendation-track,
  .psm-chat-messages {
    scroll-behavior: auto;
    transition: none;
  }

  .psm-chat-scroll-btn,
  .psm-chat-recommendation-nav,
  .psm-chat-shell,
  .psm-chat-fab-dismiss,
  .psm-chat-fab-question {
    transition: none !important;
  }

  .psm-chat-streaming::after {
    animation: none;
  }

  .psm-chat-shell {
    transform: none;
  }

  .psm-chat-modal--closing .psm-chat-shell {
    transform: none;
  }

  .psm-chat-fab-dismiss,
  .psm-chat-fab-question {
    opacity: 1;
    transform: none;
  }
}

/* Floating entry point */
.psm-chat-fab {
  bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  position: fixed;
  right: 24px;
  z-index: 2147482990;
}

.psm-chat-widget-open .psm-chat-fab,
.psm-chat-fab--hidden {
  display: none !important;
}

.psm-chat-fab-dismiss {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--psm-chat-border);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(8, 15, 28, 0.12);
  color: var(--psm-chat-text);
  cursor: pointer;
  display: flex;
  font-size: 18px;
  height: 28px;
  justify-content: center;
  line-height: 1;
  margin-right: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.96);
  transition:
    opacity var(--psm-chat-fab-item-duration, 300ms) var(--psm-chat-fab-item-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    transform var(--psm-chat-fab-item-duration, 300ms) var(--psm-chat-fab-item-ease, cubic-bezier(0.22, 1, 0.36, 1));
  transition-delay: var(--psm-fab-delay, 0ms);
  width: 28px;
}

.psm-chat-fab-dismiss.psm-chat-fab-item--in {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.psm-chat-fab--collapsed .psm-chat-fab-dismiss,
.psm-chat-fab--collapsed .psm-chat-fab-questions {
  display: none;
}

.psm-chat-fab-questions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(320px, calc(100vw - 48px));
}

.psm-chat-fab-question {
  background: #111827;
  border: none;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(8, 15, 28, 0.2);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.35;
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  text-align: left;
  transform: translateY(10px) scale(0.96);
  transition:
    opacity var(--psm-chat-fab-item-duration, 300ms) var(--psm-chat-fab-item-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    transform var(--psm-chat-fab-item-duration, 300ms) var(--psm-chat-fab-item-ease, cubic-bezier(0.22, 1, 0.36, 1));
  transition-delay: var(--psm-fab-delay, 0ms);
}

.psm-chat-fab-question.psm-chat-fab-item--in {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.psm-chat-fab-question:hover,
.psm-chat-fab-question:focus {
  background: #1f2937;
  outline: none;
}

.psm-chat-fab-trigger {
  align-items: center;
  background: #111827;
  border: none;
  border-radius: 999px;
  box-shadow: 0 14px 30px rgba(8, 15, 28, 0.28);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 18px;
}

.psm-chat-fab-trigger:hover,
.psm-chat-fab-trigger:focus {
  background: #1f2937;
  outline: none;
}

.psm-chat-fab-icon {
  background: currentColor;
  border-radius: 4px;
  display: inline-block;
  height: 16px;
  mask: radial-gradient(circle at 30% 40%, transparent 0 28%, #000 29%) no-repeat center / 100% 100%;
  -webkit-mask: radial-gradient(circle at 30% 40%, transparent 0 28%, #000 29%) no-repeat center / 100% 100%;
  position: relative;
  width: 18px;
}

.psm-chat-fab-icon::before {
  border: 2px solid currentColor;
  border-radius: 8px 8px 8px 2px;
  content: "";
  display: block;
  height: 12px;
  width: 14px;
}

/* Product context card centered in the chat header */
.psm-chat-product-context {
  max-width: 100%;
  min-width: 0;
  pointer-events: none;
  width: 100%;
}

.psm-chat-product-context[hidden] {
  display: none;
}

.psm-chat-product-context-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
  padding: 8px 10px;
  pointer-events: auto;
}

.psm-chat-product-context-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.psm-chat-product-context-image {
  border-radius: 10px;
  flex: 0 0 auto;
  height: 40px;
  object-fit: cover;
  width: 40px;
}

.psm-chat-product-context-info {
  flex: 1 1 auto;
  min-width: 0;
}

.psm-chat-product-context-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psm-chat-product-context-price {
  color: var(--psm-chat-muted);
  font-size: 12px;
  margin: 2px 0 0;
}

.psm-chat-product-context-add {
  background: #111827;
  border: none;
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  white-space: nowrap;
}

.psm-chat-product-context-add:hover,
.psm-chat-product-context-add:focus {
  background: #1f2937;
  outline: none;
}

.psm-chat-product-context-add.is-success {
  background: #059669;
}

.psm-chat-product-context-add.is-loading {
  cursor: wait;
  opacity: 0.75;
}

.psm-chat-shop-logo {
  align-items: center;
  display: flex;
  justify-content: center;
  max-width: min(220px, 100%);
  min-width: 0;
  padding: 2px 8px;
}

.psm-chat-shop-logo[hidden] {
  display: none;
}

.psm-chat-shop-logo-image {
  display: block;
  height: auto;
  max-height: 36px;
  max-width: 100%;
  object-fit: contain;
  width: auto;
}

/* Day-change banner: wavy lines flanking `DD/MM/YYYY - HH:mm`. */
.psm-chat-day-change {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 14px 0 10px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.psm-chat-day-change-line {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='8' viewBox='0 0 24 8' fill='none'%3E%3Cpath d='M0 4 C3 0.5 5 7.5 8 4 S13 0.5 16 4 S21 7.5 24 4' stroke='%23aeb6c4' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: repeat-x;
  background-size: 24px 8px;
  flex: 1 1 0;
  height: 8px;
  min-width: 0;
  overflow: hidden;
}

.psm-chat-day-change-label {
  color: #5e6678;
  flex: 0 1 auto;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Page-change banner: centered status row inserted between messages. */
.psm-chat-page-change {
  display: flex;
  justify-content: center;
  margin: 10px 0 4px;
}

.psm-chat-page-change-card {
  align-items: center;
  background: var(--psm-chat-soft, #f8fafc);
  border: 1px solid var(--psm-chat-border, rgba(15, 23, 42, 0.08));
  border-radius: 12px;
  display: flex;
  gap: 10px;
  max-width: min(92%, 420px);
  min-width: 0;
  padding: 6px 10px;
}

.psm-chat-page-change-image {
  background: #ffffff;
  border-radius: 8px;
  flex: 0 0 auto;
  height: 34px;
  object-fit: contain;
  width: 34px;
}

.psm-chat-page-change-info {
  flex: 1 1 auto;
  min-width: 0;
}

.psm-chat-page-change-label {
  color: var(--psm-chat-muted, #64748b);
  font-size: 9px;
  letter-spacing: 0.06em;
  line-height: 1.2;
  margin: 0;
  text-transform: uppercase;
}

.psm-chat-page-change-name {
  color: var(--psm-chat-text, #0f172a);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  margin: 1px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psm-chat-page-change-reference {
  color: var(--psm-chat-muted, #64748b);
  font-size: 10px;
  line-height: 1.3;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psm-chat-page-change-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.psm-chat-page-change-btn {
  align-items: center;
  background: var(--psm-chat-surface, #ffffff);
  border: 1px solid var(--psm-chat-border, rgba(15, 23, 42, 0.12));
  border-radius: 8px;
  box-sizing: border-box;
  color: var(--psm-chat-text, #0f172a);
  cursor: pointer;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  padding: 0;
  text-decoration: none;
  width: 28px;
}

.psm-chat-page-change-btn svg {
  height: 15px;
  width: 15px;
}

.psm-chat-page-change-btn:hover,
.psm-chat-page-change-btn:focus {
  border-color: var(--psm-chat-primary, #111827);
  color: var(--psm-chat-primary, #111827);
  outline: none;
}

.psm-chat-page-change-cart {
  background: var(--psm-chat-primary, #111827);
  border-color: var(--psm-chat-primary, #111827);
  color: #ffffff;
}

.psm-chat-page-change-cart:hover,
.psm-chat-page-change-cart:focus {
  background: var(--psm-chat-primary-dark, #1f2937);
  color: #ffffff;
}

.psm-chat-page-change-cart.is-loading {
  cursor: wait;
  opacity: 0.7;
}

.psm-chat-page-change-cart.is-success {
  background: #059669;
  border-color: #059669;
}

.psm-chat-page-change-cart.is-error {
  background: var(--psm-chat-error, #dc2626);
  border-color: var(--psm-chat-error, #dc2626);
}

.psm-chat-scroll-btn {
  align-items: center;
  background: var(--psm-chat-primary);
  border: 1px solid var(--psm-chat-primary);
  border-radius: 999px;
  box-shadow: 0 4px 10px var(--psm-chat-primary-ring);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 0;
  height: 36px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 12px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
  width: 36px;
  z-index: 7;
}

.psm-chat-scroll-btn::before {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  box-sizing: border-box;
  content: "";
  display: block;
  height: 9px;
  width: 9px;
}

.psm-chat-scroll-top::before {
  position: relative;
  top: 1.5px;
  transform: rotate(-135deg);
}

.psm-chat-scroll-bottom::before {
  position: relative;
  top: -1.5px;
  transform: rotate(45deg);
}

.psm-chat-scroll-btn:hover,
.psm-chat-scroll-btn:focus-visible {
  background: var(--psm-chat-primary-dark);
  border-color: var(--psm-chat-primary-dark);
  box-shadow: 0 0 0 3px var(--psm-chat-primary-ring);
  outline: none;
  transform: translateY(-1px);
}

.psm-chat-scroll-btn[hidden] {
  display: none !important;
}

.psm-chat-scroll-top {
  top: calc(var(--psm-chat-inset-top) + 8px);
}

.psm-chat-scroll-bottom {
  bottom: calc(var(--psm-chat-inset-bottom) + 8px);
}

@media (prefers-reduced-transparency: reduce) {
  .psm-chat-header,
  .psm-chat-form,
  .psm-chat-status {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--psm-chat-chat-bg);
  }

  .psm-chat-header::before,
  .psm-chat-form::before {
    display: none;
  }
}

.psm-chat-message-ephemeral,
.psm-chat-message-welcome {
  white-space: pre-line;
}
