/* chat.css — Make Me A Proposal concierge chat
   All concierge styles live here. Uses the site design tokens from app.css
   (--ink, --ink-2, --sage, --paper, --paper-tint, --pine, --line, --muted,
   --font-display, --font-ui). No sparkle icons; the launcher is a paper chat
   glyph on ink. No em dashes in any copy. */

:root {
  --mmap-z: 2147000000;
  --mmap-on-dark: #F4F1E7;
  --mmap-on-dark-soft: rgba(244, 241, 231, .74);
  --mmap-ink-text: #1A241D;
}

/* ---- Launcher pill ---- */
.mmap-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: var(--mmap-z);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  /* Paper launcher: the ink circle vanished on the dark hero (Adam, mobile). */
  background: #FFFFFF;
  color: var(--ink, #0E1B14);
  border: 1px solid rgba(14, 27, 20, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(14, 27, 20, .34);
  transition: transform .18s ease, box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.mmap-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(14, 27, 20, .34); }
.mmap-launcher:active { transform: translateY(0); }
.mmap-launcher svg { width: 27px; height: 27px; display: block; }
.mmap-launcher .mmap-dot {
  position: absolute;
  top: 11px;
  right: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sage, #A9C79B);
  border: 2px solid var(--ink, #0E1B14);
}
.mmap-launcher:focus-visible { outline: 3px solid var(--sage, #A9C79B); outline-offset: 3px; }
.mmap-launcher[hidden] { display: none; }

/* ---- Panel ---- */
.mmap-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: var(--mmap-z);
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100dvh - 44px);
  background: var(--paper-tint, #F3F6F2);
  border: 1px solid var(--line, #E3E8E1);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(14, 27, 20, .32);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: scale(.92) translateY(16px);
  visibility: hidden;
  pointer-events: none;
  /* Slower, softer open (Adam: the snap-open felt abrupt). */
  transition: opacity .42s cubic-bezier(.22, .9, .3, 1), transform .42s cubic-bezier(.22, .9, .3, 1), visibility .42s;
  font-family: var(--font-ui, sans-serif);
}
.mmap-chat.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  visibility: visible;
  pointer-events: auto;
}

/* ---- Header ---- */
.mmap-head {
  background: var(--ink, #0E1B14);
  color: var(--mmap-on-dark);
  padding: 15px 16px 13px;
  flex: 0 0 auto;
}
.mmap-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mmap-min { margin-left: auto; }
.mmap-title {
  font-family: var(--font-display, sans-serif);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: -.01em;
  margin: 0;
  line-height: 1.15;
  color: var(--mmap-on-dark);
}
.mmap-sub {
  margin: 3px 0 0;
  font-size: .78rem;
  color: var(--mmap-on-dark-soft);
}
.mmap-sub a { color: var(--sage, #A9C79B); text-decoration: none; border-bottom: 1px solid rgba(169, 199, 155, .4); }
.mmap-sub a:hover { border-bottom-color: var(--sage, #A9C79B); }
.mmap-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-dark, rgba(169, 199, 155, .16));
  background: transparent;
  color: var(--mmap-on-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease;
}
.mmap-close:hover { background: rgba(169, 199, 155, .12); }
.mmap-close svg { width: 16px; height: 16px; }

/* ---- Messages ---- */
.mmap-log {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.mmap-msg { display: flex; }
.mmap-msg.user { justify-content: flex-end; }
.mmap-msg.assistant { justify-content: flex-start; }
.mmap-bubble {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: .95rem;
  line-height: 1.42;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.mmap-msg.assistant .mmap-bubble {
  background: var(--ink-2, #15291E);
  color: var(--mmap-on-dark);
  border-bottom-left-radius: 5px;
}
.mmap-msg.user .mmap-bubble {
  background: #fff;
  color: var(--mmap-ink-text);
  border: 1px solid var(--line, #E3E8E1);
  border-bottom-right-radius: 5px;
}
.mmap-note {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: .82rem;
  color: var(--muted, #5F6B60);
  padding: 4px 6px;
}
.mmap-note a { color: var(--pine, #25543B); }

/* ---- Typing indicator ---- */
.mmap-typing { display: flex; gap: 4px; padding: 12px 14px; }
.mmap-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sage, #A9C79B);
  opacity: .5;
  animation: mmap-bounce 1.1s infinite ease-in-out;
}
.mmap-typing span:nth-child(2) { animation-delay: .15s; }
.mmap-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes mmap-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Widgets (options, upload, auth, submit) ---- */
.mmap-widget {
  align-self: flex-start;
  max-width: 92%;
  width: 92%;
  background: #fff;
  border: 1px solid var(--line, #E3E8E1);
  border-radius: 16px;
  padding: 13px;
}
.mmap-widget-q { font-size: .9rem; font-weight: 600; color: var(--mmap-ink-text); margin: 0 0 10px; }

/* chips */
.mmap-chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* Confirm row under multi-select pills: clear separation from the choices. */
.mmap-chips + .mmap-chips { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line, #E3E8E1); }
.mmap-chip {
  font-family: var(--font-ui, sans-serif);
  font-size: .9rem;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line, #E3E8E1);
  background: var(--paper-tint, #F3F6F2);
  color: var(--mmap-ink-text);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.mmap-chip:hover { border-color: var(--pine, #25543B); background: #fff; }
.mmap-chip:disabled { opacity: .5; cursor: default; }
.mmap-chip.picked { background: var(--ink, #0E1B14); color: var(--mmap-on-dark); border-color: var(--ink, #0E1B14); }
.mmap-chip-done { background: var(--pine, #25543B); color: #fff; border-color: var(--pine, #25543B); font-weight: 600; }
.mmap-chip-done:hover { background: var(--ink, #0E1B14); border-color: var(--ink, #0E1B14); color: #fff; }
.mmap-chip-done:disabled { opacity: .45; }

/* choice cards (design-direction / taste picker) */
.mmap-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.mmap-choice {
  font-family: var(--font-ui, sans-serif);
  text-align: left;
  min-height: 74px;
  padding: 12px;
  border-radius: 14px;
  border: 1.5px solid var(--line, #E3E8E1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
  transition: box-shadow .14s ease, transform .12s ease;
}
.mmap-choice:hover { transform: translateY(-1px); }
.mmap-choice:disabled { cursor: default; opacity: .55; }
.mmap-choice.sel { box-shadow: 0 0 0 2.5px var(--sage, #A9C79B); }
.mmap-choice.sel:disabled { opacity: 1; }
.mmap-choice-sample { font-size: 1.05rem; line-height: 1.1; display: block; }
.mmap-choice-meta { display: block; }
.mmap-choice-label { display: block; font-weight: 600; font-size: .82rem; }
.mmap-choice-desc { display: block; font-size: .72rem; opacity: .72; margin-top: 1px; }
.mmap-choice-confirm { margin-top: 14px; }

/* card treatments (each option previews its own look) */
.mmap-choice.ink { background: var(--ink, #0E1B14); color: var(--mmap-on-dark); border-color: var(--ink, #0E1B14); }
.mmap-choice.ink .mmap-choice-sample { font-family: var(--font-display, sans-serif); font-weight: 600; letter-spacing: -.01em; }
.mmap-choice.ink .mmap-choice-desc { color: var(--mmap-on-dark-soft); opacity: 1; }

.mmap-choice.warm { background: #EFE7D8; color: #2c2318; border-color: #e3d9c5; }
.mmap-choice.warm .mmap-choice-sample { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1.1rem; }

.mmap-choice.editorial { background: #fff; color: var(--mmap-ink-text); border-color: var(--line, #E3E8E1); border-top: 3px solid var(--pine, #25543B); }
.mmap-choice.editorial .mmap-choice-sample { font-family: Georgia, "Times New Roman", serif; font-size: 1.1rem; }

.mmap-choice.minimal { background: #fff; color: var(--mmap-ink-text); }
.mmap-choice.minimal .mmap-choice-sample { font-family: var(--font-ui, sans-serif); font-weight: 500; text-transform: uppercase; letter-spacing: .07em; font-size: .82rem; }

.mmap-choice.bold { background: var(--sage, #A9C79B); color: var(--ink, #0E1B14); border-color: var(--sage, #A9C79B); }
.mmap-choice.bold .mmap-choice-sample { font-family: var(--font-display, sans-serif); font-weight: 600; font-size: 1.25rem; letter-spacing: -.01em; }

.mmap-choice.playful { background: var(--paper-tint, #F3F6F2); color: var(--pine, #25543B); }
.mmap-choice.playful .mmap-choice-sample { font-family: var(--font-ui, sans-serif); font-weight: 600; }
.mmap-choice.playful .mmap-choice-label { color: var(--mmap-ink-text); }

@media (max-width: 340px) {
  .mmap-choices { grid-template-columns: 1fr; }
}

/* upload tile */
.mmap-drop {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1.5px dashed var(--line, #E3E8E1);
  border-radius: 12px;
  padding: 13px;
  cursor: pointer;
  background: var(--paper-tint, #F3F6F2);
  transition: border-color .14s ease;
}
.mmap-drop:hover { border-color: var(--pine, #25543B); }
.mmap-drop svg { width: 22px; height: 22px; color: var(--pine, #25543B); flex: 0 0 auto; }
.mmap-drop-txt { font-size: .88rem; color: var(--mmap-ink-text); }
.mmap-drop-txt small { display: block; color: var(--muted, #5F6B60); font-size: .76rem; margin-top: 1px; }
.mmap-skip {
  margin-top: 9px;
  background: none;
  border: none;
  color: var(--muted, #5F6B60);
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
}
.mmap-skip:hover { color: var(--pine, #25543B); }
.mmap-werr { color: #9a2b2b; font-size: .8rem; margin-top: 8px; }

/* auth card */
.mmap-auth label { display: block; font-size: .8rem; font-weight: 600; color: var(--mmap-ink-text); margin: 0 0 4px; }
.mmap-auth input {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px; /* 16px+ so iOS does not auto-zoom */
  font-family: var(--font-ui, sans-serif);
  padding: 11px 12px;
  border: 1.5px solid var(--line, #E3E8E1);
  border-radius: 11px;
  background: #fff;
  color: var(--mmap-ink-text);
  margin-bottom: 10px;
}
.mmap-auth input:focus { outline: none; border-color: var(--pine, #25543B); }
.mmap-btn {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-ui, sans-serif);
  font-size: .95rem;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.mmap-btn-ink { background: var(--ink, #0E1B14); color: var(--mmap-on-dark); }
.mmap-btn-ink:hover { background: #16281d; }
.mmap-btn-google {
  background: #fff;
  color: var(--mmap-ink-text);
  border: 1.5px solid var(--line, #E3E8E1);
  margin-top: 9px;
}
.mmap-btn-google:hover { border-color: var(--pine, #25543B); }
.mmap-btn-google svg { width: 17px; height: 17px; }
.mmap-btn:disabled { opacity: .6; cursor: default; }
.mmap-divider { text-align: center; font-size: .76rem; color: var(--muted, #5F6B60); margin: 11px 0 2px; }

/* submit success */
.mmap-done {
  align-self: flex-start;
  max-width: 92%;
  background: var(--ink, #0E1B14);
  color: var(--mmap-on-dark);
  border-radius: 16px;
  padding: 15px 16px;
}
.mmap-done .mmap-done-t { font-family: var(--font-display, sans-serif); font-weight: 600; font-size: 1.05rem; margin: 0 0 4px; }
.mmap-done .mmap-done-s { font-size: .86rem; color: var(--mmap-on-dark-soft); margin: 0; }
.mmap-done a { color: var(--sage, #A9C79B); }

/* resolved-tool summary chip */
.mmap-resolved {
  align-self: flex-end;
  font-size: .82rem;
  color: var(--muted, #5F6B60);
  background: #fff;
  border: 1px solid var(--line, #E3E8E1);
  border-radius: 999px;
  padding: 5px 12px;
}

/* ---- Composer ---- */
.mmap-composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line, #E3E8E1);
  background: #fff;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.mmap-input {
  flex: 1 1 auto;
  resize: none;
  border: 1.5px solid var(--line, #E3E8E1);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 16px; /* 16px+ so iOS does not auto-zoom */
  font-family: var(--font-ui, sans-serif);
  line-height: 1.4;
  max-height: 120px;
  color: var(--mmap-ink-text);
  background: #fff;
}
.mmap-input:focus { outline: none; border-color: var(--pine, #25543B); }
.mmap-input:disabled { background: var(--paper-tint, #F3F6F2); color: var(--muted, #5F6B60); }
.mmap-send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--ink, #0E1B14);
  color: var(--mmap-on-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, opacity .15s ease;
}
.mmap-send:hover { background: #16281d; }
.mmap-send:disabled { opacity: .4; cursor: default; }
.mmap-send svg { width: 19px; height: 19px; }

/* busy spinner shared */
.mmap-spin {
  width: 16px; height: 16px;
  border: 2px solid rgba(244, 241, 231, .35);
  border-top-color: var(--mmap-on-dark);
  border-radius: 50%;
  animation: mmap-rot .7s linear infinite;
}
.mmap-spin.dark { border-color: rgba(14, 27, 20, .2); border-top-color: var(--ink, #0E1B14); }
@keyframes mmap-rot { to { transform: rotate(360deg); } }

/* ---- Mobile: full-screen sheet ---- */
@media (max-width: 720px) {
  .mmap-chat {
    right: 0;
    bottom: 0;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
    transform-origin: center;
    transform: scale(1) translateY(14px);
  }
  .mmap-chat.open { transform: translateY(0); }
  .mmap-head { padding-top: calc(15px + env(safe-area-inset-top, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .mmap-chat, .mmap-launcher, .mmap-typing span, .mmap-spin { transition: none; animation: none; }
}
