/* ===========================================================================
   Moods Interior — AI design concierge (assets/js/chat.js)

   Plain CSS, no build step. Styled in the homepage's own language: slate
   bands (intro/footer), uppercase letterspaced heads, mint gradient divider,
   pill buttons, 12px card radius. Every value comes from main.css tokens
   (--c-*, --font, --radius-*, --shadow-card, --ease); tints are mixed from
   them with color-mix() so nothing is hardcoded.
   =========================================================================== */

/* The concierge replaces the footer's floating contact menu. */
body.has-moods-chat .chat-fab { display: none; }

/* ---- Chat-local tokens (derived from the theme palette) ------------------- */
:root {
  --chat-on-dark:       var(--c-offwhite);
  --chat-on-dark-soft:  color-mix(in srgb, var(--c-offwhite) 72%, transparent);
  --chat-on-dark-line:  color-mix(in srgb, var(--c-offwhite) 35%, transparent);
  --chat-on-dark-wash:  color-mix(in srgb, var(--c-offwhite) 12%, transparent);
  --chat-surface:       var(--c-bg-light);
  --chat-panel:         #fff;
  --chat-backdrop:      color-mix(in srgb, var(--c-slate-2) 60%, transparent);
  --chat-shadow-float:  0 10px 30px color-mix(in srgb, var(--c-slate) 28%, transparent);
  --chat-shadow-hover:  0 14px 34px color-mix(in srgb, var(--c-slate) 34%, transparent);
  --chat-shadow-panel:  0 30px 80px color-mix(in srgb, var(--c-slate-2) 35%, transparent);
  --chat-ring-soft:     0 0 0 4px color-mix(in srgb, var(--c-slate) 15%, transparent);
  --chat-bubble-radius: var(--radius-card);
}

/* ---- Trigger -------------------------------------------------------------- */
.moods-chat__trigger {
  position: fixed; right: 24px; bottom: 24px; z-index: 900;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 20px 8px 8px;
  background: var(--c-slate); color: var(--chat-on-dark);
  border: 1px solid var(--c-slate);
  border-radius: var(--radius-pill);
  box-shadow: var(--chat-shadow-float);
  font-family: var(--font);
  text-align: left;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .25s var(--ease);
}
.moods-chat__trigger:hover { background: var(--c-slate-2); transform: translateY(-1px); box-shadow: var(--chat-shadow-hover); }
.moods-chat__tile {
  display: grid; place-items: center; width: 40px; height: 40px;
  background: var(--chat-panel); color: var(--c-slate); border-radius: 50%;
  font-size: 18px; line-height: 1;
}
.moods-chat__trigger-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.15; padding-top: 3px; }
.moods-chat__trigger-text strong { font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; }
.moods-chat__trigger-text small { font-size: 12px; font-weight: 300; color: var(--chat-on-dark-soft); }
.moods-chat__trigger.has-activity .moods-chat__tile { box-shadow: 0 0 0 4px var(--c-mint); }

body.nav-open .moods-chat__trigger,
body.moods-chat-open .moods-chat__trigger { display: none; }

/* Product page's sticky mobile bar sits at the bottom; lift the trigger above it. */
body.moods-sticky-active .moods-chat__trigger { bottom: 84px; }

/* ---- Backdrop + panel ----------------------------------------------------- */
.moods-chat__backdrop {
  position: fixed; inset: 0; z-index: 950;
  display: flex; justify-content: flex-end; align-items: center;
  padding: 18px;
  background: var(--chat-backdrop);
  opacity: 0; transition: opacity .25s var(--ease);
}
.moods-chat__backdrop.is-visible { opacity: 1; }
.moods-chat__backdrop[hidden] { display: none; }

.moods-chat__panel {
  display: flex; flex-direction: column;
  width: min(470px, 100%); height: min(760px, 100%);
  background: var(--chat-panel); color: var(--c-ink);
  border-radius: var(--radius-card); overflow: hidden;
  box-shadow: var(--chat-shadow-panel);
  font-family: var(--font);
  transform: translateY(12px); transition: transform .25s var(--ease);
}
.moods-chat__backdrop.is-visible .moods-chat__panel { transform: none; }

/* ---- Head: slate band like the homepage intro / footer -------------------- */
.moods-chat__head {
  position: relative;
  padding: 24px 24px 22px;
  background: var(--c-slate); color: var(--chat-on-dark);
}
/* Mint gradient divider (homepage .divider--mint) closing the band. */
.moods-chat__head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(89deg, transparent, var(--c-mint), transparent);
}
.moods-chat__kicker {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--chat-on-dark-soft);
}
.moods-chat__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-mint); }
.moods-chat__title {
  margin: 0; padding-right: 72px;
  font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: .04em; text-transform: uppercase;
  color: var(--chat-on-dark);
}
.moods-chat__subtitle { margin: 8px 0 0; font-size: 14px; font-weight: 300; color: var(--chat-on-dark-soft); }
/* Close = homepage .btn--outline, small. */
.moods-chat__close {
  position: absolute; top: 20px; right: 18px;
  padding: 7px 14px 5px; font-size: 13px; color: var(--chat-on-dark);
  border: 1px solid var(--chat-on-dark-line); border-radius: var(--radius-pill);
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.moods-chat__close:hover { background: var(--chat-panel); border-color: var(--chat-panel); color: var(--c-slate); }

/* ---- Quick replies (homepage pills) --------------------------------------- */
.moods-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 24px 6px; }
.moods-chat__chips[hidden] { display: none; }
.moods-chat__chip {
  padding: 9px 15px 7px;
  border: 1px solid var(--c-line); border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 400; color: var(--c-slate-text);
  transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.moods-chat__chip:hover { border-color: var(--c-slate); background: var(--c-slate); color: var(--chat-on-dark); }

/* ---- Messages ------------------------------------------------------------- */
.moods-chat__log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px 24px;
  background: var(--chat-surface);
}
.moods-chat__msg { display: flex; flex-direction: column; max-width: 88%; }
.moods-chat__msg--user { align-self: flex-end; align-items: flex-end; }
.moods-chat__who {
  margin-bottom: 6px;
  font-size: 10px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--c-slate);
}
.moods-chat__bubble {
  margin: 0; padding: 13px 16px 11px;
  font-size: 15px; line-height: 1.55; white-space: pre-line; color: var(--c-ink);
  background: var(--chat-panel); border: 1px solid var(--c-line);
  border-radius: var(--chat-bubble-radius) var(--chat-bubble-radius) var(--chat-bubble-radius) 4px;
  box-shadow: var(--shadow-card);
}
.moods-chat__msg--user .moods-chat__bubble {
  background: var(--c-slate); color: var(--chat-on-dark); border-color: var(--c-slate);
  border-radius: var(--chat-bubble-radius) var(--chat-bubble-radius) 4px var(--chat-bubble-radius);
  box-shadow: none;
}
.moods-chat__msg--thinking .moods-chat__bubble { color: var(--c-muted); font-style: italic; box-shadow: none; }

/* ---- Actions (homepage solid + outline pills) ----------------------------- */
.moods-chat__actions {
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
  padding: 14px 24px 0;
  background: var(--chat-panel);
  border-top: 1px solid var(--c-line);
}
.moods-chat__actions a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 2px 20px 0; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 400; letter-spacing: .3px;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.moods-chat__whatsapp { background: var(--c-slate); color: var(--chat-on-dark); border: 1px solid var(--c-slate); }
.moods-chat__whatsapp:hover { background: var(--c-slate-2); border-color: var(--c-slate-2); color: var(--chat-on-dark); }
.moods-chat__book { border: 1px solid var(--c-slate); color: var(--c-slate); }
.moods-chat__book:hover { background: var(--c-slate); color: var(--chat-on-dark); }
.moods-chat__panel.is-handoff .moods-chat__whatsapp { box-shadow: var(--chat-ring-soft); }

/* ---- Compose -------------------------------------------------------------- */
.moods-chat__form {
  display: flex; gap: 8px; align-items: center;
  margin: 12px 24px 0; padding: 6px 6px 6px 18px;
  border: 1px solid var(--c-line); border-radius: var(--radius-pill); background: var(--chat-panel);
  transition: border-color .2s var(--ease);
}
.moods-chat__form:focus-within { border-color: var(--c-slate); }
.moods-chat__input { flex: 1 1 auto; min-width: 0; border: 0; background: none; font-family: var(--font); font-size: 15px; color: var(--c-ink); }
.moods-chat__input:focus { outline: none; }
.moods-chat__input::placeholder { color: var(--c-muted); }
.moods-chat__send {
  padding: 10px 20px 8px; background: var(--c-slate); color: var(--chat-on-dark); border-radius: var(--radius-pill);
  font-size: 14px; letter-spacing: .3px; transition: background-color .2s var(--ease);
}
.moods-chat__send:hover { background: var(--c-slate-2); }
.moods-chat__send:disabled { opacity: .6; cursor: default; }

.moods-chat__note { margin: 10px 24px 16px; font-size: 12px; font-weight: 300; line-height: 1.5; color: var(--c-muted); }

/* ---- Mobile --------------------------------------------------------------- */
@media (max-width: 640px) {
  .moods-chat__trigger { right: 14px; bottom: 14px; padding-right: 16px; }
  .moods-chat__trigger-text small { display: none; }
  .moods-chat__backdrop { padding: 0; }
  .moods-chat__panel { width: 100%; height: 100%; border-radius: 0; }
  .moods-chat__head, .moods-chat__chips, .moods-chat__log, .moods-chat__actions { padding-left: 18px; padding-right: 18px; }
  .moods-chat__form, .moods-chat__note { margin-left: 18px; margin-right: 18px; }
  .moods-chat__title { font-size: 19px; }
  .moods-chat__actions { grid-template-columns: 1fr; }
}

/* ---- Motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .moods-chat__trigger, .moods-chat__backdrop, .moods-chat__panel,
  .moods-chat__chip, .moods-chat__close, .moods-chat__actions a, .moods-chat__send { transition: none; }
}
