/* ============================================================
   FU FUT COFFEE — AI Chat Widget (Premium + In-Chat Ordering)
   Glass-morphism, gold accents, coffee personality.
   Menu carousel with images, cart bar, order flow.
   ============================================================ */

/* ---------- Backdrop overlay ---------- */
#aiChatBackdrop {
  position: fixed;
  inset: 0;
  z-index: 9996;
  background: rgba(14, 26, 24, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
}
#aiChatBackdrop.visible {
  opacity: 1;
  visibility: visible;
}

/* ---------- Chat Bubble (FAB) — brand logo face ---------- */
#aiChatBubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 16px rgba(15, 123, 120, 0.30),
    0 1px 3px rgba(15, 123, 120, 0.15);
  transition:
    transform 0.28s cubic-bezier(.34, 1.56, .64, 1),
    box-shadow 0.3s ease,
    opacity 0.3s,
    visibility 0.3s;
  will-change: transform;
  outline: none;
}
#aiChatBubble img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}
#aiChatBubble:hover {
  transform: scale(1.1);
  box-shadow:
    0 8px 32px rgba(15, 123, 120, 0.40),
    0 2px 8px rgba(15, 123, 120, 0.20);
}
#aiChatBubble:active {
  transform: scale(0.95);
}
#aiChatBubble:focus-visible {
  outline: 2px solid #D6B36A;
  outline-offset: 4px;
}
/* FAB fades out while the panel is open — the panel's own close
   button, backdrop click, and Escape key all dismiss the chat. */
#aiChatBubble.active {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Cart badge on bubble */
.ai-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: linear-gradient(145deg, #D6B36A, #c49a3f);
  color: #1a130a;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(214, 179, 106, 0.5);
  pointer-events: none;
  z-index: 2;
}

/* Unread badge on bubble */
.ai-unread-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #D32F2F;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(211, 47, 47, 0.40);
  pointer-events: none;
  z-index: 3;
  animation: aiBadgePop 0.3s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes aiBadgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* FAB teaser tooltip */
.ai-chat-tooltip {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9996;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  border-radius: 18px 18px 4px 18px;
  background: #221F1A;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  animation: aiTooltipIn 0.4s cubic-bezier(.16, 1, .3, 1) both;
  max-width: calc(100vw - 72px);
  white-space: nowrap;
  overflow: hidden;
}
@keyframes aiTooltipIn {
  from { opacity: 0; transform: translateY(8px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ai-chat-tooltip-wave {
  font-size: 15px;
  line-height: 1;
  animation: aiWave 1.8s ease-in-out infinite;
  transform-origin: 70% 80%;
}
@keyframes aiWave {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-12deg); }
  60%      { transform: rotate(10deg); }
}
.ai-chat-tooltip:hover {
  background: #0F7B78;
}
.ai-chat-tooltip:focus-visible {
  outline: 2px solid #D6B36A;
  outline-offset: 3px;
}

/* Subtle gold pulse ring */
@keyframes aiPulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  70%  { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}
#aiChatBubble::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid #D6B36A;
  z-index: -1;
  opacity: 0;
  animation: aiPulse 3s ease-out 1.5s infinite;
}
#aiChatBubble.active::after,
#aiChatBubble:hover::after {
  animation: none;
  opacity: 0;
}

/* ---------- Chat Panel ---------- */
#aiChatPanel {
  position: fixed;
  bottom: 104px;
  right: 28px;
  z-index: 9997;
  width: 400px;
  max-width: calc(100vw - 24px);
  height: 580px;
  max-height: calc(100vh - 130px);
  background: #FFFFFF;
  border: 1px solid rgba(15, 123, 120, 0.10);
  border-radius: 24px;
  box-shadow:
    0 24px 80px rgba(14, 26, 24, 0.16),
    0 8px 24px rgba(14, 26, 24, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.92);
  transform-origin: bottom right;
  transition:
    opacity 0.35s cubic-bezier(.2,.7,.2,1),
    visibility 0.35s,
    transform 0.35s cubic-bezier(.2,.7,.2,1);
}
#aiChatPanel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ---------- Header ---------- */
.ai-chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background:
    linear-gradient(135deg,
      #0F7B78 0%,
      #0C5F5B 55%,
      #0a4f4c 100%);
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
.ai-chat-header::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px 24px 0 0;
  background: radial-gradient(ellipse at 85% 20%, rgba(255,255,255,0.08) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}
.ai-chat-header-icon {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-chat-header-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}
.ai-chat-header-text {
  position: relative;
  flex: 1;
  min-width: 0;
}
.ai-chat-header-text h4 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.ai-chat-header-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.ai-chat-header-sub span {
  font-size: 11px;
  opacity: 0.72;
  letter-spacing: 0.02em;
}
.ai-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5eead4;
  box-shadow: 0 0 8px rgba(94, 234, 212, 0.6);
  animation: aiDotPulse 2.5s ease-in-out infinite;
}
@keyframes aiDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Language toggle button ---------- */
.ai-lang-toggle {
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.ai-lang-toggle:hover {
  background: rgba(255, 255, 255, 0.38);
}
.ai-lang-toggle:active {
  transform: scale(0.93);
}

/* Header close button (desktop + mobile) */
.ai-chat-header-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.ai-chat-header-close:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: rotate(90deg);
}
.ai-chat-header-close:active {
  transform: rotate(90deg) scale(0.9);
}
.ai-chat-header-close:focus-visible,
.ai-lang-toggle:focus-visible {
  outline: 2px solid #D6B36A;
  outline-offset: 2px;
}
.ai-chat-header-close svg {
  width: 15px;
  height: 15px;
}

/* ---------- Bottom close bar (mobile only) ---------- */
.ai-chat-bottom-bar {
  display: none;
  justify-content: center;
  padding: 6px 18px 4px;
  background: #FAFAF8;
  flex-shrink: 0;
}
.ai-chat-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 28px;
  border-radius: 20px;
  border: 1.5px solid #E9E7E1;
  background: #FFFFFF;
  color: #8C897F;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.ai-chat-close-btn svg {
  width: 16px;
  height: 16px;
}
.ai-chat-close-btn:hover,
.ai-chat-close-btn:active {
  color: #D32F2F;
  border-color: #D32F2F;
  background: #FFF5F5;
}

/* ---------- Messages area ---------- */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  background: #FAFAF8;
}
.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(15, 123, 120, 0.16);
  border-radius: 10px;
}
.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 123, 120, 0.28);
}

/* ---------- Message bubbles ---------- */
.ai-msg {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: aiMsgSlide 0.35s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes aiMsgSlide {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-msg--bot { align-self: flex-start; }
.ai-msg--user { align-self: flex-end; }

/* Bot bubble */
.ai-msg--bot .ai-msg-bubble {
  position: relative;
  padding: 12px 16px 12px 20px;
  border-radius: 4px 18px 18px 18px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.6;
  word-wrap: break-word;
  color: #221F1A;
  background: #FFFFFF;
  border: 1px solid #E9E7E1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.ai-msg--bot .ai-msg-bubble::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #D6B36A, #0F7B78);
}

/* User bubble */
.ai-msg--user .ai-msg-bubble {
  padding: 11px 18px;
  border-radius: 18px 4px 18px 18px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  color: #fff;
  background: linear-gradient(135deg, #0F7B78 0%, #0C5F5B 100%);
  box-shadow: 0 2px 8px rgba(15, 123, 120, 0.25);
}

/* Bot avatar + message body wrapper */
.ai-msg--bot {
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
}
.ai-msg-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0F7B78 0%, #0C5F5B 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(15, 123, 120, 0.25);
}
.ai-msg-avatar svg {
  width: 14px;
  height: 14px;
}
.ai-msg-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  max-width: calc(100% - 36px);
}

/* Rich text inside bot bubbles */
.ai-msg-bubble p {
  margin: 0 0 6px;
}
.ai-msg-bubble p:last-child {
  margin-bottom: 0;
}
.ai-msg-bubble strong {
  color: #0C5F5B;
  font-weight: 700;
}

/* Scroll shadow at the top of the message list */
.ai-chat-messages.scrolled {
  box-shadow: inset 0 10px 12px -10px rgba(14, 26, 24, 0.20);
}

/* Timestamps */
.ai-msg-time {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  color: #6F6B61;
  padding: 0 6px;
  opacity: 0.85;
  white-space: nowrap;
}
.ai-msg--user .ai-msg-time { text-align: right; }

/* ---------- Typing indicator ---------- */
.ai-msg--bot .ai-typing {
  display: inline-flex;
  gap: 5px;
  padding: 10px 20px 10px 20px;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid #E9E7E1;
  border-radius: 4px 18px 18px 18px;
  position: relative;
}
.ai-msg--bot .ai-typing::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #D6B36A, #0F7B78);
}
.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0F7B78;
  opacity: 0.35;
  animation: aiBounce 1.4s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.16s; }
.ai-typing span:nth-child(3) { animation-delay: 0.32s; }
@keyframes aiBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-5px); opacity: 0.9; }
}

/* ---------- Quick suggestions ---------- */
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 18px 14px;
  flex-shrink: 0;
  background: #FAFAF8;
}
.ai-suggestion-btn {
  padding: 8px 16px;
  border: 1px solid #E9E7E1;
  border-radius: 20px;
  background: #FFFFFF;
  color: #524F47;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(.2,.7,.2,1), box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.ai-suggestion-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0F7B78 0%, #0C5F5B 100%);
  opacity: 0;
  transition: opacity 0.25s;
}
.ai-suggestion-btn:hover {
  color: #fff;
  border-color: #0F7B78;
  box-shadow: 0 2px 12px rgba(15, 123, 120, 0.25);
  transform: translateY(-1px);
}
.ai-suggestion-btn:hover::before {
  opacity: 1;
}
.ai-suggestion-btn:active {
  transform: translateY(0);
}
.ai-suggestion-btn span {
  position: relative;
  z-index: 1;
}

/* ============================================================
   MENU CAROUSEL — horizontal scroll with images
   ============================================================ */
.ai-menu-carousel {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #E9E7E1;
}
.ai-menu-carousel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 0;
  gap: 10px;
}
.ai-menu-carousel-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  color: #221F1A;
  white-space: nowrap;
}
.ai-menu-cats {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 1;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}
.ai-menu-cats::-webkit-scrollbar { display: none; }
.ai-menu-cat-btn {
  padding: 4px 12px;
  border: 1px solid #E9E7E1;
  border-radius: 12px;
  background: transparent;
  color: #524F47;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}
.ai-menu-cat-btn.active {
  background: linear-gradient(135deg, #0F7B78, #0C5F5B);
  color: #fff;
  border-color: transparent;
}
.ai-menu-cat-btn:hover:not(.active) {
  border-color: #0F7B78;
  color: #0F7B78;
}

/* Horizontal scroll */
.ai-menu-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 18px 10px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,123,120,0.25) transparent;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  min-height: 0;
  max-height: 215px;
}
.ai-menu-scroll::-webkit-scrollbar { height: 5px; }
.ai-menu-scroll::-webkit-scrollbar-track { background: transparent; }
.ai-menu-scroll::-webkit-scrollbar-thumb {
  background: rgba(15,123,120,0.25);
  border-radius: 10px;
}
.ai-menu-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(15,123,120,0.4);
}

/* Menu card */
.ai-menu-card {
  flex-shrink: 0;
  width: 120px;
  scroll-snap-align: start;
  border-radius: 14px;
  border: 1px solid #E9E7E1;
  background: #fff;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  touch-action: manipulation;
}
.ai-menu-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.07);
}
.ai-menu-card-img {
  width: 100%;
  height: 72px;
  background-size: cover;
  background-position: center;
  background-color: #F0EDE6;
  position: relative;
}
.ai-menu-card-img.no-img {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8C897F;
}
.ai-menu-card-img.no-img svg {
  width: 32px;
  height: 32px;
  opacity: 0.4;
}
.ai-menu-card-info {
  padding: 8px 10px 10px;
}
.ai-menu-card-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #221F1A;
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ai-menu-card-desc {
  font-size: 10.5px;
  color: #8C897F;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ai-menu-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ai-menu-card-price {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #0F7B78;
}
.ai-menu-card-add {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #D6B36A, #c9a058);
  color: #1a130a;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1), background 0.2s;
}
/* Expand tap area to >=44px without changing visual size */
.ai-menu-card-add::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}
.ai-menu-card-add:hover {
  transform: scale(1.15);
}
.ai-menu-card-add.added {
  background: linear-gradient(145deg, #0F7B78, #0C5F5B);
  color: #fff;
}

/* Skeleton loading */
.ai-menu-card-skeleton {
  flex-shrink: 0;
  width: 140px;
  border-radius: 16px;
  border: 1px solid #E9E7E1;
  overflow: hidden;
  background: #fff;
}
.ai-menu-card-skeleton-img {
  width: 100%;
  height: 100px;
  background: linear-gradient(90deg, #F0EDE6 25%, #E9E7E1 50%, #F0EDE6 75%);
  background-size: 200% 100%;
  animation: aiShimmer 1.5s infinite;
}
.ai-menu-card-skeleton-text {
  height: 12px;
  margin: 10px 10px 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, #F0EDE6 25%, #E9E7E1 50%, #F0EDE6 75%);
  background-size: 200% 100%;
  animation: aiShimmer 1.5s infinite;
}
.ai-menu-card-skeleton-text.short {
  width: 60%;
  margin-bottom: 10px;
}
@keyframes aiShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.ai-menu-error,
.ai-menu-empty {
  padding: 20px;
  text-align: center;
  color: #8C897F;
  font-size: 13px;
}
.ai-menu-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.ai-menu-retry {
  padding: 8px 18px;
  border-radius: 14px;
  border: 1.5px solid #0F7B78;
  background: #fff;
  color: #0F7B78;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.ai-menu-retry:hover {
  background: #0F7B78;
  color: #fff;
  box-shadow: 0 4px 14px rgba(15, 123, 120, 0.3);
}
.ai-menu-retry:active {
  transform: scale(0.95);
}

/* ============================================================
   CART BAR — stacked layout for desktop, compact for mobile
   ============================================================ */
.ai-cart-bar {
  display: flex;
  flex-direction: column;
  padding: 10px 18px 8px;
  background: #fff;
  border-top: 1px solid #E9E7E1;
  flex-shrink: 0;
  animation: aiSlideUp 0.3s ease both;
  gap: 0;
}
.ai-cart-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ai-cart-bar-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
@keyframes aiSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-cart-bar-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ai-cart-bar-count {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  color: #8C897F;
  font-weight: 500;
}
.ai-cart-bar-total {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #0F7B78;
}
.ai-cart-bar-actions {
  display: flex;
  gap: 8px;
}
.ai-cart-bar-btn {
  padding: 8px 16px;
  border-radius: 12px;
  border: none;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-cart-bar-btn:active {
  transform: scale(0.96);
}
.ai-cart-view {
  background: transparent;
  border: 1.5px solid #E9E7E1 !important;
  color: #524F47;
}
.ai-cart-view:hover {
  border-color: #0F7B78 !important;
  color: #0F7B78;
}
.ai-cart-clear {
  background: transparent;
  border: 1.5px solid #E9E7E1 !important;
  color: #D32F2F;
}
.ai-cart-clear:hover {
  border-color: #D32F2F !important;
  background: #FFF5F5;
}
.ai-cart-order {
  background: linear-gradient(145deg, #0F7B78, #0C5F5B);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15,123,120,0.25);
}
.ai-cart-order:hover {
  box-shadow: 0 4px 14px rgba(15,123,120,0.35);
  transform: translateY(-1px);
}

/* Cart summary bubble */
.ai-cart-summary {
  padding: 14px 16px 14px 20px !important;
  max-width: 95% !important;
}
.ai-cart-summary-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #221F1A;
  margin-bottom: 8px;
}
.ai-cart-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12.5px;
  border-bottom: 1px solid #F0EDE6;
  gap: 8px;
}
.ai-cart-item-left {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.ai-cart-item-name {
  color: #524F47;
}
.ai-cart-item-name small {
  color: #8C897F;
  font-weight: 400;
}
.ai-cart-item-price {
  color: #0F7B78;
  font-weight: 600;
  flex-shrink: 0;
}
.ai-cart-item-remove {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #E9E7E1;
  background: #fff;
  color: #D32F2F;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ai-cart-item-remove::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}
.ai-cart-item-remove:hover {
  background: #D32F2F;
  color: #fff;
  border-color: #D32F2F;
}
.ai-cart-item-remove:active {
  transform: scale(0.85);
}
.ai-cart-summary-item:last-of-type {
  border-bottom: none;
}
.ai-cart-summary-total {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid #E9E7E1;
  font-size: 14px;
  font-weight: 700;
  color: #221F1A;
}

/* ---------- Input area ---------- */
.ai-chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 16px;
  background: #FFFFFF;
  flex-shrink: 0;
}
.ai-chat-input input {
  flex: 1;
  padding: 12px 18px;
  border: 1.5px solid #E9E7E1;
  border-radius: 24px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  background: #FAFAF8;
  color: #221F1A;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.ai-chat-input input:focus {
  border-color: #0F7B78;
  box-shadow: 0 0 0 3px rgba(15, 123, 120, 0.10);
}
.ai-chat-input input::placeholder {
  color: #8C897F;
  font-size: 13px;
}
.ai-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(145deg, #D6B36A 0%, #c9a058 100%);
  color: #1a130a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(214, 179, 106, 0.30);
  transition:
    transform 0.22s cubic-bezier(.34, 1.56, .64, 1),
    box-shadow 0.25s,
    opacity 0.2s;
}
.ai-chat-send:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(214, 179, 106, 0.40);
}
.ai-chat-send:active {
  transform: scale(0.95);
}
.ai-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}
.ai-chat-send svg {
  width: 18px;
  height: 18px;
}
.ai-send-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(26, 19, 10, 0.25);
  border-top-color: #1a130a;
  animation: aiSpin 0.6s linear infinite;
}
.ai-chat-send.loading svg { display: none; }
.ai-chat-send.loading .ai-send-spinner { display: block; }
@keyframes aiSpin {
  to { transform: rotate(360deg); }
}

/* ---------- Cart item chips in bar ---------- */
.ai-cart-bar-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 0;
  min-height: 0;
}
.ai-cart-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 10px;
  border-radius: 14px;
  background: #F0EDE6;
  border: 1px solid #E9E7E1;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  color: #524F47;
  animation: aiSlideUp 0.25s ease both;
}
.ai-cart-chip-name {
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-cart-chip-remove {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #E9E7E1;
  color: #D32F2F;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ai-cart-chip-remove::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
}
.ai-cart-chip-remove:hover {
  background: #D32F2F;
  color: #fff;
}
.ai-cart-chip-remove:active {
  transform: scale(0.85);
}

/* ---------- Menu carousel close button ---------- */
.ai-menu-carousel-close {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #E9E7E1;
  background: #fff;
  color: #8C897F;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ai-menu-carousel-close::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}
.ai-menu-carousel-close:hover {
  background: #D32F2F;
  color: #fff;
  border-color: #D32F2F;
}

/* ---------- Undo toast ---------- */
.ai-undo-toast {
  position: absolute;
  bottom: 80px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 14px;
  background: #221F1A;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12.5px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  z-index: 10;
  animation: aiUndoIn 0.3s ease both;
}
@keyframes aiUndoIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-undo-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-undo-btn {
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent;
  color: #D6B36A;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ai-undo-btn:hover,
.ai-undo-btn:active {
  background: rgba(214, 179, 106, 0.2);
}

/* ---------- Error message ---------- */
.ai-msg-error {
  color: #D32F2F;
  font-size: 12px;
  line-height: 1.5;
}

/* ============================================================
   MOBILE — full-screen panel, hide FAB when open, header close
   ============================================================ */
@media (max-width: 480px) {
  #aiChatPanel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    transform-origin: bottom center;
  }

  /* Show the close bar on mobile for easy thumb tap.
     No safe-area padding here — the input row below owns the inset. */
  .ai-chat-bottom-bar {
    display: flex;
  }

  /* FAB slightly smaller on mobile (hide-when-open is global now) */
  #aiChatBubble {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  /* Close button bigger on mobile for easy thumb tap */
  .ai-chat-close-btn {
    padding: 10px 36px;
    font-size: 13px;
    border-radius: 24px;
  }
  .ai-chat-close-btn svg {
    width: 18px;
    height: 18px;
  }

  /* FAB teaser tooltip — DISABLED on mobile. The floating bubble is enough
     of a hint on a phone screen, and the tooltip popping up 1.4s after the
     page loads fights for the user's attention with the menu and hero.
     The tooltip remains enabled on tablet/desktop (max-width: 481px and up). */
  .ai-chat-tooltip {
    display: none !important;
  }

  /* Input bar respects home-indicator inset.
     Font must be >=16px on mobile or iOS Safari zooms the viewport on focus. */
  .ai-chat-input {
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .ai-chat-input input {
    font-size: 16px;
  }
  .ai-chat-input input::placeholder {
    font-size: 15px;
  }

  /* Menu cards slightly smaller on mobile */
  .ai-menu-card {
    width: 125px;
  }
  .ai-menu-card-img {
    height: 85px;
  }
  .ai-menu-scroll {
    max-height: none;
  }

  /* Undo toast bottom is set dynamically by JS (above the cart bar) */
  .ai-undo-btn {
    padding: 8px 18px;
    font-size: 13px;
  }
  .ai-cart-chip-remove {
    width: 24px;
    height: 24px;
    font-size: 17px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #aiChatBubble, #aiChatBubble img,
  #aiChatBubble::after,
  #aiChatPanel, #aiChatBackdrop,
  .ai-msg, .ai-typing span,
  .ai-suggestion-btn, .ai-chat-send,
  .ai-cart-bar, .ai-menu-card,
  .ai-chat-tooltip, .ai-unread-badge,
  .ai-send-spinner, .ai-chat-header-close {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  #aiChatBubble::after {
    animation: none !important;
    opacity: 0 !important;
  }
}
