* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.header {
  font-family: sans-serif;
  background-color: #f0f2f5;
  margin: 0;
  padding: 1.25em;
  background-image: url("https://www.lexus.com.my/content/dam/lexus-v3-malaysia/model/suv/nx/nx25/masthead-d-lexus-nx.jpg");
  background-size: cover;
  background-position: center;
  min-height: 100dvh;
}

.popup-wrapper {
  position: fixed;
  bottom: 1.25em;
  right: 1.25em;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5em;
  max-width: 100%;
  z-index: 1000;
}

.popup-container {
  background-color: #000000;
  color: #fff;
  border-radius: 1.25em 1.25em 0px 1.25em;
  width: 21.875em;
  padding: 0.9375em;
  box-shadow: 0 0.25em 0.9375em #202020;
  box-sizing: border-box;
  opacity: 0.9;
  position: relative;
  display: none;
}

.popup-header {
  display: flex;
  align-items: center;
  margin-bottom: 1.25em;
}

.show-popup {
  display: block;
  animation: fadeIn 1s ease;
}

.logo-placeholder {
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 1.25em;
  flex-shrink: 0;
  font-size: 1.125em;
  color: #333;
  box-shadow: 0 0 0 white, 0 0 0.5rem white, 0 0 0 #d9d9d9;
}

.title {
  font-size: 1em;
  flex-grow: 1;
}

.close-button {
  background: none;
  border: 0.0625em solid white;
  color: #d1d5db;
  font-size: 1.5em;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  width: 1.25em;
  height: 1.25em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-button i {
  font-size: 0.75em;
}

.close-button:hover {
  color: #fff;
}

.popup-content {
  font-size: 0.9em;
  line-height: 1.4;
  color: #ddd;
}

.popup-tail {
  content: "";
  position: absolute;
  bottom: -0.6875em;
  right: 0;
  width: 0.8125em;
  height: 0.8125em;
  background-color: #000000;
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 0%);
  border-radius: 0;
  transform: perspective(1px) rotate(0.001deg);
  z-index: 0;
}

/* allow hiding the popup container via class */
.popup-container.hidden {
  display: none !important;
}

/* dynamic tail: allow inline left positioning; default to right */
.popup-tail.dynamic {
  right: auto;
}

/* small visual tweak for tail when positioned left/right */
.popup-tail.dynamic::after {
  content: none;
}

.floating-chat-icon-container {
  width: 3.5em;
  height: 3.5em;
  border-radius: 100%;
  z-index: 50;
  box-shadow: 0 0 0 white, 0 0 1.5rem white, 0 0 0 white;
  overflow: hidden;
  cursor: pointer;
}

/* Improve touch / drag responsiveness */
.floating-chat-icon-container {
  touch-action: none; /* prevent browser pan/zoom while dragging */
  -webkit-user-select: none;
  user-select: none;
}

.floating-chat-icon-container img {
  width: 3.625em;
  height: 3.625em;
  margin: -0.0625em;
  pointer-events: none; /* let container receive pointer events reliably (Firefox) */
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  transition: background-color 0.3s ease;
  z-index: 999;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 1em;
  padding: 1em;
  box-sizing: border-box;
  align-items: center;
}
.bottom-nav img {
  width: 2em;
  height: 2em;
  filter: brightness(0) invert(1);
}

.bottom-nav div {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 0.5em;
  color: white;
}

.bottom-nav h6 {
  font-size: 0.75em;
  margin: 0;
}

@media (max-width: 40em) {
  .popup-container {
    width: 100%;
    max-width: 21.75em;
    font-size: 0.9em;
  }

  .floating-chat-icon-container {
    box-shadow: 0 0 0.5rem white, 0 0 1rem white, 0 0 0 white;
  }

  .bottom-nav {
    display: grid;
  }

  .hidden {
    display: none !important;
  }
}
