/* ==========================================================
   WCPS CHAT WIDGET
========================================================== */

/* ==========================================================
   CHAT FONT — BEBAS NEUE THROUGHOUT
========================================================== */

.wcps-chat-launcher,
.wcps-chat-launcher *,
.wcps-chat-window,
.wcps-chat-window *,
.wcps-chat-message,
.wcps-chat-message *,
.wcps-chat-input,
.wcps-chat-send {
  font-family:
    "Bebas Neue",
    Arial,
    Helvetica,
    sans-serif !important;

  letter-spacing: 0.04em;
}


/* ==========================================================
   CHAT LAUNCHER
========================================================== */

.wcps-chat-launcher {
  position: fixed;
  right: 12px;
  bottom: 0;
  z-index: 1000;

  width: 300px;
  min-height: 44px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 18px;

  padding: 11px 17px;

  border: 1px solid #07162d;
  border-radius: 10px 10px 0 0;

  background: #0b2343;
  color: #ffffff;

  box-shadow:
    0 10px 30px rgba(7, 22, 45, 0.24);

  cursor: pointer;
}

.wcps-chat-launcher-text {
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.wcps-chat-launcher-brand {
  padding-right: 4px;

  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.05em;
}


/* ==========================================================
   CHAT WINDOW
========================================================== */

.wcps-chat-window {
  position: fixed;
  right: 12px;
  bottom: 0;
  z-index: 1001;

  width: min(340px, calc(100vw - 30px));
  height: min(500px, calc(100vh - 30px));

  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto;

  overflow: hidden;

  border: 1px solid #cfdbe7;
  border-radius: 14px 14px 0 0;

  background: #ffffff;

  box-shadow:
    0 24px 60px rgba(7, 22, 45, 0.26);
}

.wcps-chat-window.is-open {
  display: grid;
}


/* ==========================================================
   CHAT HEADER
========================================================== */

.wcps-chat-header {
  position: relative;

  min-height: 82px;

  display: flex;
  align-items: center;

  padding: 17px 58px 17px 20px;

  background: #0b2343;
  color: #ffffff;
}

.wcps-chat-header-copy {
  position: relative;
  z-index: 2;
}

.wcps-chat-header h2 {
  margin: 0 0 2px;

  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
}

.wcps-chat-header p {
  margin: 0;

  color: #b9cce0;

  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.15;
}

.wcps-chat-minimize {
  position: absolute;
  top: 18px;
  right: 14px;
  z-index: 3;

  width: 30px;
  height: 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  border: 0;
  background: transparent;
  color: #ffffff;

  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;

  cursor: pointer;

  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.wcps-chat-minimize:hover {
  opacity: 0.72;
  transform: translateY(-1px);
}


/* ==========================================================
   CHAT BODY
========================================================== */

.wcps-chat-body {
  min-height: 0;

  overflow-y: auto;

  padding: 18px;

  background: #f7f9fc;

  /*
   * Keep messages at their natural height.
   * This prevents the initial welcome bubble from stretching.
   */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}


/* ==========================================================
   CHAT MESSAGES
========================================================== */

.wcps-chat-message {
  flex: 0 0 auto !important;
  align-self: flex-start;

  width: auto;
  max-width: 82%;

  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;

  margin: 0 0 12px;
  padding: 11px 13px;

  display: block !important;

  border-radius: 12px;

  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.45;

  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: normal;
}

.wcps-chat-message-agent {
  margin-right: auto;

  color: #0b2343;
  background: #eaf3fb;

  border-bottom-left-radius: 4px;
}

.wcps-chat-message-user {
  align-self: flex-end;

  margin-left: auto;

  color: #ffffff;
  background: #0b2343;

  border-bottom-right-radius: 4px;
}

.wcps-chat-message > span:first-child {
  display: block;

  min-height: 0 !important;
  height: auto !important;

  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: normal;
}

.wcps-chat-message p {
  margin: 0;

  white-space: pre-line;
  overflow-wrap: anywhere;
}

.wcps-chat-message a {
  color: inherit;

  overflow-wrap: anywhere;
  word-break: break-word;

  text-decoration: underline;
  text-underline-offset: 2px;
}

.wcps-chat-time {
  display: block;

  min-height: 0 !important;
  height: auto !important;

  margin-top: 7px;

  color: #758291;

  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1;
}


/* ==========================================================
   COMPACT INITIAL WELCOME MESSAGE
========================================================== */

#wcps-chat-body > .wcps-chat-message:first-child {
  flex: 0 0 auto !important;
  align-self: flex-start !important;

  width: auto !important;
  max-width: 82% !important;

  min-height: 0 !important;
  height: fit-content !important;
  max-height: none !important;

  margin: 0 0 12px !important;
  padding: 12px 13px !important;

  display: block !important;

  justify-content: flex-start !important;
  align-items: flex-start !important;
}

#wcps-chat-body > .wcps-chat-message:first-child > * {
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
}

#wcps-chat-body > .wcps-chat-message:first-child .wcps-chat-time {
  position: static !important;

  margin-top: 7px !important;

  transform: none !important;
}


/* ==========================================================
   CHAT INPUT
========================================================== */

.wcps-chat-footer {
  padding: 14px;

  background: #ffffff;
  border-top: 1px solid #d7e3ee;
}

.wcps-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;

  gap: 10px;
}

.wcps-chat-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;

  padding: 11px 14px;

  border: 1px solid #d7e3ee;
  border-radius: 999px;

  color: #0b2343;
  background: #ffffff;

  font-size: 0.9rem;
}

.wcps-chat-input:focus {
  outline: none;

  border-color: #4d83b8;

  box-shadow:
    0 0 0 3px rgba(77, 131, 184, 0.14);
}

.wcps-chat-send {
  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  padding: 0;

  border: 0;
  border-radius: 50%;

  background: #0b2343;
  color: #ffffff;

  font-size: 1.1rem;

  cursor: pointer;
}

.wcps-chat-send:hover {
  background: #1d4f86;
}

.wcps-chat-send:disabled,
.wcps-chat-input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.wcps-chat-powered {
  margin: 9px 0 0;

  color: #758291;

  font-size: 0.68rem;
  text-align: center;
}


/* ==========================================================
   TYPING INDICATOR
========================================================== */

.wcps-chat-typing {
  width: fit-content;
  min-width: 62px;
}

.wcps-chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  min-height: 18px;
}

.wcps-chat-typing-dots > span {
  width: 6px;
  height: 6px;

  border-radius: 50%;

  background: #4d83b8;

  animation:
    wcps-chat-dot-pulse
    1.1s
    infinite
    ease-in-out;
}

.wcps-chat-typing-dots > span:nth-child(2) {
  animation-delay: 140ms;
}

.wcps-chat-typing-dots > span:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes wcps-chat-dot-pulse {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}


/* ==========================================================
   MOBILE
========================================================== */

@media (max-width: 600px) {
  .wcps-chat-launcher {
    right: 10px;
    bottom: 0;

    width: 240px;
  }

  .wcps-chat-window {
    right: 0;
    bottom: 0;

    width: 100%;
    height: min(620px, 88vh);

    border-radius: 16px 16px 0 0;
  }

  .wcps-chat-header {
    padding:
      17px
      58px
      17px
      20px;
  }

  .wcps-chat-minimize {
    top: 11px;
    right: 13px;
  }

  .wcps-chat-message {
    max-width: 88%;
  }

  #wcps-chat-body > .wcps-chat-message:first-child {
    max-width: 88% !important;
  }
}


/* ==========================================================
   REDUCED MOTION
========================================================== */

@media (prefers-reduced-motion: reduce) {
  .wcps-chat-typing-dots > span {
    animation: none;
    opacity: 0.7;
  }
}


/* ==========================================================
   FORCE TYPING / LOADING BUBBLE
========================================================== */

.wcps-chat-message.wcps-chat-typing {
  width: fit-content !important;
  min-width: 58px !important;
  padding: 12px 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.wcps-chat-message .wcps-chat-typing-dots {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px;
  height: 18px !important;
  white-space: normal !important;
}

.wcps-chat-message .wcps-chat-typing-dots > span {
  display: block !important;
  flex: 0 0 6px;
  width: 6px !important;
  height: 6px !important;
  border-radius: 50%;
  background: #4d83b8;
}

/* ==========================================================
   CHAT ADD TO CART
========================================================== */

.wcps-chat-product-actions {
  width: 100%;
  max-width: 82%;
  margin: -4px 0 14px;
  display: grid;
  gap: 8px;
  align-self: flex-start;
}

.wcps-chat-product-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.wcps-chat-product-action-label {
  color: #53677f;
  font-size: 0.78rem;
  line-height: 1.15;
}

.wcps-chat-add-cart {
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid #0b2343;
  border-radius: 999px;
  background: #0b2343;
  color: #ffffff;
  font-family: "Bebas Neue", Arial, Helvetica, sans-serif !important;
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  white-space: nowrap;
  cursor: pointer;
}

.wcps-chat-add-cart:hover {
  background: #1d4f86;
  border-color: #1d4f86;
}

.wcps-chat-add-cart.is-added {
  background: #ffffff;
  color: #0b2343;
}

@media (max-width: 600px) {
  .wcps-chat-product-actions {
    max-width: 88%;
  }

  .wcps-chat-product-action {
    grid-template-columns: 1fr;
  }

  .wcps-chat-add-cart {
    width: 100%;
  }
}


/* ==========================================================
   CHAT PRODUCT ACTIONS — INSIDE ASSISTANT BUBBLE
========================================================== */

.wcps-chat-message-has-actions {
  width: min(290px, 92%) !important;
  max-width: 92% !important;
}

.wcps-chat-message-has-actions .wcps-chat-product-actions {
  width: 100%;
  max-width: none;
  margin: 12px 0 2px;
  padding-top: 10px;

  display: grid;
  gap: 8px;

  border-top: 1px solid rgba(11, 35, 67, 0.12);
}

.wcps-chat-message-has-actions .wcps-chat-product-action {
  width: 100%;

  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;

  gap: 10px;
}

.wcps-chat-message-has-actions .wcps-chat-product-action-label {
  color: #53677f;

  font-size: 0.78rem;
  line-height: 1.1;
  letter-spacing: 0.05em;
}

.wcps-chat-message-has-actions .wcps-chat-add-cart {
  min-height: 32px;

  padding: 7px 11px;

  border: 1px solid #0b2343;
  border-radius: 999px;

  background: #0b2343;
  color: #ffffff;

  font-family:
    "Bebas Neue",
    Arial,
    Helvetica,
    sans-serif !important;

  font-size: 0.78rem;
  letter-spacing: 0.07em;

  white-space: nowrap;

  cursor: pointer;
}

.wcps-chat-message-has-actions .wcps-chat-add-cart:hover {
  background: #1d4f86;
  border-color: #1d4f86;
}

.wcps-chat-message-has-actions .wcps-chat-add-cart.is-added {
  background: #ffffff;
  color: #0b2343;
}

.wcps-chat-message-has-actions .wcps-chat-time {
  margin-top: 9px;
}

@media (max-width: 600px) {
  .wcps-chat-message-has-actions {
    width: min(300px, 94%) !important;
    max-width: 94% !important;
  }

  .wcps-chat-message-has-actions .wcps-chat-product-action {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .wcps-chat-message-has-actions .wcps-chat-add-cart {
    width: auto;
  }
}


/* ==========================================================
   CHAT NAVIGATION LINKS
========================================================== */
.wcps-chat-message-has-navigation {
  width: min(290px, 92%) !important;
  max-width: 92% !important;
}

.wcps-chat-navigation-actions {
  width: 100%;
  margin: 12px 0 2px;
  padding-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-top: 1px solid rgba(11, 35, 67, 0.12);
}

.wcps-chat-navigation-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid #0b2343;
  border-radius: 999px;
  background: #0b2343;
  color: #ffffff !important;
  font-family: "Bebas Neue", Arial, Helvetica, sans-serif !important;
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  line-height: 1;
  text-decoration: none !important;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.wcps-chat-navigation-link:hover {
  background: #1d4f86;
  border-color: #1d4f86;
  transform: translateY(-1px);
}

.wcps-chat-message-has-navigation .wcps-chat-time {
  margin-top: 9px;
}
