/* ===== CHAT — stil Meta / Messenger ===== */
.chat-fab{
  position:fixed;right:14px;bottom:88px;z-index:450;
  min-width:56px;height:56px;padding:0 14px;border-radius:28px;border:none;cursor:pointer;
  background:linear-gradient(135deg,#0084ff 0%,#00a2ff 50%,#44bec7 100%);
  color:#fff;display:flex;align-items:center;justify-content:center;gap:8px;
  box-shadow:0 8px 28px rgba(0,132,255,.42),0 0 0 0 rgba(0,132,255,.35);
  -webkit-tap-highlight-color:transparent;
  animation:chatFabPulse 2.8s ease-in-out infinite;
  font-family:inherit;
}
.chat-fab-ico{
  width:22px;height:22px;flex-shrink:0;display:flex;align-items:center;justify-content:center;
}
.chat-fab-ico svg{width:22px;height:22px;fill:currentColor}
.chat-fab-lbl{
  font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;
  white-space:nowrap;line-height:1;
}
.chat-fab-badge{
  position:absolute;top:-2px;right:-2px;min-width:18px;height:18px;padding:0 5px;
  background:#f02849;border-radius:999px;font-size:10px;font-weight:700;
  display:none;align-items:center;justify-content:center;border:2px solid #fff;
}
.chat-fab-badge.on{display:flex}
@keyframes chatFabPulse{
  0%,100%{opacity:1;box-shadow:0 8px 28px rgba(0,132,255,.42),0 0 0 0 rgba(0,132,255,.3);transform:scale(1)}
  50%{opacity:.82;box-shadow:0 10px 32px rgba(0,132,255,.55),0 0 0 10px rgba(0,132,255,0);transform:scale(1.03)}
}
@media(prefers-reduced-motion:reduce){
  .chat-fab{animation:none}
}
body.admin-on .chat-fab,
body.popup-open .chat-fab{opacity:0;pointer-events:none;transform:scale(.8);animation:none}
.ig-fab{bottom:168px}

.chat-overlay{
  position:fixed;inset:0;z-index:4600;background:rgba(0,0,0,.45);
  display:none;align-items:flex-end;justify-content:center;
  backdrop-filter:blur(4px);
}
.chat-overlay.open{display:flex}
.chat-sheet{
  width:100%;max-width:420px;height:min(92vh,720px);
  background:#fff;border-radius:18px 18px 0 0;
  display:flex;flex-direction:column;overflow:hidden;
  box-shadow:0 -8px 40px rgba(0,0,0,.25);
  animation:chatUp .28s ease;
}
@keyframes chatUp{from{transform:translateY(40px);opacity:.6}to{transform:none;opacity:1}}
.chat-head{
  flex-shrink:0;display:flex;align-items:center;gap:10px;
  padding:12px 14px;background:linear-gradient(135deg,#0084ff,#00c6ff);
  color:#fff;
}
.chat-head-avatar{
  width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,.25);
  display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0;
}
.chat-head-info{flex:1;min-width:0}
.chat-head-info strong{display:block;font-size:15px;font-weight:700}
.chat-head-info span{font-size:11px;opacity:.9}
.chat-head-close{
  background:rgba(255,255,255,.2);border:none;color:#fff;width:36px;height:36px;
  border-radius:50%;font-size:20px;cursor:pointer;line-height:1;
}
.chat-msgs{
  flex:1;overflow-y:auto;padding:14px 12px;background:#f0f2f5;
  display:flex;flex-direction:column;gap:8px;-webkit-overflow-scrolling:touch;
}
.chat-bubble{
  max-width:82%;padding:10px 12px;border-radius:18px;font-size:14px;line-height:1.4;
  word-wrap:break-word;white-space:pre-wrap;position:relative;z-index:1;
}
.chat-bubble.bot,.chat-bubble.admin{
  align-self:flex-start;background:#fff;color:#050505;
  border-bottom-left-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.06);
}
.chat-bubble.admin .chat-who{
  font-size:10px;font-weight:700;color:#0084ff;margin-bottom:4px;letter-spacing:.02em;
}
.chat-bubble.client{
  align-self:flex-end;background:#0084ff;color:#fff;border-bottom-right-radius:4px;
}
.chat-bubble.system{
  align-self:center;background:#e7f3ff;color:#1c2b33;font-size:13px;
  border-radius:12px;text-align:center;max-width:92%;
}
.chat-quick{
  display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;
}
.chat-quick button{
  border:1px solid #0084ff;background:#fff;color:#0084ff;border-radius:999px;
  padding:8px 14px;font-size:12px;font-weight:600;cursor:pointer;
  font-family:inherit;pointer-events:auto;-webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
.chat-quick button:active{background:#e7f3ff}
.chat-quick button.chat-install-cta,
.chat-quick button[data-chat-install]{
  background:linear-gradient(135deg,#0084ff,#00a2ff);color:#fff;border-color:transparent;
  font-weight:700;box-shadow:0 4px 14px rgba(0,132,255,.28);
}
.chat-form-card,.chat-confirm-card{
  align-self:flex-start;width:92%;max-width:340px;background:#fff;border-radius:14px;
  padding:12px;box-shadow:0 2px 10px rgba(0,0,0,.08);position:relative;z-index:2;
}
.chat-form-card h4,.chat-confirm-card h4{font-size:14px;margin:0 0 8px;color:#050505}
.chat-form-card label{display:block;font-size:11px;color:#65676b;margin:8px 0 3px}
.chat-form-card input,.chat-form-card select,.chat-form-card textarea{
  width:100%;border:1px solid #ccd0d5;border-radius:8px;padding:9px 10px;
  font-size:16px;font-family:inherit;box-sizing:border-box;background:#fff;
}
.chat-form-card button,.chat-confirm-card button{
  width:100%;margin-top:12px;border:none;border-radius:10px;padding:12px;
  background:#0084ff;color:#fff;font-weight:700;font-size:14px;cursor:pointer;
  font-family:inherit;
}
.chat-totals{
  margin:10px 0 4px;padding:10px;background:#f7f8fa;border-radius:10px;
  border:1px solid #e4e6eb;
}
.chat-tot-row{
  display:flex;justify-content:space-between;gap:10px;font-size:13px;
  padding:4px 0;color:#050505;
}
.chat-tot-row s{opacity:.55;margin-right:6px}
.chat-tot-row.disc{color:#e11d48;font-weight:700}
.chat-tot-row.pay{
  margin-top:6px;padding-top:8px;border-top:1px solid #e4e6eb;
  font-size:15px;font-weight:800;
}
.admin-disc-modal{
  position:fixed;inset:0;z-index:5000;background:rgba(0,0,0,.55);
  display:flex;align-items:flex-end;justify-content:center;
}
.admin-disc-sheet{
  width:100%;max-width:420px;background:#fff;border-radius:16px 16px 0 0;
  padding:18px 16px calc(18px + env(safe-area-inset-bottom,0px));
}
.admin-disc-sheet h3{margin:0 0 6px;font-size:16px}
.admin-disc-sheet p{margin:0 0 12px;font-size:12px;color:var(--muted)}
.admin-disc-opts{display:flex;gap:8px}
.admin-disc-opts button{
  flex:1;border:1.5px solid var(--border);border-radius:12px;padding:12px 8px;
  background:#fff;font-weight:700;cursor:pointer;font-family:inherit;font-size:13px;
}
.admin-disc-opts button.on{border-color:#0084ff;background:#e7f3ff;color:#0084ff}
.admin-disc-actions{display:flex;gap:8px;margin-top:14px;justify-content:flex-end}
#adminChatDiscBtn:disabled{opacity:.45;pointer-events:none}
.chat-gate{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:24px 20px;background:#f0f2f5;text-align:center;gap:10px;
}
.chat-gate h3{font-size:18px;color:#050505;margin:0}
.chat-gate p{font-size:13px;color:#65676b;margin:0 0 8px;line-height:1.45}
.chat-gate input{
  width:100%;max-width:280px;border:1px solid #ccd0d5;border-radius:12px;
  padding:12px 14px;font-size:16px;text-align:center;font-family:inherit;
}
.chat-gate button{
  width:100%;max-width:280px;border:none;border-radius:12px;padding:13px;
  background:#0084ff;color:#fff;font-weight:700;font-size:15px;cursor:pointer;
  font-family:inherit;margin-top:4px;
}
.chat-compose{
  flex-shrink:0;display:flex;flex-direction:column;gap:4px;
  padding:8px 12px calc(10px + env(safe-area-inset-bottom,0px));
  background:#fff;border-top:1px solid #e4e6eb;
}
.chat-typing{
  font-size:11px;color:#65676b;min-height:14px;padding:0 4px;
  opacity:0;transition:opacity .2s;
}
.chat-typing.on{opacity:1}
.chat-compose-row{display:flex;gap:8px;align-items:flex-end}
.chat-compose input{
  flex:1;border:none;background:#f0f2f5;border-radius:20px;padding:10px 14px;
  font-size:16px;outline:none;font-family:inherit;min-width:0;
}
.chat-compose-row button{
  width:40px;height:40px;border:none;border-radius:50%;background:#0084ff;color:#fff;
  cursor:pointer;flex-shrink:0;display:flex;align-items:center;justify-content:center;
}
.chat-compose-row button:disabled{opacity:.4}

.chat-toast-nudge{
  position:fixed;left:50%;bottom:160px;transform:translateX(-50%) translateY(12px);
  background:rgba(20,24,40,.96);color:#fff;padding:12px 18px;border-radius:14px;
  font-size:13px;z-index:4700;opacity:0;pointer-events:none;transition:.35s;
  box-shadow:0 8px 28px rgba(0,0,0,.3);max-width:90%;text-align:center;
}
.chat-toast-nudge.on{opacity:1;transform:translateX(-50%) translateY(0);pointer-events:auto}

/* Admin chat */
.admin-chat-wrap{display:flex;gap:0;min-height:480px;border:1px solid var(--border);border-radius:12px;overflow:hidden;background:#fff}
.admin-chat-list{width:38%;min-width:140px;border-right:1px solid var(--border);overflow-y:auto;max-height:70vh;background:#fafafa}
.admin-chat-item{padding:12px;border-bottom:1px solid var(--border);cursor:pointer}
.admin-chat-item:hover,.admin-chat-item.active{background:#eef6ff}
.admin-chat-item.closed{opacity:.72}
.admin-chat-item strong{display:block;font-size:13px}
.admin-chat-item span{font-size:11px;color:var(--muted);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.admin-chat-item .unread{display:inline-block;background:var(--red);color:#fff;font-size:10px;padding:1px 6px;border-radius:999px;margin-left:6px}
.admin-chat-item .closed-tag{font-size:10px;color:#c0392b;font-weight:600}
.admin-chat-thread{flex:1;display:flex;flex-direction:column;min-width:0;max-height:70vh}
.admin-chat-thread-head{
  padding:8px 10px;border-bottom:1px solid var(--border);font-size:13px;background:#fff;
  display:flex;align-items:center;gap:8px;min-height:48px;
}
.admin-chat-back{
  width:34px;height:34px;border:none;border-radius:50%;background:#f0f2f5;cursor:pointer;
  font-size:16px;flex-shrink:0;display:none;align-items:center;justify-content:center;
}
.admin-chat-head-txt{flex:1;min-width:0;line-height:1.35}
.admin-chat-msgs{flex:1;overflow-y:auto;padding:12px;background:#f0f2f5;display:flex;flex-direction:column;gap:8px}
.admin-chat-compose{display:flex;gap:6px;padding:10px;border-top:1px solid var(--border);background:#fff;flex-wrap:wrap;align-items:center}
.admin-chat-actions{display:flex;gap:6px;flex-wrap:wrap;width:100%}
.admin-chat-compose input{flex:1;min-width:120px;border:1px solid var(--border);border-radius:8px;padding:9px 10px;font-size:14px}
.admin-chat-typing{font-size:11px;color:var(--muted);padding:0 12px 6px;min-height:16px}
@media(max-width:700px){
  .admin-chat-wrap{flex-direction:column;min-height:70vh}
  .admin-chat-list{width:100%;max-height:none;flex:1}
  .admin-chat-thread{display:none;max-height:none;flex:1;min-height:60vh}
  .admin-chat-wrap.thread-open .admin-chat-list{display:none}
  .admin-chat-wrap.thread-open .admin-chat-thread{display:flex}
  .admin-chat-back{display:flex}
}

/* Product popup — Chat Live button */
.btn-chat-live{
  background:linear-gradient(135deg,#0084ff,#44bec7)!important;
  border:none!important;color:#fff!important;
  animation:chatBtnGlow 2.6s ease-in-out infinite;
}
@keyframes chatBtnGlow{
  0%,100%{opacity:1;filter:brightness(1)}
  50%{opacity:.88;filter:brightness(1.08)}
}
