/* CodeMola AI Support Chat — luxury widget, FNX-token aware */
.cmchat {
  --cc-black: var(--fnx-black, #101010);
  --cc-white: var(--fnx-white, #fff);
  --cc-gray: var(--fnx-warmgray, #757068);
  --cc-serif: var(--fnx-font-display, Georgia, serif);
  position: fixed; bottom: 22px; z-index: 9980;
  font-size: 14px; line-height: 1.5;
}
.cmchat--right { right: 22px; }
.cmchat--left { left: 22px; }
.cmchat__bubble {
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--cc-black); color: var(--cmchat-accent, #c6a15b);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.cmchat__bubble:hover { transform: scale(1.07); }
.cmchat__bubble svg { width: 24px; height: 24px; stroke-width: 1.5; }
.cmchat__panel {
  position: absolute; bottom: 70px; width: min(370px, calc(100vw - 34px));
  background: var(--cc-white); color: var(--cc-black);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  display: flex; flex-direction: column; height: 520px; max-height: calc(100vh - 120px);
  opacity: 0; transform: translateY(12px) scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.cmchat--right .cmchat__panel { right: 0; }
.cmchat--left .cmchat__panel { left: 0; }
.cmchat__panel[hidden] { display: none !important; } /* author display:flex
  otherwise overrides the UA [hidden] rule — the "closed" panel was an
  invisible full-size layer swallowing taps under it */
.cmchat__panel.is-open { opacity: 1; transform: none; }
.cmchat__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--cc-black); color: var(--cc-white);
}
.cmchat__head strong { display: block; font-family: var(--cc-serif); font-size: 16px; letter-spacing: 0.02em; }
.cmchat__head span { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cmchat-accent, #c6a15b); }
.cmchat__close { background: none; border: 0; color: var(--cc-white); font-size: 22px; cursor: pointer; line-height: 1; }
.cmchat__thread { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; background: #faf9f7; }
.cmchat__msg { max-width: 84%; padding: 9px 13px; white-space: pre-wrap; word-wrap: break-word; }
.cmchat__msg--bot { background: #fff; border: 1px solid #eee7da; align-self: flex-start; }
.cmchat__msg--user { background: var(--cc-black); color: var(--cc-white); align-self: flex-end; }
.cmchat__msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cmchat__typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 12px 14px; background: #fff; border: 1px solid #eee7da; }
.cmchat__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--cc-gray); animation: cmchatB 1.1s infinite; }
.cmchat__typing i:nth-child(2) { animation-delay: 0.15s; }
.cmchat__typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes cmchatB { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.cmchat__quick { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.cmchat__quick button {
  border: 1px solid var(--cmchat-accent, #c6a15b); background: transparent; cursor: pointer;
  font-size: 11.5px; letter-spacing: 0.06em; padding: 6px 12px; color: var(--cc-black);
  transition: background 0.2s ease;
}
.cmchat__quick button:hover { background: var(--cmchat-accent, #c6a15b); }
.cmchat__card {
  align-self: flex-start; display: flex; gap: 10px; align-items: center;
  background: #fff; border: 1px solid #eee7da; padding: 8px; width: 84%;
  text-decoration: none; color: inherit; transition: border-color 0.2s ease;
}
.cmchat__card:hover { border-color: var(--cmchat-accent, #c6a15b); }
.cmchat__card img { width: 46px; height: 58px; object-fit: cover; flex-shrink: 0; }
.cmchat__card-name { display: block; font-size: 13px; font-weight: 500; line-height: 1.3; }
.cmchat__card-price { font-size: 12px; color: var(--cc-gray); }
.cmchat__card-price del { margin-right: 4px; }
.cmchat__card-price ins { text-decoration: none; }
.cmchat__card-stock { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cmchat-accent, #c6a15b); }
.cmchat__card-stock.is-out { color: #b32d2e; }
.cmchat__orderform { align-self: flex-start; background: #fff; border: 1px solid #eee7da; padding: 12px; width: 84%; display: grid; gap: 8px; }
.cmchat__orderform strong { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.cmchat__orderform input { border: 1px solid #ddd4c2; padding: 7px 10px; font-size: 13px; width: 100%; box-sizing: border-box; }
.cmchat__orderform button { border: 0; cursor: pointer; background: var(--cc-black); color: #fff; padding: 8px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.cmchat__composer { display: flex; border-top: 1px solid #eee7da; }
.cmchat__composer input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 13px 14px; font-size: 14px; background: transparent; }
.cmchat__composer button { border: 0; cursor: pointer; background: transparent; color: var(--cc-black); padding: 0 16px; }
.cmchat__composer button svg { width: 19px; height: 19px; stroke-width: 1.6; }
.cmchat__composer button:hover { color: var(--cmchat-accent, #c6a15b); }
@media (max-width: 480px) {
  .cmchat__panel { position: fixed; inset: auto 10px 84px 10px; width: auto; height: min(560px, calc(100dvh - 110px)); }
}
@media (prefers-reduced-motion: reduce) {
  .cmchat__panel, .cmchat__bubble { transition: none !important; }
  .cmchat__typing i { animation: none; }
}

/* Human handoff */
.cmchat__sys { align-self: center; text-align: center; font-size: 11px; color: #8a8378; letter-spacing: 0.06em; max-width: 90%; }
.cmchat__msg--agent { border-color: var(--cmchat-accent, #c6a15b); }
.cmchat__humanlink {
  display: block; width: 100%; border: 0; background: #f6f2ea; cursor: pointer;
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: #6b6357; padding: 8px; transition: color 0.2s ease;
}
.cmchat__humanlink:hover { color: var(--cmchat-accent, #c6a15b); }
.cmchat__humanform strong { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
