/* ZenWrist on-site AI chat — deep-ink panel with cinnabar-red accents,
   in the store's own palette (ink #1e211c, rust/cinnabar #9d3f2f). */

.zw-chat-btn {
  position: fixed;
  inset-inline-end: 20px;
  bottom: 20px;
  z-index: 90;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid #7e3222;
  background: #9d3f2f;
  color: #fdf6ec;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(20, 16, 10, 0.35);
  transition: background 0.2s ease, transform 0.2s ease;
}
.zw-chat-btn:hover { background: #87331f; }
.zw-chat-btn:focus-visible { outline: 2px solid #f1ede2; outline-offset: 2px; }
.zw-chat-btn[aria-expanded="true"] { background: #1e211c; border-color: #41483f; }

.zw-chat-panel {
  position: fixed;
  inset-inline-end: 20px;
  bottom: 88px;
  z-index: 90;
  width: min(368px, calc(100vw - 32px));
  height: min(540px, calc(100dvh - 116px));
  display: flex;
  flex-direction: column;
  background: #1e211c;
  color: #f1ede2;
  border: 1px solid #41483f;
  border-top: 3px solid #9d3f2f;
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(20, 16, 10, 0.45);
  font-family: var(--sans, 'Noto Sans', system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.55;
  overflow: hidden;
}
.zw-chat-panel[hidden] { display: none; }

.zw-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(241, 237, 226, 0.14);
  flex: 0 0 auto;
}
.zw-chat-title {
  font-family: var(--serif, 'Source Serif 4', Georgia, serif);
  font-size: 17px;
  letter-spacing: 0.01em;
}
.zw-chat-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c6502f;
  margin-inline-end: 9px;
  vertical-align: 2px;
}
.zw-chat-close {
  border: 0;
  background: transparent;
  color: #f1ede2;
  font-size: 26px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.zw-chat-close:hover { background: rgba(241, 237, 226, 0.1); }
.zw-chat-close:focus-visible { outline: 2px solid #f1ede2; outline-offset: 1px; }

.zw-chat-msgs {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.zw-chat-row { display: flex; }
.zw-chat-row-user { justify-content: flex-end; }
.zw-chat-row-bot { justify-content: flex-start; }
.zw-chat-bubble {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 12px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.zw-chat-row-bot .zw-chat-bubble {
  background: #2a2e27;
  color: #f1ede2;
  border-start-start-radius: 3px;
}
.zw-chat-row-user .zw-chat-bubble {
  background: #9d3f2f;
  color: #fdf6ec;
  border-start-end-radius: 3px;
}
.zw-chat-typing .zw-chat-bubble { color: #b6b9ad; font-style: italic; }

.zw-chat-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(241, 237, 226, 0.14);
  background: #23261f;
}
.zw-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #41483f;
  border-radius: 4px;
  background: #171a16;
  color: #f1ede2;
  font: inherit;
}
.zw-chat-input::placeholder { color: #8f9384; }
.zw-chat-input:focus { outline: 2px solid #c6502f; outline-offset: 0; border-color: transparent; }
.zw-chat-input:disabled { opacity: 0.6; }
.zw-chat-send {
  flex: 0 0 auto;
  height: 42px;
  padding: 0 16px;
  border: 1px solid #7e3222;
  border-radius: 4px;
  background: #9d3f2f;
  color: #fdf6ec;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.zw-chat-send:hover:not(:disabled) { background: #87331f; }
.zw-chat-send:disabled { opacity: 0.55; cursor: not-allowed; }
.zw-chat-send:focus-visible { outline: 2px solid #f1ede2; outline-offset: 1px; }

@media (max-width: 560px) {
  .zw-chat-btn { inset-inline-end: 14px; bottom: 14px; }
  .zw-chat-panel {
    inset-inline-end: 10px;
    bottom: 80px;
    width: calc(100vw - 20px);
    height: min(560px, calc(100dvh - 100px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .zw-chat-btn { transition: none; }
}
