/* DigiTensil shop chat. Pairs with shop-chat.js. Uses the site's tokens/fonts like the cart (shop-cart.css). Nothing here shows unless chat is switched on. */

.dgch-root {
  --ink: var(--text-main, #1d1d1f); --muted: var(--text-muted, #86868b); --line: var(--border-divider, rgba(0, 0, 0, 0.08));
  --soft: var(--bg-studio, #f5f5f7); --head: var(--font-heading, 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  position: fixed; inset: 0; z-index: 100001; visibility: hidden; pointer-events: none; color: var(--ink);
}
.dgch-root.is-open { visibility: visible; pointer-events: auto; }
.dgch-backdrop { position: absolute; inset: 0; background: rgba(8, 11, 20, 0.35); opacity: 0; transition: opacity .25s ease; }
.dgch-root.is-open .dgch-backdrop { opacity: 1; }

.dgch-panel {
  position: absolute; right: 20px; bottom: 20px; width: 396px; height: min(620px, calc(100vh - 40px));
  display: flex; flex-direction: column; background: #fff; border-radius: 18px; overflow: hidden; outline: none;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
  transform: translateY(16px) scale(.98); opacity: 0; transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1), opacity .2s ease;
}
.dgch-root.is-open .dgch-panel { transform: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .dgch-panel, .dgch-backdrop { transition: none; } }

.dgch-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.95rem 1.1rem; border-bottom: 1px solid var(--line); flex-shrink: 0; background: #fff; }
.dgch-av { width: 38px; height: 38px; border-radius: 12px; color: #fff; font-family: var(--head); font-weight: 700; font-size: 1rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dgch-headtext { min-width: 0; flex: 1; }
.dgch-headtext h2 { margin: 0; font-family: var(--head); font-size: 0.9375rem; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgch-headtext p { margin: 2px 0 0; font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgch-x { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.08); background: var(--soft); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .2s; }
.dgch-x:hover { background: #000; color: #fff; }

.dgch-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.dgch-loading { margin: auto; color: var(--muted); font-size: 0.875rem; }

/* start form */
.dgch-start { flex: 1; overflow-y: auto; padding: 1.1rem 1.2rem 1.2rem; display: flex; flex-direction: column; gap: 0.85rem; }
.dgch-intro { margin: 0; font-size: 0.84375rem; line-height: 1.5; color: #4a4a50; }
.dgch-prod { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.7rem; background: var(--soft); border: 1px solid rgba(0, 0, 0, 0.06); border-radius: 12px; font-size: 0.8125rem; font-weight: 600; font-family: var(--head); }
.dgch-prod img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.dgch-prod span { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dgch-field { display: flex; flex-direction: column; gap: 0.35rem; }
.dgch-field > span { font-size: 0.8125rem; font-weight: 600; }
.dgch-field em { font-style: normal; font-weight: 400; color: var(--muted); }
.dgch-field input[type="text"], .dgch-field input[type="tel"], .dgch-field input[type="email"], .dgch-field textarea {
  width: 100%; box-sizing: border-box; border: 1px solid rgba(0, 0, 0, 0.1); background: var(--soft); border-radius: 10px; padding: 0.7rem 0.85rem;
  font: inherit; font-size: 0.875rem; color: var(--ink); outline: none; transition: border-color .2s, background .2s; resize: none;
}
.dgch-field input:focus, .dgch-field textarea:focus { background: #fff; border-color: rgba(0, 0, 0, 0.35); }
.dgch-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; background: var(--soft); border: 1px solid rgba(0, 0, 0, 0.08); border-radius: 999px; padding: 3px; }
.dgch-seg button { border: 0; background: transparent; border-radius: 999px; padding: 0.5rem 0; font: inherit; font-family: var(--head); font-size: 0.8125rem; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .2s; }
.dgch-seg button[aria-checked="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.dgch-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.dgch-err { margin: 0; min-height: 1em; font-size: 0.8125rem; color: #dc2626; }
.dgch-primary { height: 46px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--head); font-size: 0.875rem; font-weight: 600; cursor: pointer; padding: 0 1.5rem; transition: all .2s; }
.dgch-primary:hover { background: #000; transform: translateY(-1px); }
.dgch-primary:disabled { opacity: .6; cursor: default; transform: none; }
.dgch-fine { margin: 0; font-size: 0.71875rem; line-height: 1.45; color: var(--muted); text-align: center; }

/* conversation */
.dgch-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.15rem; background: #f7f7f9; }
.dgch-day { text-align: center; margin: 0.6rem 0; }
.dgch-day span { display: inline-block; font-size: 0.6875rem; font-weight: 600; color: var(--muted); background: #ececf0; padding: 0.2rem 0.6rem; border-radius: 999px; }
.dgch-row { display: flex; flex-direction: column; max-width: 82%; margin: 0.15rem 0; }
.dgch-row.is-me { align-self: flex-end; align-items: flex-end; }
.dgch-row.is-them { align-self: flex-start; align-items: flex-start; }
.dgch-who { font-size: 0.6875rem; font-weight: 600; color: var(--muted); margin: 0 0.4rem 0.15rem; }
.dgch-bubble { padding: 0.6rem 0.85rem; font-size: 0.875rem; line-height: 1.45; border-radius: 16px; overflow-wrap: anywhere; }
.dgch-row.is-me .dgch-bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
.dgch-row.is-them .dgch-bubble { background: #fff; color: var(--ink); border: 1px solid rgba(0, 0, 0, 0.07); border-bottom-left-radius: 5px; }
.dgch-time { font-size: 0.65625rem; color: #a1a1a6; margin: 0.2rem 0.4rem 0; }
.dgch-wait { display: flex; align-items: center; gap: 0.5rem; margin: 0.9rem 0.2rem 0.2rem; font-size: 0.75rem; line-height: 1.4; color: var(--muted); }
.dgch-dots { display: inline-flex; gap: 3px; flex-shrink: 0; }
.dgch-dots i { width: 5px; height: 5px; border-radius: 50%; background: #b5b5bb; animation: dgch-blink 1.2s infinite ease-in-out; }
.dgch-dots i:nth-child(2) { animation-delay: .2s; } .dgch-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dgch-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dgch-dots i { animation: none; opacity: .6; } }
.dgch-closed { text-align: center; margin: 0.9rem 0 0.2rem; font-size: 0.78125rem; color: var(--muted); }

.dgch-composer { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.7rem 0.9rem calc(0.7rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.dgch-composer.is-closed { justify-content: center; }
.dgch-composer textarea { flex: 1; border: 1px solid rgba(0, 0, 0, 0.1); background: var(--soft); border-radius: 18px; padding: 0.6rem 0.9rem; font: inherit; font-size: 0.875rem; line-height: 1.4; max-height: 120px; resize: none; outline: none; color: var(--ink); }
.dgch-composer textarea:focus { background: #fff; border-color: rgba(0, 0, 0, 0.35); }
.dgch-send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .2s; }
.dgch-send:hover { background: #000; transform: translateY(-1px); }

/* the button on the product page */
.dgch-trigger {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; height: 46px; padding: 0 1.25rem; border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.14); background: #fff; color: var(--text-main, #1d1d1f); font-family: var(--font-heading, 'Manrope', sans-serif);
  font-size: 0.875rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all .2s ease;
}
.dgch-trigger:hover { background: var(--bg-studio, #f5f5f7); transform: translateY(-1px); }

@media (max-width: 520px) {
  .dgch-panel { right: 0; bottom: 0; left: 0; width: 100%; height: 100%; max-height: 100dvh; border-radius: 0; }
  .dgch-row { max-width: 88%; }
}
