/* Tony chat widget for hotelsupplyhouse.com (Hotel Supply House).
   Same widget geometry as twaprinting.com (lower left, draggable),
   re-banded to the HSH palette: deep blue #103b5b head band, pale gold
   accent #d9be91, warm ivory ground. Z-index 190/191 stays far under
   the HSH pop-up overlay (9999), and the JS yield watches that
   overlay too, so the widget never covers a site pop-up. */

#twa-chat-btn {
  position: fixed; left: 18px; bottom: 18px; z-index: 190;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 6px; border: 0; border-radius: 999px;
  background: #103b5b; color: #fff; cursor: pointer;
  font-family: Sora, Inter, system-ui, sans-serif; font-size: 15px; font-weight: 650;
  box-shadow: 0 16px 34px -12px rgba(8, 22, 39, .45);
  transition: transform .25s cubic-bezier(.23,1,.32,1), opacity .25s;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#twa-chat-btn:hover { transform: translateY(-2px); }
#twa-chat-btn img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: #f6f6f3; border: 2px solid #d9be91; pointer-events: none; }
#twa-chat-btn .twa-dot {
  position: absolute; top: 4px; left: 46px; width: 13px; height: 13px; border-radius: 50%;
  background: #a52a2a; border: 2px solid #103b5b;
  animation: twa-pulse 2.2s ease-in-out infinite;
}
@keyframes twa-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
#twa-chat-btn.twa-hidden { opacity: 0; pointer-events: none; transform: translateY(12px); }

#twa-chat-panel {
  position: fixed; left: 18px; bottom: 18px; z-index: 191;
  width: min(396px, calc(100vw - 20px)); height: min(640px, calc(100dvh - 96px));
  display: none; flex-direction: column; overflow: hidden;
  background: #fbf8f2; border-radius: 20px; border: 1px solid #d9e0e2;
  box-shadow: 0 30px 60px -18px rgba(8, 22, 39, .45);
  font-family: Inter, system-ui, sans-serif; color: #223443;
}
#twa-chat-panel.twa-open { display: flex; }
#twa-chat-panel.twa-dragging { transition: none !important; }

/* When the visitor drags the widget, JS switches it to left/top coords. */
#twa-chat-btn.twa-placed, #twa-chat-panel.twa-placed { right: auto; bottom: auto; }

/* Yield: while the site pop-up is on screen, the closed button moves to
   the bottom left; an open panel narrows and hugs the left too. */
#twa-chat-btn.twa-yield { right: auto; left: 18px; }
#twa-chat-panel.twa-yield { right: auto; left: 10px; }

.twa-head {
  background: #103b5b; color: #fff; padding: 12px 14px;
  display: flex; align-items: center; gap: 11px; cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none; flex: 0 0 auto;
}
.twa-head:active { cursor: grabbing; }
.twa-head img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #f6f6f3; border: 2px solid #d9be91; pointer-events: none; }
.twa-head .twa-name { font-family: Sora, Inter, sans-serif; font-weight: 700; font-size: 16.5px; line-height: 1.15; }
.twa-head .twa-role { font-size: 12px; color: #cfdce6; line-height: 1.2; }
.twa-head .twa-close {
  margin-left: auto; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 50%;
  width: 34px; height: 34px; font-size: 19px; line-height: 1; cursor: pointer; flex: 0 0 auto;
}
.twa-head .twa-close:hover { background: #a52a2a; }

.twa-hero { background: #103b5b; color: #e8f1f5; display: flex; gap: 12px; padding: 4px 16px 16px; align-items: flex-end; flex: 0 0 auto; }
.twa-hero video, .twa-hero img.twa-hero-still {
  width: 96px; height: 128px; object-fit: cover; object-position: top center;
  border-radius: 12px; background: transparent; flex: 0 0 auto;
}
.twa-hero p { margin: 0 0 4px; font-size: 13.5px; line-height: 1.45; }
.twa-hero p b { color: #fff; }
.twa-hero p.twa-sign { margin-top: 9px; }
.twa-hero .twa-sign-name { display: block; font-family: Sora, Inter, sans-serif; font-weight: 700; font-size: 13px; color: #fff; }
.twa-hero .twa-sign-line { display: block; font-size: 12.5px; font-style: italic; color: #d9be91; }
#twa-chat-panel.twa-started .twa-hero { display: none; }

.twa-msgs { flex: 1 1 auto; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 9px; overscroll-behavior: contain; }
.twa-msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.twa-msg.tony { background: #fff; border: 1px solid #d9e0e2; border-bottom-left-radius: 5px; align-self: flex-start; box-shadow: 0 4px 14px -8px rgba(36,31,24,.25); }
.twa-msg.me { background: #103b5b; color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }
.twa-msg a { color: #855500; font-weight: 600; }
.twa-msg.me a { color: #d9be91; }
.twa-typing { align-self: flex-start; display: flex; gap: 5px; padding: 12px 14px; background: #fff; border: 1px solid #d9e0e2; border-radius: 16px; border-bottom-left-radius: 5px; }
.twa-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aabb3; animation: twa-blink 1.1s infinite; }
.twa-typing i:nth-child(2) { animation-delay: .18s; } .twa-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes twa-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.twa-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 14px 10px; flex: 0 0 auto; }
.twa-chips button {
  border: 1.5px solid #855500; color: #855500; background: #fff; border-radius: 999px;
  padding: 7px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.twa-chips button:hover { background: #855500; color: #fff; }

.twa-input { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid #d9e0e2; flex: 0 0 auto; }
.twa-input textarea {
  flex: 1; resize: none; border: 1.5px solid #d9e0e2; border-radius: 12px; padding: 10px 12px;
  font: inherit; font-size: 15px; max-height: 96px; color: #223443; background: #fdfcf9;
}
.twa-input textarea:focus { outline: 2px solid #855500; outline-offset: 0; border-color: #855500; }
.twa-input button {
  background: #a52a2a; color: #fff; border: 0; border-radius: 12px; padding: 0 18px;
  font-family: Sora, Inter, sans-serif; font-weight: 700; font-size: 15px; cursor: pointer;
}
.twa-input button:hover { background: #a52a2a; }
.twa-input button:disabled { opacity: .55; cursor: wait; }

.twa-foot { padding: 8px 14px 11px; background: #fff; border-top: 1px solid #eef4f7; font-size: 12.5px; color: #51616c; display: flex; justify-content: space-between; gap: 10px; flex: 0 0 auto; }
.twa-foot a { color: #855500; font-weight: 650; text-decoration: none; }
.twa-foot a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  #twa-chat-panel { right: 10px; left: 10px; width: auto; bottom: 10px; height: min(78dvh, 640px); }
  #twa-chat-panel.twa-yield { left: 10px; }
  #twa-chat-btn { left: 12px; bottom: 12px; }
  #twa-chat-btn.twa-yield { left: 12px; right: auto; }
  #twa-chat-btn .twa-label { display: none; }
  #twa-chat-btn { padding: 5px; }
  #twa-chat-btn img { width: 54px; height: 54px; }
  #twa-chat-btn .twa-dot { left: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  #twa-chat-btn .twa-dot, .twa-typing i { animation: none; }
  #twa-chat-btn { transition: none; }
}
