/* ── CHAT WIDGET ── */
#chat-widget {
  position: fixed; bottom: 28px; right: 32px; z-index: 9999;
}
#chat-widget-p {
  position: fixed; bottom: 28px; left: 32px; z-index: 9999;
}

#chat-btn {
  width: 74px; height: 74px; border-radius: 50%;
  border: none; cursor: pointer; padding: 0; overflow: hidden;
  box-shadow: 0 6px 28px rgba(200,135,58,.5), 0 0 0 3px rgba(200,135,58,.3);
  animation: pulse-ring 2.8s ease-in-out infinite;
  transition: transform .2s;
}
#chat-btn:hover { transform: scale(1.06); }
#chat-btn video { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

@keyframes pulse-ring {
  0%   { box-shadow: 0 6px 28px rgba(200,135,58,.5), 0 0 0 0 rgba(200,135,58,.4); }
  60%  { box-shadow: 0 6px 28px rgba(200,135,58,.5), 0 0 0 18px rgba(200,135,58,0); }
  100% { box-shadow: 0 6px 28px rgba(200,135,58,.5), 0 0 0 0 rgba(200,135,58,0); }
}

#chat-panel {
  position: absolute; bottom: 86px; right: 0;
  width: 370px; height: 560px;
  background: #f7f0e6; border-radius: 18px 18px 4px 18px;
  box-shadow: 0 24px 80px rgba(44,34,24,.22);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.96);
  pointer-events: none; transition: opacity .3s, transform .3s;
}
#chat-panel-p {
  position: absolute; bottom: 86px; left: 0;
  width: 370px; height: 560px;
  background: #f7f0e6; border-radius: 18px 18px 18px 4px;
  box-shadow: 0 24px 80px rgba(44,34,24,.22);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.96);
  pointer-events: none; transition: opacity .3s, transform .3s;
}
#chat-panel.open, #chat-panel-p.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

.panel-header {
  background: linear-gradient(135deg, #8a5a1e, #c8873a, #e8a85a);
  padding: 14px 18px; display: flex; align-items: center; gap: 12px;
}

.avatar-frame {
  width: 52px; height: 52px; border-radius: 50%; position: relative;
  border: 2px solid rgba(255,255,255,.5); overflow: visible; flex-shrink: 0;
}
.avatar-frame img,
.avatar-frame video {
  width: 100%; height: 100%; object-fit: cover;
  display: block; border-radius: 50%;
}

.status-dot {
  position: absolute; bottom: 0px; right: 0px;
  width: 11px; height: 11px; background: #6ed96e;
  border-radius: 50%; border: 2px solid #c8873a; z-index: 2;
}

.agent-name { font-size: 1.2rem; font-weight: 600; color: #fff; }
.agent-role  { font-size: .68rem; color: rgba(255,255,255,.8); text-transform: uppercase; letter-spacing: .12em; }
.header-text { flex: 1; }

.close-btn {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: .9rem;
}

#messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}

.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: .83rem; line-height: 1.55; }
.msg.bot  { background: #fff; color: #2c2218; border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.user { background: linear-gradient(135deg, #c8873a, #b85c38); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }

.typing-indicator { display: flex; gap: 5px; padding: 12px 16px; background: #fff; border-radius: 14px 14px 14px 4px; align-self: flex-start; }
.typing-dot { width: 7px; height: 7px; background: #c8873a; border-radius: 50%; animation: bounce 1.2s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%,80%,100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-6px); opacity: 1; } }

.suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.suggestion-chip {
  background: rgba(200,135,58,.1); border: 1px solid rgba(200,135,58,.28);
  color: #8a5a1e; font-size: .72rem; padding: 5px 12px;
  border-radius: 20px; cursor: pointer; transition: all .2s;
}
.suggestion-chip:hover { background: #c8873a; color: #fff; }

.input-area {
  padding: 12px 14px; border-top: 1px solid rgba(200,135,58,.15);
  background: rgba(255,255,255,.65); display: flex; gap: 8px;
}
#user-input {
  flex: 1; border: 1px solid rgba(200,135,58,.25); border-radius: 22px;
  padding: 10px 16px; font-size: .82rem; outline: none;
}
#user-input:focus { border-color: #c8873a; }
#send-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #c8873a, #b85c38);
  color: #fff; cursor: pointer; font-size: 1rem;
}

#chat-hint {
  position: absolute; bottom: 86px; right: 0;
  background: #2c2218; color: #fff; font-size: .74rem;
  padding: 7px 14px; border-radius: 20px 20px 4px 20px;
  white-space: nowrap; opacity: 0; pointer-events: none;
  animation: hintIn .4s 2s forwards, hintOut .4s 6.5s forwards;
}
#chat-hint-p {
  position: absolute; bottom: 86px; left: 0;
  background: #2c2218; color: #fff; font-size: .74rem;
  padding: 7px 14px; border-radius: 20px 20px 20px 4px;
  white-space: nowrap; opacity: 0; pointer-events: none;
  animation: hintIn .4s 2s forwards, hintOut .4s 6.5s forwards;
}
@keyframes hintIn  { to { opacity: 1; transform: translateY(0); } from { opacity: 0; transform: translateY(6px); } }
@keyframes hintOut { to { opacity: 0; } }