/* ADYWEB – chat (frontend) */
.adyweb-chat-root{
  position:fixed;
  z-index:99999;
  font-size: var(--ady-font-d, 14px);
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  display:flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
@media (max-width: 1024px){
  .adyweb-chat-root{ font-size: var(--ady-font-t, 14px); }
}
@media (max-width: 640px){
  .adyweb-chat-root{ font-size: var(--ady-font-m, 14px); }
}
.adyweb-chat-root.pos-br{ right:var(--ady-offset,20px); bottom:calc(var(--ady-offset,20px) + env(safe-area-inset-bottom, 0px)); }
.adyweb-chat-root.pos-bl{ left:var(--ady-offset,20px); bottom:calc(var(--ady-offset,20px) + env(safe-area-inset-bottom, 0px)); }
.adyweb-chat-root.pos-tr{ right:var(--ady-offset,20px); top:var(--ady-offset,20px); }
.adyweb-chat-root.pos-tl{ left:var(--ady-offset,20px); top:var(--ady-offset,20px); }

.adyweb-chat-trigger{
  width: var(--ady-trigger-d,56px);
  height: var(--ady-trigger-d,56px);
  border-radius: var(--ady-radius, 18px);
  border: 0 !important;
  outline: none;
  border-color: transparent !important;
  cursor: pointer;
  background: var(--ady-trigger-bg, #76b74d);
  color: var(--ady-trigger-color, #fff);
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  -webkit-appearance: none;
  appearance: none;
}
.adyweb-chat-root.no-borders .adyweb-chat-trigger,
.adyweb-chat-root.no-borders .adyweb-chat-trigger:hover{
  box-shadow: none !important;
}
.adyweb-chat-trigger:hover{ transform: translateY(calc(var(--ady-anim,1) * -2px)); box-shadow: 0 14px 30px rgba(0,0,0,.22); }
.adyweb-chat-trigger:active{ transform: translateY(calc(var(--ady-anim,1) * 0px)); }
.adyweb-chat-trigger:focus{ outline: calc(var(--ady-focus-ring,1) * 2px) solid rgba(17,24,39,.35); outline-offset: 3px; }
.adyweb-chat-trigger:focus-visible{ outline: calc(var(--ady-focus-ring,1) * 2px) solid rgba(17,24,39,.35); outline-offset: 3px; }
@media (max-width: 1024px){ .adyweb-chat-trigger{ width: var(--ady-trigger-t,52px); height: var(--ady-trigger-t,52px);} }
@media (max-width: 640px){ .adyweb-chat-trigger{ width: var(--ady-trigger-m,48px); height: var(--ady-trigger-m,48px);} }
.adyweb-chat-trigger-icon{ font-size: 20px; line-height: 1; }
.adyweb-chat-trigger-img{ width: 22px; height: 22px; object-fit: contain; border:0 !important; outline:0; box-shadow:none !important; }

.adyweb-chat-panel{
  width: min(360px, calc(100vw - 24px));
  height: var(--ady-height, auto);
  max-height: min(640px, calc(100vh - 120px));
  border-radius: var(--ady-radius, 18px);
  overflow: hidden;
  background: var(--ady-panel-bg, #fff);
  border: var(--ady-border-w, 0px) solid var(--ady-border-color, var(--ady-panel-border, transparent));
  box-shadow: 0 20px 48px rgba(0,0,0,.22);
  display:none;
}
.adyweb-chat-root.open .adyweb-chat-panel{ display:flex; flex-direction:column; }

.adyweb-chat-header{
  background: var(--ady-header-bg, #76b74d);
  color: var(--ady-header-text, #fff);
  padding: var(--ady-pad, 14px);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.adyweb-chat-header-left{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
}
.adyweb-chat-avatar{
  width: 26px; height: 26px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255,255,255,.2);
  flex: 0 0 auto;
}
.adyweb-chat-avatar.placeholder{
  display:inline-block;
}
.adyweb-chat-header-text{ min-width:0; }
.adyweb-chat-title{
  font-weight: 700;
  font-size: 13px;
  line-height: 1.1;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.adyweb-chat-subtitle{
  font-size: 11px;
  opacity: .92;
  line-height: 1.1;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.adyweb-chat-close{
  border:0 !important;
  outline:none;
  border-color: transparent !important;
  background: transparent;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity:.9;
  box-shadow:none !important;
  -webkit-appearance: none;
  appearance: none;
}
.adyweb-chat-close:focus,
.adyweb-chat-close:focus-visible{
  outline: calc(var(--ady-focus-ring,1) * 2px) solid rgba(17,24,39,.35);
  outline-offset: 2px;
}
.adyweb-chat-close:hover{ opacity:1; }

.adyweb-chat-messages{
  background: var(--ady-messages-bg, #f5f6f7);
  padding: var(--ady-pad, 14px);
  overflow:auto;
  flex: 1 1 auto;
}
.adyweb-chat-msg{
  display:flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items:flex-end;
}
.adyweb-chat-mini-avatar{
  width: 22px; height: 22px;
  border-radius: 8px;
  object-fit: cover;
  background:#e5e7eb;
  flex: 0 0 auto;
}
.adyweb-chat-mini-avatar.placeholder{ background:#d1d5db; }
.adyweb-chat-mini-spacer{ width:22px; height:22px; }

.adyweb-chat-bubble{
  max-width: 92%;
  border-radius: 14px;
  padding: 12px 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.adyweb-chat-msg.from-admin .adyweb-chat-bubble,
.adyweb-chat-msg.from-system .adyweb-chat-bubble{
  background: var(--ady-bubble-admin-bg, #fff);
  color: var(--ady-bubble-admin-text, #111827);
  border: var(--ady-border-w, 0px) solid var(--ady-border-color, rgba(17,24,39,0.08));
}
.adyweb-chat-msg.from-visitor{
  justify-content:flex-end;
}
.adyweb-chat-msg.from-visitor .adyweb-chat-bubble{
  background: var(--ady-bubble-visitor-bg, #eef7e9);
  color: var(--ady-bubble-visitor-text, #0b1f10);
  border: var(--ady-border-w, 0px) solid var(--ady-border-color, rgba(17,24,39,0.06));
}
.adyweb-chat-msg.pending .adyweb-chat-bubble{
  opacity: .7;
}

.adyweb-chat-typing{
  display:flex;
  gap: 8px;
  align-items:center;
  margin: 6px 0 0 0;
}
.adyweb-chat-typing .dots{
  display:flex;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ady-bubble-admin-bg, #fff);
  border: var(--ady-border-w, 0px) solid var(--ady-border-color, rgba(17,24,39,0.08));
}
.adyweb-chat-typing .dot{
  width: 6px; height: 6px;
  border-radius: var(--ady-radius, 18px);
  background: rgba(17,24,39,.5);
  animation: ady-dot 1.2s infinite ease-in-out;
}
.adyweb-chat-typing .dot:nth-child(2){ animation-delay: .15s; }
.adyweb-chat-typing .dot:nth-child(3){ animation-delay: .3s; }
@keyframes ady-dot{
  0%, 80%, 100%{ transform: translateY(0); opacity:.45; }
  40%{ transform: translateY(-3px); opacity:1; }
}

.adyweb-chat-compose{
  padding: var(--ady-pad, 14px);
  background: var(--ady-panel-bg, #fff);
  border-top: var(--ady-border-w, 0px) solid var(--ady-border-color, rgba(17,24,39,0.08));
  display:flex;
  gap: 12px;
  align-items:flex-end;
}
.adyweb-chat-input{
  flex:1;
  resize:none;
  border-radius: var(--ady-radius, 18px);
  padding: 0 14px;
  border: var(--ady-border-w, 0px) solid var(--ady-input-border, var(--ady-border-color, rgba(17,24,39,0.18)));
  background: var(--ady-input-bg, #fff);
  color: var(--ady-input-text, #111827);
  outline: none;
  height: var(--ady-compose-h, 44px);
  min-height: var(--ady-compose-h, 44px);
  line-height: 1.25;
  padding-top: 11px;
  padding-bottom: 11px;
  box-sizing: border-box;
}
.adyweb-chat-send{
  border:0 !important;
  outline:none;
  border-color: transparent !important;
  background: var(--ady-send-bg, #76b74d);
  cursor:pointer;
  height: var(--ady-compose-h, 44px);
  padding: 0 14px;
  border-radius: var(--ady-radius, 18px);
  color: var(--ady-send-color, #fff);
  display:flex;
  align-items:center;
  justify-content:center;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
  opacity:.8;
  box-shadow:none;
  -webkit-appearance: none;
  appearance: none;
}
.adyweb-chat-send:focus,
.adyweb-chat-send:focus-visible{
  outline: calc(var(--ady-focus-ring,1) * 2px) solid rgba(17,24,39,.35);
  outline-offset: 2px;
}
.adyweb-chat-send:hover{ opacity:1; transform: translateY(calc(var(--ady-anim,1) * -1px)); box-shadow: 0 10px 20px rgba(0,0,0,.18);} 
.adyweb-chat-send:active{ transform: translateY(0); }
.adyweb-chat-root.no-borders .adyweb-chat-send:hover{
  box-shadow: none !important;
}

/* Offline contact capture choices (rendered inside a system bubble) */
.adyweb-chat-choice{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
}
.adyweb-chat-chip{
  border: var(--ady-border-w,0px) solid var(--ady-contact-border, var(--ady-border-color, rgba(17,24,39,0.18)));
  background: var(--ady-contact-bg, #fff);
  color: var(--ady-contact-text, #111827);
  border-radius: var(--ady-radius, 18px);
  padding: 10px 12px;
  cursor:pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.adyweb-chat-chip:hover{ opacity:1; transform: translateY(calc(var(--ady-anim,1) * -1px)); box-shadow: 0 10px 20px rgba(0,0,0,.14);} 

.adyweb-chat-input::placeholder{ color: var(--ady-input-placeholder, rgba(17,24,39,0.45)); }
.adyweb-chat-input:focus{ box-shadow: 0 0 0 3px rgba(118,183,77,.25); }

@media (prefers-reduced-motion: reduce){
  .adyweb-chat-trigger, .adyweb-chat-send, .adyweb-chat-chip{ transition:none !important; }
  .adyweb-chat-trigger:hover, .adyweb-chat-send:hover, .adyweb-chat-chip:hover{ transform:none !important; box-shadow:none !important; }
}
