/* ============================================================
   91uthink · AI 客服聊天窗
   ============================================================ */

.uc-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 9000;
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 28px rgba(43, 108, 246, .38);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.uc-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 34px rgba(43, 108, 246, .46); }
.uc-launcher svg { width: 26px; height: 26px; }
.uc-launcher .uc-dot {
  position: absolute; top: 6px; right: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: #3DDC84; border: 2px solid #fff;
  animation: uc-pulse 2.2s infinite;
}
.uc-launcher.is-open { transform: scale(.92); }
.uc-launcher.is-open .uc-dot { display: none; }

@keyframes uc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, .55); }
  50% { box-shadow: 0 0 0 6px rgba(61, 220, 132, 0); }
}

.uc-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 9001;
  width: 384px; max-width: calc(100vw - 32px);
  height: 588px; max-height: calc(100vh - 130px);
  background: #fff; border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 64px rgba(11, 27, 51, .22), 0 2px 8px rgba(11, 27, 51, .06);
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(14px) scale(.98); pointer-events: none;
  transition: opacity .26s var(--ease), transform .26s var(--ease);
  font-size: 14.5px; line-height: 1.65;
}
.uc-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

.uc-head {
  position: relative; padding: 16px 18px; color: #fff; flex: 0 0 auto;
  background: linear-gradient(135deg, #14336E 0%, var(--brand-dark) 55%, var(--brand) 100%);
}
.uc-head-row { display: flex; align-items: center; gap: 11px; }
.uc-avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 auto;
  background: rgba(255, 255, 255, .16); display: grid; place-items: center;
  font-weight: 800; font-size: 16px; letter-spacing: -.02em;
}
.uc-title { font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.uc-status { font-size: 12px; color: rgba(255, 255, 255, .78); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.uc-status i { width: 6px; height: 6px; border-radius: 50%; background: #3DDC84; display: inline-block; }
.uc-close {
  margin-left: auto; width: 28px; height: 28px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 17px; line-height: 1;
  display: grid; place-items: center; transition: background .2s;
}
.uc-close:hover { background: rgba(255, 255, 255, .24); }

.uc-body {
  flex: 1 1 auto; overflow-y: auto; padding: 18px 16px 8px; background: var(--bg-soft);
  scroll-behavior: smooth;
}
.uc-body::-webkit-scrollbar { width: 6px; }
.uc-body::-webkit-scrollbar-thumb { background: #cfd8e6; border-radius: 99px; }

.uc-msg { display: flex; gap: 8px; margin-bottom: 14px; align-items: flex-end; }
.uc-msg .uc-bubble {
  max-width: 82%; padding: 10px 14px; border-radius: 14px 14px 14px 4px;
  background: #fff; color: var(--ink); box-shadow: var(--shadow-sm);
  white-space: pre-wrap; word-break: break-word;
}
.uc-msg.me { flex-direction: row-reverse; }
.uc-msg.me .uc-bubble {
  border-radius: 14px 14px 4px 14px; background: var(--brand); color: #fff;
  box-shadow: 0 6px 16px rgba(43, 108, 246, .26);
}
.uc-msg .uc-mini {
  width: 26px; height: 26px; border-radius: 9px; flex: 0 0 auto;
  background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}
.uc-msg.me .uc-mini { background: #e8edf7; color: #63758f; }

.uc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px 34px; }
.uc-chip {
  border: 1px solid #d8e2f5; background: #fff; color: var(--brand-dark);
  padding: 6px 12px; border-radius: 99px; font-size: 13px; cursor: pointer;
  transition: all .18s var(--ease);
}
.uc-chip:hover { background: var(--brand-soft); border-color: #b9cdf7; transform: translateY(-1px); }

.uc-typing { display: flex; gap: 4px; padding: 12px 14px; }
.uc-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #9fb2cd;
  animation: uc-bounce 1.3s infinite;
}
.uc-typing span:nth-child(2) { animation-delay: .18s; }
.uc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes uc-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-4px); opacity: 1; } }

/* 留资表单 */
.uc-form { margin: 0 0 14px 0; background: #fff; border: 1px solid #e2e9f6; border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm); }
.uc-form h4 { margin: 0 0 4px; font-size: 14px; color: var(--ink); }
.uc-form p { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.uc-form input, .uc-form textarea {
  width: 100%; border: 1px solid #dfe6f2; border-radius: 9px; padding: 9px 11px;
  font-size: 13.5px; font-family: inherit; color: var(--ink); margin-bottom: 8px;
  background: #fbfcfe; transition: border-color .2s, box-shadow .2s;
}
.uc-form input:focus, .uc-form textarea:focus {
  outline: none; border-color: #9dbcf9; background: #fff;
  box-shadow: 0 0 0 3px rgba(43, 108, 246, .12);
}
.uc-form textarea { resize: vertical; min-height: 54px; }
.uc-form button {
  width: 100%; border: none; border-radius: 9px; padding: 10px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; font-size: 14px; font-weight: 600; font-family: inherit;
  transition: opacity .2s, transform .15s;
}
.uc-form button:hover { transform: translateY(-1px); }
.uc-form button:disabled { opacity: .6; cursor: default; transform: none; }
.uc-form .uc-tip { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* 底部输入 */
.uc-foot { flex: 0 0 auto; border-top: 1px solid var(--line); background: #fff; padding: 10px 12px 12px; }
.uc-input-row { display: flex; gap: 8px; align-items: flex-end; }
.uc-input {
  flex: 1 1 auto; border: 1px solid #dfe6f2; border-radius: 12px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; color: var(--ink); resize: none; max-height: 96px;
  background: #fbfcfe; line-height: 1.5;
}
.uc-input:focus { outline: none; border-color: #9dbcf9; background: #fff; box-shadow: 0 0 0 3px rgba(43, 108, 246, .12); }
.uc-send {
  flex: 0 0 auto; width: 42px; height: 40px; border: none; border-radius: 11px; cursor: pointer;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  transition: background .2s, transform .15s;
}
.uc-send:hover { background: var(--brand-dark); transform: translateY(-1px); }
.uc-send:disabled { background: #c3cfdf; cursor: default; transform: none; }
.uc-send svg { width: 18px; height: 18px; }
.uc-foot-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.uc-link {
  border: none; background: none; color: var(--brand); font-size: 12.5px; cursor: pointer;
  padding: 2px 0; font-family: inherit;
}
.uc-link:hover { text-decoration: underline; }
.uc-note { font-size: 11.5px; color: #a8b3c4; }

@media (prefers-reduced-motion: reduce) {
  .uc-panel, .uc-launcher { transition: none !important; }
  .uc-typing span { animation: none !important; }
  .uc-launcher .uc-dot { animation: none !important; }
}

@media (max-width: 640px) {
  .uc-launcher { right: 16px; bottom: 16px; width: 54px; height: 54px; }
  .uc-panel {
    right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%;
    height: 88vh; max-height: 88vh; border-radius: 20px 20px 0 0;
  }
  .uc-panel.is-open { transform: none; }
  .uc-body { padding: 14px 12px 6px; }
}
