.onepa-chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;

  display: flex;
  flex-direction: column;
  align-items: flex-end;

  gap: 14px;
}


/* ============================================================
   CHAT BUBBLE
   ============================================================ */

.chat-bubble {
  display: flex;
  align-items: center;

  gap: 12px;

  background: var(--white, #ffffff);

  border: none;

  border-radius: 999px;

  padding: 8px 10px 8px 8px;

  box-shadow:
    0 12px 30px rgba(11, 45, 92, 0.18);

  cursor: pointer;

  font-family: inherit;

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}


.chat-bubble:hover {
  transform:
    translateY(-2px);

  box-shadow:
    0 16px 36px rgba(11, 45, 92, 0.24);
}


.chat-bubble:focus-visible {
  outline:
    3px solid rgba(50, 102, 176, 0.2);

  outline-offset:
    3px;
}


/* ============================================================
   BUBBLE ICON
   ============================================================ */

.chat-bubble-icon {
  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  flex: none;

  background:
    transparent;

  overflow:
    hidden;
}


.chat-bubble-icon img {
  width: 100%;
  height: 100%;

  object-fit:
    contain;

  display:
    block;

  filter:
    none;
}


/* ============================================================
   BUBBLE TEXT
   ============================================================ */

.chat-bubble-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  line-height:
    1.25;

  text-align:
    left;
}


.chat-bubble-text strong {
  font-size:
    14px;

  font-weight:
    800;

  color:
    var(--blue-dark, #0b2d5c);
}


.chat-bubble-text span {
  font-size:
    12.5px;

  color:
    var(--muted, #667085);
}


/* ============================================================
   BUBBLE ARROW
   ============================================================ */

.chat-bubble-arrow {
  width: 32px;
  height: 32px;

  border-radius:
    50%;

  background:
    var(--blue-light, #eef4ff);

  display: flex;
  align-items: center;
  justify-content: center;

  flex: none;

  margin-left:
    4px;
}


.chat-bubble-arrow svg {
  width: 16px;
  height: 16px;

  color:
    var(--blue-mid, #3266b0);

  transition:
    transform 0.2s ease;
}


.chat-bubble.is-open
.chat-bubble-arrow svg {
  transform:
    rotate(90deg);
}


/* ============================================================
   CHAT PANEL
   ============================================================ */

.chat-panel {
  width:
    370px;

  max-width:
    calc(100vw - 32px);

  height:
    min(560px, calc(100vh - 120px));

  background:
    #ffffff;

  border-radius:
    18px;

  box-shadow:
    0 24px 60px rgba(11, 45, 92, 0.28);

  overflow:
    hidden;

  display:
    flex;

  flex-direction:
    column;
}


.chat-panel[hidden] {
  display:
    none !important;
}


/* ============================================================
   CHAT HEADER
   ============================================================ */

.chat-panel-header {
  display:
    flex;

  align-items:
    center;

  gap:
    12px;

  padding:
    16px;

  background:
    var(--blue-dark, #0b2d5c);
}


/* ============================================================
   HEADER ICON
   ============================================================ */

.chat-panel-icon {
  width:
    42px;

  height:
    42px;

  display:
    flex;

  align-items:
    center;

  justify-content:
    center;

  flex:
    none;

  background:
    transparent;
}


.chat-panel-icon img {
  width:
    100%;

  height:
    100%;

  object-fit:
    contain;

  display:
    block;

  filter:
    none;
}


/* ============================================================
   HEADER TEXT
   ============================================================ */

.chat-panel-heading {
  display:
    flex;

  flex-direction:
    column;

  line-height:
    1.3;
}


.chat-panel-heading strong {
  color:
    #ffffff;

  font-size:
    14px;
}


.chat-panel-heading span {
  color:
    #c3d2ea;

  font-size:
    12px;
}


/* ============================================================
   CLOSE BUTTON
   ============================================================ */

.chat-panel-close {
  margin-left:
    auto;

  width:
    34px;

  height:
    34px;

  border-radius:
    50%;

  background:
    rgba(255, 255, 255, 0.1);

  border:
    none;

  color:
    #ffffff;

  font-size:
    20px;

  line-height:
    1;

  cursor:
    pointer;

  transition:
    background 0.15s ease;
}


.chat-panel-close:hover {
  background:
    rgba(255, 255, 255, 0.2);
}


/* ============================================================
   MESSAGE BODY
   ============================================================ */

.chat-panel-body {
  flex:
    1;

  overflow-y:
    auto;

  padding:
    18px 16px;

  background:
    #f6f8fc;

  display:
    flex;

  flex-direction:
    column;

  gap:
    10px;

  scroll-behavior:
    smooth;
}


/* ============================================================
   MESSAGE
   ============================================================ */

.chat-message {
  display:
    flex;

  width:
    100%;
}


.chat-message--visitor {
  justify-content:
    flex-end;
}


.chat-message--agent {
  justify-content:
    flex-start;
}


.chat-message-bubble {
  max-width:
    82%;

  padding:
    11px 13px;

  border-radius:
    15px;

  font-size:
    13.5px;

  line-height:
    1.5;

  word-break:
    break-word;

  white-space:
    pre-wrap;
}


/* ============================================================
   AGENT MESSAGE
   ============================================================ */

.chat-message--agent
.chat-message-bubble {

  background:
    #ffffff;

  color:
    var(--ink, #172033);

  border:
    1px solid #e3e7ee;

  border-bottom-left-radius:
    4px;
}


/* ============================================================
   VISITOR MESSAGE
   ============================================================ */

.chat-message--visitor
.chat-message-bubble {

  background:
    var(--blue-mid, #3266b0);

  color:
    #ffffff;

  border-bottom-right-radius:
    4px;
}


/* ============================================================
   TYPING INDICATOR
   ============================================================ */

.chat-typing {
  display:
    flex;

  align-items:
    center;

  gap:
    4px;

  padding:
    0 16px 10px;

  background:
    #f6f8fc;
}


.chat-typing[hidden] {
  display:
    none !important;
}


.chat-typing span {
  width:
    6px;

  height:
    6px;

  border-radius:
    50%;

  background:
    #98a6ba;

  animation:
    onepa-chat-typing 1.2s infinite ease-in-out;
}


.chat-typing span:nth-child(2) {
  animation-delay:
    0.15s;
}


.chat-typing span:nth-child(3) {
  animation-delay:
    0.30s;
}


.chat-typing em {
  margin-left:
    6px;

  font-size:
    11px;

  font-style:
    normal;

  color:
    #7a8799;
}


@keyframes onepa-chat-typing {

  0%,
  60%,
  100% {

    opacity:
      0.35;

    transform:
      translateY(0);

  }

  30% {

    opacity:
      1;

    transform:
      translateY(-2px);

  }

}


/* ============================================================
   FOOTER
   ============================================================ */

.chat-panel-footer {
  padding:
    12px;

  background:
    #ffffff;

  border-top:
    1px solid #e5eaf1;
}


/* ============================================================
   INPUT FORM
   ============================================================ */

.chat-input-form {
  display:
    flex;

  align-items:
    center;

  gap:
    8px;
}


/* ============================================================
   INPUT
   ============================================================ */

.chat-input {
  flex:
    1;

  min-width:
    0;

  height:
    44px;

  padding:
    0 13px;

  border:
    1px solid #dce2eb;

  border-radius:
    12px;

  outline:
    none;

  font:
    inherit;

  font-size:
    13px;

  color:
    var(--ink, #172033);

  background:
    #ffffff;

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}


.chat-input::placeholder {
  color:
    #98a2b3;
}


.chat-input:focus {
  border-color:
    var(--blue-mid, #3266b0);

  box-shadow:
    0 0 0 3px rgba(50, 102, 176, 0.1);
}


.chat-input:disabled {
  background:
    #f4f6f9;

  cursor:
    not-allowed;
}


/* ============================================================
   SEND BUTTON
   ============================================================ */

.chat-send {
  width:
    44px;

  height:
    44px;

  flex:
    none;

  border:
    none;

  border-radius:
    12px;

  background:
    var(--blue-mid, #3266b0);

  color:
    #ffffff;

  display:
    flex;

  align-items:
    center;

  justify-content:
    center;

  cursor:
    pointer;

  transition:
    transform 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}


.chat-send:hover {
  background:
    var(--blue-dark, #0b2d5c);
}


.chat-send:active {
  transform:
    scale(0.96);
}


.chat-send:disabled {
  opacity:
    0.6;

  cursor:
    not-allowed;
}


.chat-send svg {
  width:
    19px;

  height:
    19px;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 480px) {

  .onepa-chat-widget {
    right:
      16px;

    bottom:
      16px;
  }


  .chat-bubble-text {
    display:
      none;
  }


  .chat-bubble {
    padding:
      8px;
  }


  .chat-bubble-arrow {
    display:
      none;
  }


  .chat-panel {
    width:
      calc(100vw - 32px);

    max-width:
      calc(100vw - 32px);

    height:
      min(560px, calc(100vh - 100px));
  }


  .chat-message-bubble {
    max-width:
      88%;
  }

}


/* ============================================================
   VERY SMALL SCREENS
   ============================================================ */

@media (max-width: 360px) {

  .onepa-chat-widget {
    right:
      10px;

    bottom:
      10px;
  }


  .chat-panel {
    width:
      calc(100vw - 20px);

    max-width:
      calc(100vw - 20px);
  }

}