/* Right floating contact. Does not change page flow. */
.sa-float {
  position: fixed;
  z-index: 1200;
  right: 0;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  transform: translateY(-50%);
  pointer-events: none;
  /* Keep the closed sheet from extending the page scroll, while the open sheet can sit to the left. */
  clip-path: inset(-100vh 0 -100vh -100vw);
}

.sa-float__stack,
.sa-float__contact,
.sa-float__bot,
.sa-float__bot-panel {
  pointer-events: auto;
}

.sa-float__contact {
  position: relative;
  display: flex;
  align-items: flex-start;
}

.sa-float__stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.sa-float__tab,
.sa-float__item,
.sa-float__bot {
  border: 0;
  cursor: pointer;
  text-decoration: none;
}

.sa-float__tab {
  min-width: 44px;
  min-height: 92px;
  padding: 12px 8px;
  border-radius: 10px 0 0 10px;
  background: #d7263d;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.sa-float__item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  min-height: 48px;
  color: #fff;
}

/* One capsule: label slides inside the wrapper and continues behind the icon. */
.sa-float__pill {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-end;
  height: 48px;
  max-width: 48px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #f5e9c8;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  transition: max-width 0.22s ease, border-radius 0.22s ease;
}

.sa-float__item:hover .sa-float__pill,
.sa-float__item:focus-visible .sa-float__pill,
.sa-float__item.is-open .sa-float__pill {
  max-width: min(300px, calc(100vw - 72px));
  border-radius: 16px 999px 999px 16px;
}

.sa-float__icon {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  margin: 0;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  font-size: 18px;
  font-weight: 800;
  box-shadow: none;
}

.sa-float__item--msg .sa-float__icon { background: #0084ff; }
.sa-float__item--zalo .sa-float__icon { background: #0068ff; }
.sa-float__item--phone .sa-float__icon { background: #1f8a4c; }

.sa-float__short {
  display: none;
}

.sa-float__label {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  height: 48px;
  max-width: none;
  margin: 0;
  padding: 0 4px 0 16px;
  overflow: hidden;
  white-space: nowrap;
  transform: none;
  border-radius: 0;
  background: #f5e9c8;
  color: #002722;
  font-size: 14px;
  font-weight: 700;
  line-height: 48px;
  opacity: 1;
}

.sa-float__bot {
  min-width: 44px;
  min-height: 44px;
  margin-right: 0;
  padding: 0 12px;
  border-radius: 10px 0 0 10px;
  background: #003c35;
  color: #f5e9c8;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.sa-float__bot-panel {
  width: min(280px, calc(100vw - 24px));
  margin-right: 8px;
  padding: 14px;
  border-radius: 12px;
  background: #002722;
  color: #f5e9c8;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.sa-float__bot-panel[hidden] {
  display: none;
}

.sa-float__sheet {
  position: absolute;
  top: 0;
  right: calc(100% - 1px);
  box-sizing: border-box;
  width: min(460px, calc(100vw - 52px));
  max-height: calc(100vh - 16px);
  overflow-x: clip;
  overflow-y: auto;
  padding: 22px 20px 18px;
  border-radius: 22px 0 0 22px;
  background: #fff;
  color: #1c1c1c;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s ease;
}

.sa-float.is-form-open .sa-float__sheet {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sa-float__sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d7263d;
  color: #fff;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.sa-float__sheet h2 {
  margin: 0 0 12px;
  padding: 0 48px 10px 0;
  border-bottom: 1px dashed #d5d5d5;
  color: #d7263d;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.sa-float__sheet .wpcf7,
.sa-float__sheet .wpcf7 form,
.sa-float__sheet .wpcf7 p,
.sa-float__sheet .wpcf7 label {
  max-width: 100%;
  margin-right: 0;
  margin-left: 0;
  box-sizing: border-box;
}

.sa-float__sheet .wpcf7 {
  margin: 0;
}

.sa-float__sheet .wpcf7 label {
  display: block;
  margin: 0 0 14px;
  color: #1c1c1c;
  font-size: 16px;
  font-weight: 700;
}

.sa-float__sheet .wpcf7 input[type="text"],
.sa-float__sheet .wpcf7 input[type="email"],
.sa-float__sheet .wpcf7 input[type="tel"],
.sa-float__sheet .wpcf7 textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 52px;
  margin-top: 8px;
  padding: 14px 16px;
  border: 1px solid #d5d5d5;
  border-radius: 14px;
  background: #fff;
  color: #1c1c1c;
  font-size: 16px;
  box-shadow: none;
}

.sa-float__sheet .wpcf7 textarea {
  min-height: 120px;
  resize: vertical;
}

.sa-float__sheet .wpcf7-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: #d7263d;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.sa-float__sheet .wpcf7-submit:hover {
  background: #b81e32;
}

.sa-float__sheet .wpcf7-not-valid-tip {
  color: #d7263d;
  font-size: 13px;
  font-weight: 600;
}

.sa-float__sheet .wpcf7-response-output {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid #d7e5dc;
  border-radius: 12px;
  background: #f4faf6;
  color: #0a3732;
}

.sa-hp {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

html.has-off-canvas .sa-float,
body.sa-filter-open .sa-float {
  visibility: hidden;
}

@media (max-width: 480px) {
  .sa-float__sheet {
    padding: 18px 14px 14px;
    border-radius: 20px 0 0 20px;
  }

  .sa-float__sheet h2 {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sa-float__label,
  .sa-float__pill,
  .sa-float__sheet {
    transition: none;
  }
}

@media (max-width: 1024px) {
  :root {
    --sa-bar-h: 56px;
  }

  body.sa-has-float {
    padding-bottom: calc(var(--sa-bar-h) + env(safe-area-inset-bottom, 0px));
  }

  .sa-float {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    transform: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    clip-path: none;
  }

  .sa-float__stack {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    width: 100%;
    height: calc(var(--sa-bar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    background: #002722;
  }

  .sa-float__contact,
  .sa-float__item {
    flex: 1 1 0;
    width: 25%;
    max-width: 25%;
    min-width: 0;
    height: var(--sa-bar-h);
    min-height: var(--sa-bar-h);
    max-height: var(--sa-bar-h);
  }

  .sa-float__tab,
  .sa-float__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin: 0;
    padding: 4px 2px;
    border-radius: 0;
    box-shadow: none;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    transform: none;
    font-size: 11px;
    line-height: 1.1;
    letter-spacing: 0;
  }

  .sa-float__tab {
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    color: #fff;
    background: #d7263d;
  }

  .sa-float__tab::before {
    content: "";
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5h16a1 1 0 0 1 1 1v9.5a1 1 0 0 1-1 1H8.2L4 20.2V6a1 1 0 0 1 1-1z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5h16a1 1 0 0 1 1 1v9.5a1 1 0 0 1-1 1H8.2L4 20.2V6a1 1 0 0 1 1-1z'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .sa-float__item--msg { background: #0084ff; color: #fff; }
  .sa-float__item--zalo { background: #0068ff; color: #fff; }
  .sa-float__item--phone { background: #1f8a4c; color: #fff; }

  .sa-float__pill,
  .sa-float__item:hover .sa-float__pill,
  .sa-float__item:focus-visible .sa-float__pill,
  .sa-float__item.is-open .sa-float__pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: none;
    height: auto;
    margin: 0;
    padding: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    box-shadow: none;
    transition: none;
  }

  .sa-float__icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 16px;
  }

  .sa-float__item--msg .sa-float__icon,
  .sa-float__item--zalo .sa-float__icon,
  .sa-float__item--phone .sa-float__icon {
    background: transparent;
  }

  .sa-float__icon svg {
    width: 20px;
    height: 20px;
  }

  .sa-float__label,
  .sa-float__item:hover .sa-float__label,
  .sa-float__item:focus-visible .sa-float__label,
  .sa-float__item.is-open .sa-float__label {
    display: none;
    max-width: 0;
    opacity: 0;
    padding: 0;
    transform: none;
    transition: none;
  }

  .sa-float__short {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .sa-float__bot {
    position: absolute;
    right: 16px;
    bottom: calc(var(--sa-bar-h) + 16px + env(safe-area-inset-bottom, 0px));
    left: auto;
    z-index: 2;
    margin: 0;
    min-height: 44px;
    height: 48px;
    padding: 0 14px;
    border-radius: 999px;
  }

  .sa-float__bot-panel {
    position: absolute;
    right: 16px;
    bottom: calc(var(--sa-bar-h) + 16px + 48px + 10px + env(safe-area-inset-bottom, 0px));
    z-index: 2;
    width: min(280px, calc(100vw - 32px));
    margin: 0;
  }

  .sa-float__sheet {
    position: fixed;
    top: auto;
    right: 0;
    left: 0;
    bottom: calc(var(--sa-bar-h) + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - var(--sa-bar-h) - env(safe-area-inset-bottom, 0px) - 72px);
    border-radius: 22px 22px 0 0;
    overflow-x: clip;
    transform: translateY(110%);
  }

  .sa-float__sheet-close {
    top: 12px;
    right: 12px;
  }

  .sa-float__sheet .wpcf7 textarea {
    min-height: 88px;
  }

  .sa-float__sheet .wpcf7 label {
    margin-bottom: 10px;
  }

  .sa-float.is-form-open .sa-float__sheet {
    z-index: 3;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) and (min-width: 768px) {
  .sa-float__short,
  .sa-float__tab {
    font-size: 13px;
  }
}
