/* ==========================================================================
   Awesome Khana chat assistant  (built + injected by assets/js/chatbot.js)
   Uses the brand tokens from style.css (:root), so load it after style.css.
   ========================================================================== */

.ak-chat {
  --ak-green: #128c4a;
  /* How far the ripple rings spread. Capped so they stay inside the screen: the launcher sits 20px from the
     edges, so its ring (radius 30px x spread) must stay under ~50px. */
  --ak-spread: 1.55;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1040; /* above page content, below Bootstrap modals (1055) */
  font-family: var(--font-alt, "Inter", sans-serif);
  color: var(--color-text-secondary, #5d3f3b);
}

.ak-chat *,
.ak-chat *::before,
.ak-chat *::after {
  box-sizing: border-box;
}

/* ---------- Launcher ---------- */
.ak-chat-launcher {
  position: relative;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary-2, #ff5a00), var(--color-primary-1, #8d0000));
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(141, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ak-chat-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 28px rgba(141, 0, 0, 0.42);
}

.ak-chat-launcher:focus-visible,
.ak-chat-close:focus-visible,
.ak-chat-reset:focus-visible,
.ak-chat-send:focus-visible,
.ak-chat-chip:focus-visible,
.ak-chat-input:focus-visible {
  outline: 3px solid rgba(255, 90, 0, 0.55);
  outline-offset: 2px;
}

/* Ripple: two rings spreading out from each button, staggered, for as long as the chat is closed */
.ak-chat-launcher::before,
.ak-chat-launcher::after,
.ak-wa-fab::before,
.ak-wa-fab::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--ak-ring, var(--color-primary-2, #ff5a00));
  opacity: 0;
  pointer-events: none;
  animation: ak-chat-spread 2.6s ease-out infinite;
}

.ak-chat-launcher::after,
.ak-wa-fab::after {
  animation-delay: 1.3s;
}

.ak-wa-fab {
  --ak-ring: #25d366;
}

.ak-wa-fab::before,
.ak-wa-fab::after {
  animation-delay: 0.65s; /* offset from the launcher so the two don't pulse in lockstep */
}

.ak-wa-fab::after {
  animation-delay: 1.95s;
}

/* calm while the chat is open */
.ak-chat.is-open .ak-chat-launcher::before,
.ak-chat.is-open .ak-chat-launcher::after,
.ak-chat.is-open .ak-wa-fab::before,
.ak-chat.is-open .ak-wa-fab::after {
  animation: none;
  opacity: 0;
}

.ak-chat-launcher .ak-icon-close {
  display: none;
}

.ak-chat.is-open .ak-chat-launcher .ak-icon-chat {
  display: none;
}

.ak-chat.is-open .ak-chat-launcher .ak-icon-close {
  display: block;
}

@keyframes ak-chat-spread {
  0% {
    transform: scale(1);
    opacity: 0.75;
  }

  100% {
    transform: scale(var(--ak-spread, 1.55));
    opacity: 0;
  }
}

/* ---------- WhatsApp shortcut (stacked above the launcher) ---------- */
.ak-wa-fab {
  position: absolute;
  right: 4px; /* centres the 52px button over the 60px launcher */
  bottom: 74px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(18, 140, 74, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ak-wa-fab:hover {
  color: #fff;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 26px rgba(18, 140, 74, 0.5);
}

.ak-wa-fab:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.6);
  outline-offset: 2px;
}

/* hover label, to the left of the button */
.ak-wa-label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--color-text-secondary, #5d3f3b);
  font: 600 12.5px/1.2 var(--font-alt, "Inter", sans-serif);
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.ak-wa-fab:hover .ak-wa-label,
.ak-wa-fab:focus-visible .ak-wa-label {
  opacity: 1;
}

/* ---------- Panel ---------- */
.ak-chat-panel {
  position: absolute;
  right: 0;
  bottom: 142px; /* launcher (60) + WhatsApp button (52) + gaps */
  width: 380px;
  height: min(620px, calc(100vh - 190px));
  height: min(620px, calc(100dvh - 190px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--color-border-light, #ffe2dd);
  box-shadow: 0 20px 60px rgba(60, 10, 0, 0.28);
  transform-origin: bottom right;
  animation: ak-chat-pop 0.22s ease both;
}

.ak-chat-panel[hidden] {
  display: none;
}

@keyframes ak-chat-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes ak-chat-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Header */
.ak-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: linear-gradient(135deg, var(--color-primary-1, #8d0000), var(--color-dark-red, #ba0000));
  color: #fff;
}

.ak-chat-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.ak-chat-title {
  flex: 1;
  min-width: 0;
}

.ak-chat-title strong {
  display: block;
  font-family: var(--font-heading, "Plus Jakarta Sans", sans-serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.ak-chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.ak-chat-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ddc84;
}

.ak-chat-status.is-closed::before {
  background: #ffb020;
}

.ak-chat-close,
.ak-chat-reset {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ak-chat-close:hover,
.ak-chat-reset:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Messages */
.ak-chat-log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 8px;
  background: #fff9f7;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

.ak-msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 88%;
  animation: ak-chat-rise 0.25s ease both;
}

.ak-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.ak-msg-bot {
  align-self: flex-start;
  align-items: flex-start;
}

.ak-bubble {
  margin: 0;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 16px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.ak-msg-bot .ak-bubble {
  background: #fff;
  border: 1px solid var(--color-border-light, #ffe2dd);
  border-bottom-left-radius: 4px;
  color: var(--color-text-secondary, #5d3f3b);
}

.ak-msg-user .ak-bubble {
  background: var(--color-primary-1, #8d0000);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ak-bubble a {
  color: var(--color-primary-1, #8d0000);
  font-weight: 600;
}

/* Flex children default to min-width:auto, so one long word stops them shrinking and widens the whole log.
   Let them shrink and wrap instead. */
.ak-msg > *,
.ak-items,
.ak-item,
.ak-card,
.ak-chips {
  min-width: 0;
  max-width: 100%;
}

.ak-item-name,
.ak-item-desc,
.ak-card-eyebrow,
.ak-card-title,
.ak-card-text {
  overflow-wrap: anywhere;
}

/* Dish cards */
.ak-items {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ak-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--color-border-light, #ffe2dd);
}

.ak-item-main {
  flex: 1;
  min-width: 0;
}

.ak-item-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading, "Plus Jakarta Sans", sans-serif);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-primary-1, #8d0000);
}

.ak-item-desc {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: #8a7470;
}

.ak-item-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 6px;
}

.ak-price {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-border-light, #ffe2dd);
  color: var(--color-primary-1, #8d0000);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.ak-tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff1d6;
  color: #9a5b00;
  font-family: var(--font-heading, "Plus Jakarta Sans", sans-serif);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ak-diet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  margin-top: 1px;
  border: 1.5px solid #2e8b3d;
  border-radius: 2px;
}

.ak-diet::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2e8b3d;
}

.ak-diet-nonveg {
  border-color: #b3261e;
}

.ak-diet-nonveg::after {
  background: #b3261e;
}

.ak-diet-egg {
  border-color: #d19a00;
}

.ak-diet-egg::after {
  background: #d19a00;
}

.ak-diet-none {
  visibility: hidden;
}

.ak-item-order {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #e7f7ee;
  color: var(--ak-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ak-item-order:hover {
  background: var(--ak-green);
  color: #fff;
}

/* Info cards (offers) */
.ak-card {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--color-border-light, #ffe2dd);
  border-left: 4px solid var(--color-primary-2, #ff5a00);
  color: inherit;
  text-decoration: none;
}

a.ak-card:hover {
  background: #fffaf8;
}

.ak-card-eyebrow {
  margin: 0;
  font-family: var(--font-heading, "Plus Jakarta Sans", sans-serif);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--color-primary-2, #ff5a00);
}

.ak-card-title {
  margin: 2px 0 0;
  font-family: var(--font-heading, "Plus Jakarta Sans", sans-serif);
  font-size: 15px;
  font-weight: 800;
  color: var(--color-primary-1, #8d0000);
}

.ak-card-text {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
}

/* Quick-reply chips */
.ak-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
  animation: ak-chat-rise 0.25s ease both;
}

.ak-chat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-primary-2, #ff5a00);
  background: #fff;
  color: var(--color-primary-1, #8d0000);
  font: 600 12.5px/1.3 var(--font-alt, "Inter", sans-serif);
  max-width: 100%;
  text-align: left;
  overflow-wrap: anywhere;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ak-chat-chip:hover {
  background: var(--color-border-light, #ffe2dd);
  color: var(--color-primary-1, #8d0000);
}

.ak-chat-chip-wa {
  border-color: var(--ak-green);
  color: var(--ak-green);
}

.ak-chat-chip-wa:hover {
  background: var(--ak-green);
  color: #fff;
}

/* Typing indicator */
.ak-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px 16px 16px 4px;
  background: #fff;
  border: 1px solid var(--color-border-light, #ffe2dd);
}

.ak-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c9a9a2;
  animation: ak-chat-bounce 1s infinite ease-in-out;
}

.ak-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.ak-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ak-chat-bounce {

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

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

/* Composer */
.ak-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid var(--color-border-light, #ffe2dd);
}

.ak-chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--color-border-light, #ffe2dd);
  border-radius: 999px;
  background: #fff9f7;
  color: var(--color-text-secondary, #5d3f3b);
  font: 400 14px/1.3 var(--font-alt, "Inter", sans-serif);
}

.ak-chat-input::placeholder {
  color: #a8918c;
}

.ak-chat-send {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-primary-1, #8d0000);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ak-chat-send:hover {
  background: var(--color-primary-2, #ff5a00);
}

.ak-chat-foot {
  padding: 0 12px 10px;
  background: #fff;
  text-align: center;
  font-size: 12px;
}

.ak-chat-foot a {
  color: var(--ak-green);
  font-weight: 600;
  text-decoration: none;
}

.ak-chat-foot a:hover {
  text-decoration: underline;
}

/* ---------- Small screens ---------- */
@media (max-width: 767px) {

  /* menu.php parks its veg / non-veg filter stack in the bottom-right corner */
  body:has(.menu-diet-float) .ak-chat {
    bottom: 176px;
  }
}

@media (max-width: 575px) {
  .ak-chat {
    --ak-spread: 1.5;
    right: 18px;
    bottom: 18px;
  }

  body:has(.menu-diet-float) .ak-chat {
    bottom: 176px;
  }

  .ak-chat-launcher {
    width: 56px;
    height: 56px;
  }

  .ak-wa-fab {
    right: 2px;
    bottom: 68px;
  }

  .ak-wa-label {
    display: none;
  }

  /* the panel becomes a full-width sheet; its own close button replaces the launcher */
  .ak-chat.is-open {
    right: 0;
    bottom: 0;
    left: 0;
  }

  .ak-chat.is-open .ak-chat-launcher,
  .ak-chat.is-open .ak-wa-fab {
    display: none;
  }

  .ak-chat-panel {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    border: 0;
  }

  .ak-chat-input {
    font-size: 16px; /* stops iOS zooming into the field */
  }
}

@media (prefers-reduced-motion: reduce) {

  .ak-chat *,
  .ak-chat *::before,
  .ak-chat *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
