/* Container for positioning */
.lx-ptt {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  /* Prevent layout shift by ensuring fixed positioning doesn't affect flow */
  position: relative;
}

.lx-ptt--bottom-center {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0;
  z-index: 1000;
  /* Prevent layout shift on first show */
  width: auto;
  height: auto;
  contain: layout style;
}

/* Button with smooth transitions */
.lx-ptt__btn {
  background: linear-gradient(135deg,
      var(--lx-color-neutral-100) 0%,
      var(--lx-color-neutral-300) 100%);
  border: 1px solid var(--lx-color-neutral-500);
  border-radius: var(--lx-rounded-xl);
  padding: 16px 36px;
  font-size: var(--lx-text-sm);
  color: var(--lx-color-neutral-700);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--lx-shadow-lg);
  min-width: 240px;
  min-height: 56px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: scale(1.02) translateY(-2px);
}

.lx-ptt__btn:hover {
  box-shadow: var(--lx-shadow-xl);
  transform: scale(1.04) translateY(-4px);
  border-color: var(--lx-color-neutral-600);

}

.lx-ptt__btn:active {
  transform: scale(0.98);
}

/* State transitions */
.lx-ptt__btn--transitioning {
  opacity: 0.7;
  transform: scale(0.95);
}

/* Key visual */
.lx-ptt__kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--lx-color-neutral-100);
  border: 1px solid var(--lx-color-neutral-300);
  border-radius: var(--lx-rounded-sm);
  font-size: var(--lx-text-xs);
  font-family: monospace;
  color: var(--lx-color-neutral-500);
  margin: 0 4px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.lx-ptt__kbd::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.6),
      transparent);
  animation: lx-ptt-kbd-shine 3s ease-in-out infinite;
}

@keyframes lx-ptt-kbd-shine {
  0% {
    left: -100%;
  }

  50% {
    left: 100%;
  }

  100% {
    left: 100%;
  }
}

/* Recording state */
.lx-ptt__btn--rec {
  background: linear-gradient(135deg,
      var(--lx-color-red-50) 0%,
      var(--lx-color-red-100) 100%);
  border-color: var(--lx-color-red-300);
  animation: lx-ptt-pulse 1.5s ease-in-out infinite;
}

.lx-ptt__btn--rec:hover {

}

.lx-ptt__rec-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--lx-color-red-600);
  border-radius: var(--lx-rounded-full);
  margin-right: 8px;
  animation: lx-ptt-blink 1s ease-in-out infinite;
}

@keyframes lx-ptt-pulse {

  0%,
  100% {
    box-shadow: var(--lx-shadow-sm);
  }

  50% {
    box-shadow: var(--lx-shadow-lg);
  }
}

@keyframes lx-ptt-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* Sending state */
.lx-ptt__btn--send {
  background: linear-gradient(135deg,
      var(--lx-color-sky-50) 0%,
      var(--lx-color-sky-100) 100%);
  border-color: var(--lx-color-sky-300);
  cursor: wait;
}

.lx-ptt__btn--send:hover {
  transform: scale(1);
  box-shadow: var(--lx-shadow-sm);
}

.lx-ptt__spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--lx-color-sky-400);
  border-top-color: transparent;
  border-radius: var(--lx-rounded-full);
  margin-right: 8px;
  animation: lx-ptt-spin 0.8s linear infinite;
}

@keyframes lx-ptt-spin {
  to {
    transform: rotate(360deg);
  }
}

/* AI replying state */
.lx-ptt__btn--reply {
  background: linear-gradient(135deg,
      var(--lx-color-primary-50) 0%,
      var(--lx-color-primary-100) 100%);
  border-color: var(--lx-color-primary-300);
  cursor: default;
  color: var(--lx-color-primary-700);
}

.lx-ptt__btn--reply:hover {
  transform: scale(1);
  box-shadow: var(--lx-shadow-sm);
}

.lx-ptt__dots {
  display: inline-block;
  margin-left: 4px;
}

.lx-ptt__dot {
  display: inline-block;
  animation: lx-ptt-wave 1.4s ease-in-out infinite;
}

.lx-ptt__dot:nth-child(2) {
  animation-delay: 0.2s;
}

.lx-ptt__dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes lx-ptt-wave {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-4px);
  }
}

/* Animation states for show/hide */
.lx-ptt--hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateX(-50%) translateY(20px);
  /* Ensure no layout impact when hidden */
  position: fixed;
  bottom: 32px;
  left: 50%;
}

.lx-ptt--showing {
  animation: lx-ptt-show 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.lx-ptt--hiding {
  animation: lx-ptt-hide 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.lx-ptt--visible {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Show animation - fade in + slide up */
@keyframes lx-ptt-show {
  0% {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(20px);
  }

  100% {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}

/* Hide animation - fade out + slide down */
@keyframes lx-ptt-hide {
  0% {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }

  100% {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(20px);
  }
}

/* Center positioned elements don't need transform adjustments */
.lx-ptt:not(.lx-ptt--bottom-center).lx-ptt--hidden {
  transform: translateY(20px);
  /* Ensure proper positioning for center elements */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(20px);
}

.lx-ptt:not(.lx-ptt--bottom-center).lx-ptt--visible {
  transform: translateY(0);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.lx-ptt:not(.lx-ptt--bottom-center).lx-ptt--showing {
  animation: lx-ptt-show-center 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.lx-ptt:not(.lx-ptt--bottom-center).lx-ptt--hiding {
  animation: lx-ptt-hide-center 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes lx-ptt-show-center {
  0% {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

@keyframes lx-ptt-hide-center {
  0% {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
  }
}

/* Hide elements smoothly */
.lx-ptt__hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}