/* Waitress Pad AI chat box */
.wp-ai-launcher {
  position: fixed !important;
  right: 22px !important;
  bottom: 22px !important;
  z-index: 900;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 176px;
  border: 0;
  border-radius: 999px !important;
  padding: 13px 18px !important;
  background: linear-gradient(135deg, #0d3bff, #0f9b72);
  color: #fff;
  box-shadow: 0 18px 42px rgba(16, 35, 73, 0.28);
  cursor: pointer;
  font: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.wp-ai-launcher:hover,
.wp-ai-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(16, 35, 73, 0.36);
  filter: saturate(1.06);
  outline: none;
}

.wp-ai-chat-open .wp-ai-launcher {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.96);
}

.wp-ai-launcher-main {
  font-weight: 800;
  line-height: 1.05;
  font-size: 0.98rem;
}

.wp-ai-launcher-sub {
  font-size: 0.74rem;
  opacity: 0.9;
}

.waitress-chat-panel {
  position: fixed !important;
  right: 22px !important;
  bottom: 22px !important;
  z-index: 899;
  width: min(420px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 44px));
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(19, 43, 79, 0.14);
  box-shadow: 0 26px 70px rgba(16, 35, 73, 0.28);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 170ms ease, transform 170ms ease;
}

.waitress-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.waitress-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 16px;
  background:
    radial-gradient(circle at 16% 10%, rgba(255,255,255,0.28), transparent 28%),
    linear-gradient(135deg, #0d3bff, #0f9b72);
  color: #fff;
}

.waitress-chat-title {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.2;
  font-weight: 850;
}

.waitress-chat-subtitle {
  margin: 4px 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0.92;
}

.waitress-chat-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.waitress-chat-close:hover,
.waitress-chat-close:focus-visible {
  background: rgba(255,255,255,0.28);
  outline: none;
}

.waitress-chat-log {
  flex: 1 1 auto;
  min-height: 230px;
  max-height: 440px;
  overflow-y: auto;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(240, 246, 255, 0.58), rgba(255,255,255,0.94));
}

.waitress-chat-message {
  display: flex;
  margin: 0 0 12px;
}

.waitress-chat-message.user {
  justify-content: flex-end;
}

.waitress-chat-bubble {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 18px;
  line-height: 1.48;
  font-size: 0.92rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.waitress-chat-message.assistant .waitress-chat-bubble {
  color: #193251;
  background: #fff;
  border: 1px solid rgba(19, 43, 79, 0.11);
  border-top-left-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 35, 73, 0.08);
}

.waitress-chat-message.user .waitress-chat-bubble {
  color: #fff;
  background: #0d3bff;
  border-top-right-radius: 8px;
}

.waitress-chat-message.error .waitress-chat-bubble {
  color: #7a1d1d;
  background: #fff3f3;
  border-color: rgba(168, 33, 33, 0.2);
}

.waitress-chat-typing .waitress-chat-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.waitress-chat-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
  animation: waitressChatPulse 1s infinite ease-in-out;
}

.waitress-chat-dot:nth-child(2) { animation-delay: 0.15s; }
.waitress-chat-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes waitressChatPulse {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-4px); opacity: 0.85; }
}

.waitress-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: rgba(255,255,255,0.94);
  border-top: 1px solid rgba(19, 43, 79, 0.08);
}

.waitress-chat-quick button {
  border: 1px solid rgba(13, 59, 255, 0.22);
  background: #fff;
  color: #0f3476;
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.waitress-chat-quick button:hover,
.waitress-chat-quick button:focus-visible {
  background: rgba(13, 59, 255, 0.06);
  outline: none;
}

.waitress-chat-form {
  display: flex;
  gap: 9px;
  padding: 14px;
  border-top: 1px solid rgba(19, 43, 79, 0.1);
  background: #fff;
}

.waitress-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  height: 46px;
  max-height: 112px;
  border: 1px solid rgba(19, 43, 79, 0.18);
  border-radius: 18px;
  padding: 12px 13px;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.35;
  color: #1e2d44;
  background: #f9fbff;
}

.waitress-chat-input:focus {
  border-color: rgba(13, 59, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(13, 59, 255, 0.11);
  outline: none;
}

.waitress-chat-send {
  flex: 0 0 auto;
  align-self: flex-end;
  border: 0;
  border-radius: 16px;
  padding: 0 15px;
  height: 46px;
  background: #0d3bff;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.waitress-chat-send:hover,
.waitress-chat-send:focus-visible {
  background: #092bc0;
  outline: none;
}

.waitress-chat-send:disabled,
.waitress-chat-input:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.waitress-chat-note {
  padding: 0 16px 14px;
  margin: 0;
  background: #fff;
  color: #64708a;
  font-size: 0.74rem;
  line-height: 1.35;
}

.waitress-chat-note a {
  color: #0d3bff;
  font-weight: 700;
}

@media (max-width: 640px) {
  .wp-ai-launcher {
    right: 14px;
    bottom: 14px;
    min-width: 160px;
    padding: 12px 16px;
  }

  .waitress-chat-panel {
    left: 50% !important;
    right: auto !important;
    bottom: 10px !important;
    width: min(420px, calc(100vw - 24px));
    max-height: calc(100vh - 20px);
    border-radius: 22px;
    transform: translate(-50%, 12px) scale(0.98);
  }

  .waitress-chat-panel.open {
    transform: translate(-50%, 0) scale(1);
  }

  .waitress-chat-log {
    min-height: 220px;
    max-height: calc(100vh - 320px);
  }

  .waitress-chat-bubble {
    max-width: 92%;
  }
}

/* Final mobile polish: keep the chat panel centered and away from screen edges. */
.waitress-chat-panel {
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .waitress-chat-panel {
    left: 50% !important;
    right: auto !important;
    width: calc(100vw - 20px) !important;
    max-width: 420px;
    margin-left: 0 !important;
    margin-right: 0 !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }
}

@supports (width: 100dvw) {
  @media (max-width: 640px) {
    .waitress-chat-panel {
      width: calc(100dvw - 20px) !important;
      max-height: calc(100dvh - 20px);
    }
  }
}
