/* In-site AI ordering card */

#aic-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  background: #c1272d;
  color: #fff;
  border-radius: 28px;
  padding: 12px 18px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
#aic-launcher:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
#aic-launcher[hidden] { display: none !important; }

/* If menu.js's floating #cart-bar is visible, lift the launcher above it */
body:has(#cart-bar.show) #aic-launcher { bottom: 90px; }

#aic-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 340px;
  height: 500px;
  max-height: calc(100vh - 40px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
#aic-panel.open { display: flex; }

#aic-header {
  background: #c1272d;
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
}
#aic-header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

#aic-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.aic-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.aic-bubble.user {
  align-self: flex-end;
  background: #c1272d;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.aic-bubble.assistant {
  align-self: flex-start;
  background: #fff;
  color: #222;
  border: 1px solid #e6e6e6;
  border-bottom-left-radius: 4px;
}
.aic-bubble.system {
  align-self: center;
  background: #eef;
  color: #446;
  font-size: 12px;
  font-style: italic;
  max-width: 95%;
}
.aic-bubble.error {
  align-self: center;
  background: #fee;
  color: #933;
  font-size: 12px;
  max-width: 95%;
}

.aic-typing {
  align-self: flex-start;
  color: #888;
  font-size: 13px;
  padding: 4px 8px;
}
.aic-typing::after {
  content: '...';
  animation: aic-dots 1.2s infinite;
}
@keyframes aic-dots {
  0%, 20%   { content: '.'; }
  40%       { content: '..'; }
  60%, 100% { content: '...'; }
}

#aic-input-row {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid #eee;
  background: #fff;
}
#aic-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  resize: none;
  max-height: 80px;
  min-height: 36px;
}
#aic-send {
  background: #c1272d;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}
#aic-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.aic-cart-cta {
  align-self: flex-start;
  margin-top: 2px;
  background: #fff;
  border: 1px solid #c1272d;
  color: #c1272d;
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.aic-cart-cta:hover { background: #c1272d; color: #fff; }

/* Mobile: full screen */
@media (max-width: 640px) {
  #aic-panel.open {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  #aic-launcher {
    right: 14px;
    bottom: 14px;
    padding: 10px 14px;
    font-size: 14px;
  }
}
