/* ==========================================================================
   LOZBI — AI SHOPPING ASSISTANT
   --------------------------------------------------------------------------
   A separate stylesheet on purpose: nothing in lozbi.css is touched, so the
   rest of the site cannot be affected by anything in here. Every class is
   prefixed ai* / aichat* so there are no collisions either.

   It borrows the site's own design tokens (--red, --ink, --line, --display…)
   which are already defined on :root by lozbi.css.
   ========================================================================== */

/* ------------------------------------------------------------- the launcher */
/* Sits inside the existing #supportdock, above the WhatsApp button, so the two
   stack with the dock's own gap and neither covers the other. */
.aichat-launch {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 44px; padding: 0 1rem 0 .55rem;
  border: 1px solid var(--line, #e5e5e8);
  border-radius: var(--r-pill, 999px);
  background: var(--surface, #fff);
  color: var(--text, #0d0d0f);
  font-family: var(--body, system-ui, sans-serif);
  font-size: .8125rem; font-weight: 600; cursor: pointer;
  box-shadow: var(--sh-2, 0 6px 20px rgba(8,8,10,.12));
  transition: transform .18s cubic-bezier(.22,.61,.36,1), border-color .12s;
}
.aichat-launch:hover { transform: translateY(-2px); border-color: var(--ink, #0a0a0c); }
.aichat-launch:focus-visible { outline: 2px solid var(--red, #d81e27); outline-offset: 2px; }
.aichat-launch__icon {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red, #d81e27); color: #fff;
}
.aichat-launch__icon svg { width: 16px; height: 16px; }
@media (max-width: 560px) {
  .aichat-launch__label { display: none; }
  .aichat-launch { padding: 0; width: 44px; justify-content: center; }
}

/* ----------------------------------------------------------------- the panel */
.aichat {
  position: fixed; z-index: 55;
  right: clamp(.75rem, 2vw, 1.5rem);
  bottom: calc(clamp(.75rem, 2vw, 1.5rem) + 106px);
  width: min(384px, calc(100vw - 1.5rem));
  max-height: min(620px, calc(100vh - 190px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e5e8);
  border-radius: var(--r-lg, 18px);
  box-shadow: 0 28px 70px rgba(8, 8, 10, .28);
  font-family: var(--body, system-ui, sans-serif);
  opacity: 0; transform: translateY(12px) scale(.985);
  transition: opacity .2s ease, transform .2s cubic-bezier(.22,.61,.36,1);
}
.aichat.is-on { opacity: 1; transform: none; }

.aichat__head {
  display: flex; align-items: center; gap: .65rem; flex: none;
  padding: .8rem .9rem; border-bottom: 1px solid var(--line-soft, #eeeef0);
}
.aichat__badge {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink, #0a0a0c); color: #fff;
}
.aichat__badge svg { width: 17px; height: 17px; }
.aichat__title { display: flex; flex-direction: column; line-height: 1.2; flex: 1 1 auto; min-width: 0; }
.aichat__title b { font-family: var(--display, inherit); font-size: .9375rem; }
.aichat__title small { font-size: .6875rem; color: var(--muted, #5c5c63); }
.aichat__close {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted, #5c5c63);
  border-radius: 50%; cursor: pointer;
}
.aichat__close:hover { background: var(--surface-sunk, #f2f2f4); color: var(--text, #0d0d0f); }
.aichat__close svg { width: 15px; height: 15px; }

/* running cart summary */
.aichat__cart {
  flex: none; display: flex; align-items: center; gap: .6rem;
  padding: .55rem .9rem; border-bottom: 1px solid var(--line-soft, #eeeef0);
  background: var(--surface-sunk, #f2f2f4);
  font-size: .75rem; color: var(--muted, #5c5c63);
}
.aichat__cart b { margin-left: auto; color: var(--text, #0d0d0f); font-size: .8125rem; }
.aichat__tocart {
  font-size: .6875rem; font-weight: 700; color: var(--red, #d81e27); text-decoration: none;
}
.aichat__tocart:hover { text-decoration: underline; }

.aichat__list {
  flex: 1 1 auto; overflow-y: auto; padding: .9rem;
  display: flex; flex-direction: column; gap: .55rem;
  -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------------ bubbles */
.aimsg {
  max-width: 86%; padding: .6rem .8rem; border-radius: 14px;
  font-size: .875rem; line-height: 1.55; word-wrap: break-word;
}
.aimsg--assistant {
  align-self: flex-start; background: var(--surface-sunk, #f2f2f4);
  color: var(--text, #0d0d0f); border-bottom-left-radius: 5px;
}
.aimsg--user {
  align-self: flex-end; background: var(--ink, #0a0a0c); color: #fff;
  border-bottom-right-radius: 5px;
}
.aimsg--cards { max-width: 100%; background: transparent; padding: 0; }

/* typing indicator */
.aitype { display: flex; gap: 4px; align-items: center; padding: .7rem .8rem; }
.aitype__dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted-soft, #6e6e76);
  animation: aitype 1.1s infinite ease-in-out;
}
.aitype__dot:nth-child(2) { animation-delay: .16s; }
.aitype__dot:nth-child(3) { animation-delay: .32s; }
@keyframes aitype { 0%, 60%, 100% { opacity: .28; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .aitype__dot { animation: none; opacity: .6; }
  .aichat { transition: none; }
}

/* -------------------------------------------------------------- product card */
.aicards { display: grid; gap: .5rem; }
.aicard {
  display: grid; grid-template-columns: 72px 1fr; gap: .7rem;
  padding: .6rem; border: 1px solid var(--line, #e5e5e8);
  border-radius: var(--r-md, 12px); background: var(--surface, #fff);
}
.aicard__media {
  width: 72px; height: 72px; border-radius: 9px; overflow: hidden;
  background: var(--surface-sunk, #f2f2f4); display: grid; place-items: center;
}
.aicard__media img { width: 100%; height: 100%; object-fit: contain; padding: 6%; }
.aicard__body { min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.aicard__name {
  font-size: .8125rem; font-weight: 600; line-height: 1.3;
  color: var(--text, #0d0d0f); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.aicard__name:hover { color: var(--red, #d81e27); }
.aicard__price { margin: 0; display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.aicard__price b { font-size: .875rem; font-family: var(--display, inherit); }
.aicard__price del { font-size: .75rem; color: var(--muted, #5c5c63); }
.aicard__out { font-size: .6875rem; font-weight: 700; color: var(--red, #d81e27); }
.aicard__swatches { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .1rem; }
.aicard__swatches button {
  position: relative; width: 18px; height: 18px; padding: 0; flex: none;
  border-radius: 50%; border: 1px solid var(--line, #e5e5e8);
  background: #ddd; cursor: pointer;
}
.aicard__swatches button::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.aicard__swatches button[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--surface, #fff), 0 0 0 3.5px var(--ink, #0a0a0c);
}
.aicard__colour { margin: 0; font-size: .6875rem; color: var(--muted, #5c5c63); }
.aicard__add {
  margin-top: .25rem; min-height: 32px; padding: 0 .75rem;
  border: 0; border-radius: var(--r-pill, 999px);
  background: var(--red, #d81e27); color: #fff;
  font-family: inherit; font-size: .75rem; font-weight: 700; cursor: pointer;
  align-self: flex-start;
}
.aicard__add:hover { background: var(--red-dark, #ae1720); }

/* ------------------------------------------------------------- confirmation */
.aiconfirm {
  border: 1px solid var(--line, #e5e5e8); border-radius: var(--r-md, 12px);
  background: var(--surface, #fff); padding: .85rem;
}
.aiconfirm h4 { margin: 0 0 .55rem; font-size: .875rem; font-family: var(--display, inherit); }
.aiconfirm ul { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .3rem; }
.aiconfirm li { display: flex; justify-content: space-between; gap: .6rem; font-size: .8125rem; }
.aiconfirm li em { font-style: normal; color: var(--muted, #5c5c63); }
.aiconfirm dl {
  margin: 0 0 .7rem; padding-top: .55rem; border-top: 1px solid var(--line-soft, #eeeef0);
  display: grid; grid-template-columns: 1fr auto; gap: .25rem .8rem; font-size: .8125rem;
}
.aiconfirm dt { color: var(--muted, #5c5c63); }
.aiconfirm dd { margin: 0; text-align: right; }
.aiconfirm .is-total { font-weight: 800; color: var(--text, #0d0d0f); }
.aiconfirm__to { margin: 0 0 .7rem; font-size: .75rem; color: var(--muted, #5c5c63); line-height: 1.5; }
.aiconfirm__go {
  display: block; text-align: center; text-decoration: none;
  min-height: 42px; line-height: 42px; padding: 0 1rem;
  border-radius: var(--r-pill, 999px); background: var(--red, #d81e27); color: #fff;
  font-size: .8125rem; font-weight: 700;
}
.aiconfirm__go:hover { background: var(--red-dark, #ae1720); }
.aiconfirm__note { margin: .55rem 0 0; font-size: .6875rem; color: var(--muted-soft, #6e6e76); line-height: 1.5; }

/* -------------------------------------------------------------- error state */
.aifail {
  border: 1px solid #f0d7a8; background: #fff4e0; border-radius: var(--r-md, 12px);
  padding: .8rem;
}
.aifail p { margin: 0 0 .6rem; font-size: .8125rem; color: #7a4a00; line-height: 1.5; }
.aifail__wa {
  display: inline-block; text-decoration: none;
  min-height: 34px; line-height: 34px; padding: 0 .85rem;
  border-radius: var(--r-pill, 999px); background: var(--ink, #0a0a0c); color: #fff;
  font-size: .75rem; font-weight: 700;
}

/* -------------------------------------------------------------- the composer */
.aichat__form {
  flex: none; display: flex; gap: .45rem; padding: .7rem .9rem .4rem;
  border-top: 1px solid var(--line-soft, #eeeef0);
}
.aichat__form input {
  flex: 1 1 auto; min-width: 0; min-height: 42px; padding: 0 .85rem;
  border: 1px solid var(--line, #e5e5e8); border-radius: var(--r-pill, 999px);
  background: var(--surface, #fff); color: var(--text, #0d0d0f);
  font: inherit; font-size: .875rem;
}
.aichat__form input:focus { outline: none; border-color: var(--ink, #0a0a0c); }
.aichat__form button {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--red, #d81e27); color: #fff; cursor: pointer;
}
.aichat__form button:hover { background: var(--red-dark, #ae1720); }
.aichat__form button svg { width: 17px; height: 17px; }
.aichat__form.is-busy button { opacity: .5; pointer-events: none; }
.aichat__legal {
  flex: none; margin: 0; padding: 0 .9rem .75rem;
  font-size: .625rem; line-height: 1.45; color: var(--muted-soft, #6e6e76);
}

/* ------------------------------------------------------------------- phones */
@media (max-width: 560px) {
  .aichat {
    right: 0; left: 0; bottom: 0;
    width: 100vw; max-height: 88vh; height: 88vh;
    border-radius: var(--r-lg, 18px) var(--r-lg, 18px) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .aimsg { max-width: 90%; }
}

/* The site's own dark bands never contain the widget, but if the panel is ever
   opened over one, keep it readable. */
@media (prefers-contrast: more) {
  .aichat { border-color: var(--ink, #0a0a0c); }
}
