/* ── Li Widget — Mamgil ──────────────────────────────── */

#li-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0;
  font-family: 'Inter', sans-serif;
}

/* Row that holds bubble + avatar side by side */
.li-footer-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 12px;
}

/* Column that stacks online tag + bubble */
.li-side-bubble {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.li-online-tag {
  font-size: 10px;
  background: #fff8e6;
  color: #c9a84c;
  border: 1px solid #e8dfc8;
  border-radius: 10px;
  padding: 3px 12px;
  letter-spacing: 0.5px;
  opacity: 0;
  animation: li-slideIn 0.5s ease 0.8s forwards;
}

.li-bubble {
  background: #ffffff;
  border: 1px solid #e8dfc8;
  color: #1a1205;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 13px;
  font-size: 12px;
  max-width: 210px;
  line-height: 1.5;
  box-shadow: 0 4px 24px rgba(201,168,76,0.12);
  opacity: 0;
  animation: li-slideIn 0.5s ease 1.2s forwards;
}

.li-bubble-name {
  font-size: 10px;
  font-weight: 500;
  color: #c9a84c;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.li-bubble-text { color: #555; font-size: 13px; }

.li-typing { display: flex; gap: 4px; align-items: center; margin-top: 8px; }

.li-dot {
  width: 5px; height: 5px;
  background: #c9a84c;
  border-radius: 50%;
  animation: li-bounce 1.2s infinite ease-in-out;
}
.li-dot:nth-child(2) { animation-delay: 0.2s; }
.li-dot:nth-child(3) { animation-delay: 0.4s; }

.li-avatar-wrap {
  position: relative;
  width: 90px; height: 90px;
  cursor: pointer;
  transition: transform 0.2s;
  opacity: 0;
  animation: li-slideIn 0.5s ease 0.3s forwards;
}

.li-avatar-wrap:hover {
  transform: scale(1.06);
  filter: drop-shadow(0 4px 16px rgba(201,168,76,0.5));
}

.li-avatar-ring {
  position: absolute; inset: -3px;
  border-radius: 50%;
  background: conic-gradient(#c9a84c, #f0d080, #fff8e1, #c9a84c, #8a6a1c, #c9a84c);
  animation: li-spin 7s linear infinite;
}

.li-avatar-face {
  position: absolute; inset: 3px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff8f0;
  border: 1px solid #e8dfc8;
}

.li-avatar-face img {
  animation: li-float 3.8s ease-in-out 2s infinite;
  will-change: transform;
  transform-origin: center 65%;
}

.li-speaking-now .li-avatar-face img,
.li-speaking-now > img {
  animation: li-speak 0.45s ease-in-out 4 !important;
}

.li-speaking-now .li-avatar-ring {
  animation: li-spin 1.8s linear infinite !important;
}

.li-status-dot {
  position: absolute; bottom: 3px; right: 3px;
  width: 14px; height: 14px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #ffffff;
  z-index: 2;
  animation: li-pulse-green 2s infinite;
}

.li-chat-box {
  background: #ffffff;
  border: 1px solid #e8dfc8;
  border-radius: 20px;
  width: 370px;
  box-shadow: 0 12px 48px rgba(201,168,76,0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 520px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  pointer-events: none;
}

.li-chat-box.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.li-chat-header {
  background: linear-gradient(135deg, #c9a84c 0%, #a8831e 100%);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.li-chat-header-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.4);
  flex-shrink: 0;
}

.li-chat-header-name { font-size: 13px; font-weight: 500; color: #ffffff; }
.li-chat-header-status { font-size: 10px; color: rgba(255,255,255,0.75); letter-spacing: 0.5px; }

.li-chat-close {
  margin-left: auto;
  background: transparent; border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px; cursor: pointer;
  line-height: 1; padding: 0 4px;
}
.li-chat-close:hover { color: #ffffff; }

.li-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.li-messages::-webkit-scrollbar { width: 4px; }
.li-messages::-webkit-scrollbar-track { background: transparent; }
.li-messages::-webkit-scrollbar-thumb { background: #e8dfc8; border-radius: 4px; }
.li-messages::-webkit-scrollbar-thumb:hover { background: #c9a84c; }

.li-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}

.li-msg.from-li {
  background: #fff8e6;
  color: #1a1205;
  border: 1px solid #e8dfc8;
  border-radius: 14px 14px 14px 4px;
  align-self: flex-start;
}

.li-msg.from-user {
  background: #c9a84c;
  color: #ffffff;
  border-radius: 14px 14px 4px 14px;
  align-self: flex-end;
}

.li-msg-time {
  font-size: 10px;
  color: #999080;
  margin-top: 3px;
  opacity: 0.7;
}
.li-msg.from-li .li-msg-time { text-align: left; }
.li-msg.from-user .li-msg-time { text-align: right; color: rgba(255,255,255,0.6); }

.li-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e8dfc8;
  align-items: center;
}

.li-chat-input {
  flex: 1;
  border: 1px solid #e8dfc8;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: #1a1205;
  outline: none;
  background: #f9f7f2;
  transition: border-color 0.2s;
}
.li-chat-input:focus { border-color: #c9a84c; }
.li-chat-input::placeholder { color: #bbb; }

.li-chat-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a84c 0%, #a8831e 100%);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(201,168,76,0.35);
}
.li-chat-send:hover { opacity: 0.88; box-shadow: 0 4px 14px rgba(201,168,76,0.5); }
.li-chat-send:active { transform: scale(0.93); }
.li-chat-send svg { width: 14px; height: 14px; fill: #ffffff; }

@media (max-width: 480px) {
  .li-chat-box { width: calc(100vw - 32px); }
  .li-bubble { max-width: 200px; }
}

@keyframes li-slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes li-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}
@keyframes li-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes li-pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}
@keyframes li-float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  30%       { transform: translateY(-5px) rotate(-1deg); }
  65%       { transform: translateY(-3px) rotate(0.8deg); }
}
@keyframes li-speak {
  0%   { transform: translateY(0px) rotate(0deg); }
  20%  { transform: translateY(-9px) rotate(-2.5deg); }
  45%  { transform: translateY(-4px) rotate(2deg); }
  70%  { transform: translateY(-8px) rotate(-1.5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}
