/* ── AI Studio Booth support chat (V2) ───────────────────────────────────────
   Same bot as the main app, restyled to the V2 system: void background, glass
   surfaces, cyan→violet→pink gradient, DM Sans. Every value below comes from
   the :root tokens in styles.css — no new palette is introduced here.        */

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

.aisb-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  font-family: var(--font-display);
}

/* ── Launcher ────────────────────────────────────────────────────────────── */
.aisb-launcher {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline-hi);
  background: var(--grad-3);
  padding: 2px;                 /* gradient reads as a ring around the face */
  cursor: pointer;
  box-shadow: var(--sh-card);
  transition: transform .22s cubic-bezier(.4, 0, .2, 1);
}
.aisb-launcher:hover { transform: translateY(-2px) scale(1.04); }

.aisb-launcher img {
  width: 100%;
  height: 100%;
  border-radius: var(--r-pill);
  object-fit: cover;
  display: block;
  animation: aisbFade .5s ease;
}

/* Online dot + unread count */
.aisb-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 15px;
  height: 15px;
  border-radius: var(--r-pill);
  background: #22d37e;
  border: 2.5px solid var(--void);
}
.aisb-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--c3);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--void);
}

/* Teaser bubble beside the launcher */
.aisb-teaser {
  position: absolute;
  right: 82px;
  bottom: 12px;
  width: 232px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--void-3);
  border: 1px solid var(--hairline);
  color: var(--ink-dim);
  font-size: 13.5px;
  line-height: 1.4;
  box-shadow: var(--sh-card);
  cursor: pointer;
  animation: aisbRise .35s ease;
}

/* ── Panel ───────────────────────────────────────────────────────────────── */
.aisb-panel {
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline-hi);
  background: var(--void-2);
  box-shadow: var(--sh-card);
  animation: aisbRise .3s cubic-bezier(.4, 0, .2, 1);
}

.aisb-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 15px;
  background: var(--grad-3);
  color: #fff;
  flex: 0 0 auto;
}
.aisb-face {
  width: 52px;
  height: 52px;
  border-radius: var(--r-pill);
  overflow: hidden;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .2);
}
.aisb-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: aisbFade .5s ease;
}
.aisb-who   { font-weight: 700; font-size: 15px; line-height: 1.2; }
.aisb-sub   { font-size: 12px; opacity: .92; line-height: 1.3; margin-top: 2px; }
.aisb-x {
  margin-left: auto;
  background: none;
  border: 0;
  color: #fff;
  font-size: 19px;
  cursor: pointer;
  opacity: .9;
  padding: 0 2px;
  font-family: inherit;
}
.aisb-x:hover { opacity: 1; }

/* ── Message list ────────────────────────────────────────────────────────── */
.aisb-body {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--void);
}

.aisb-msg {
  max-width: 84%;
  padding: 9px 13px;
  font-size: 14.2px;
  line-height: 1.45;
  border-radius: var(--r-md);
  word-wrap: break-word;
  animation: aisbRise .25s ease;
}
.aisb-msg img { max-width: 100%; border-radius: 12px; margin-top: 5px; display: block; }
.aisb-msg a   { color: var(--c1); text-decoration: underline; word-break: break-all; }

/* Them = glass card. Us = the brand gradient. */
.aisb-them {
  align-self: flex-start;
  background: var(--glass-2);
  border: 1px solid var(--hairline);
  color: var(--ink);
  border-bottom-left-radius: 6px;
}
.aisb-me {
  align-self: flex-end;
  background: var(--grad-3);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.aisb-me a { color: #fff; }

.aisb-time {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  opacity: .55;
}

/* Typing dots */
.aisb-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border-bottom-left-radius: 6px;
  background: var(--glass-2);
  border: 1px solid var(--hairline);
}
.aisb-typing i {
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--ink-mute);
  animation: aisbDot 1.2s infinite;
}
.aisb-typing i:nth-child(2) { animation-delay: .15s; }
.aisb-typing i:nth-child(3) { animation-delay: .3s; }

/* Connecting spinner */
.aisb-connecting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  margin: auto 0;
  color: var(--ink-mute);
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: .04em;
}
.aisb-spin {
  width: 26px;
  height: 26px;
  border-radius: var(--r-pill);
  border: 2px solid var(--hairline);
  border-top-color: var(--c1);
  animation: aisbSpin .8s linear infinite;
}

/* ── Pre-chat form ───────────────────────────────────────────────────────── */
.aisb-form { display: flex; flex-direction: column; gap: 13px; padding: 4px 2px; }
.aisb-form h4 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}
.aisb-label {
  display: block;
  margin-bottom: 5px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--c1);
}
.aisb-input,
.aisb-select {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--glass);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .18s;
}
.aisb-input::placeholder { color: var(--ink-mute); }
.aisb-input:focus,
.aisb-select:focus { border-color: var(--c1); }
/* Native dropdown lists paint on the OS layer — force readable colours there. */
.aisb-select option { background: var(--void-2); color: var(--ink); }

.aisb-tel { display: flex; gap: 8px; }
.aisb-dial {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--glass-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.aisb-tel .aisb-input { flex: 1; min-width: 0; }

.aisb-cta {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--grad-3);
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
}
.aisb-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 30px var(--c2-soft); }
.aisb-fine {
  text-align: center;
  font-size: 11px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
}

/* ── Composer ────────────────────────────────────────────────────────────── */
.aisb-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid var(--hairline);
  background: var(--void-2);
  flex: 0 0 auto;
}
.aisb-foot .aisb-input { border-radius: var(--r-pill); padding: 10px 15px; }
.aisb-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: var(--glass);
  color: var(--ink-dim);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .18s;
}
.aisb-icon:hover { color: var(--ink); border-color: var(--hairline-hi); }
.aisb-send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--grad-3);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aisb-send:disabled { opacity: .45; cursor: default; }

.aisb-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: #22d37e;
  color: #04120b;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  flex: 0 0 auto;
}

.aisb-preview {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-top: 1px solid var(--hairline);
  background: var(--void-2);
  font-size: 12px;
  color: var(--ink-dim);
}
.aisb-preview img { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; }

/* Photo lightbox */
.aisb-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(4, 5, 11, .86);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.aisb-lightbox img {
  width: min(78vw, 380px);
  height: min(78vw, 380px);
  object-fit: cover;
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline-hi);
  box-shadow: var(--sh-card);
}

@keyframes aisbFade { from { opacity: .25; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes aisbRise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes aisbSpin { to { transform: rotate(360deg); } }
@keyframes aisbDot  { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 480px) {
  .aisb-chat   { right: 14px; bottom: 14px; }
  .aisb-panel  { height: calc(100vh - 96px); }
  .aisb-teaser { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .aisb-chat *, .aisb-lightbox * { animation: none !important; transition: none !important; }
}
