:root {
  --cc-space-1: 4px;
  --cc-space-2: 8px;
  --cc-space-3: 12px;
  --cc-space-4: 16px;
  --cc-space-5: 20px;
  --cc-radius-sm: 6px;
  --cc-radius-md: 10px;
  --cc-control-height: 36px;
  --cc-focus: 0 0 0 3px rgba(47, 111, 255, 0.22);
}

.cc-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 5000;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid #d5dde6;
  border-radius: var(--cc-radius-md);
  background: #ffffff;
  color: #243b53;
  box-shadow: 0 12px 30px rgba(32, 52, 74, 0.18);
  transform: translateX(-50%);
  font-size: 14px;
  line-height: 1.5;
}

.cc-toast--success { border-color: #b9dfc6; }
.cc-toast--error { border-color: #efb7b7; color: #8f2d2d; }
.cc-loading {
  position: fixed;
  inset: 0;
  z-index: 4999;
  display: grid;
  place-items: center;
  background: rgba(17, 34, 51, 0.16);
  color: #243b53;
  pointer-events: all;
}

.cc-loading::before {
  content: "";
  width: 26px;
  height: 26px;
  border: 3px solid rgba(47, 111, 255, 0.22);
  border-top-color: #2f6fff;
  border-radius: 50%;
  animation: cc-spin 0.75s linear infinite;
}

@keyframes cc-spin { to { transform: rotate(360deg); } }

.cc-connection-status {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 5050;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 8px 13px;
  border: 1px solid #d8e3f0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #49627d;
  box-shadow: 0 8px 22px rgba(46, 76, 110, 0.16);
  transform: translateX(-50%);
  font-size: 13px;
  line-height: 1.3;
  pointer-events: none;
  animation: cc-status-in 180ms ease-out;
}

.cc-connection-status--slow {
  border-color: #eed6a6;
  color: #866426;
}

.cc-connection-status__spinner,
.cc-send-spinner,
.bubble_cont .cc-message-sending {
  display: inline-block;
  width: 13px;
  height: 13px;
  box-sizing: border-box;
  border: 2px solid rgba(47, 111, 255, 0.22);
  border-top-color: #2f6fff;
  border-radius: 50%;
  animation: cc-spin 0.72s linear infinite;
  vertical-align: -2px;
}

.cc-send-spinner {
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border-color: rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  vertical-align: -2px;
}

.bubble_cont .cc-message-sending {
  margin-top: -7px;
  margin-right: 13px;
  vertical-align: middle;
}

.cc-connection-status__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes cc-status-in {
  from { opacity: 0; transform: translate(-50%, -5px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

#myMessagesList[data-list-loading="true"],
#myFriendsList[aria-busy="true"],
#myRoomList[aria-busy="true"] {
  position: relative;
}

#myMessagesList[data-list-loading="true"]::before,
#myFriendsList[aria-busy="true"]::before,
#myRoomList[aria-busy="true"]::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 16px auto 7px;
  box-sizing: border-box;
  border: 2px solid rgba(47, 111, 255, 0.2);
  border-top-color: #2f6fff;
  border-radius: 50%;
  animation: cc-spin 0.72s linear infinite;
}

#myMessagesList[data-list-loading="true"]::after,
#myFriendsList[aria-busy="true"]::after,
#myRoomList[aria-busy="true"]::after {
  display: block;
  color: #7c8da1;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

#myMessagesList[data-list-loading="true"]::after { content: "正在加载消息..."; }
#myFriendsList[aria-busy="true"]::after { content: "正在加载通讯录..."; }
#myRoomList[aria-busy="true"]::after { content: "正在加载群组..."; }

.loadHistoryIcon {
  min-height: 28px;
  padding: 8px 12px;
  color: #7c8da1;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

.loadHistoryIcon a {
  color: #2f6fff;
  text-decoration: none;
}

.loadHistoryIcon img {
  margin-right: 6px;
  vertical-align: middle;
}

.cc-focusable:focus-visible,
[data-cc-action]:focus-visible {
  outline: none;
  box-shadow: var(--cc-focus);
}

/* Keep avatar replacement calm while remote media is loading. */
.cc-image-transition {
  opacity: 0;
  transition: opacity 180ms ease, filter 180ms ease;
}

.cc-image-transition.cc-image-ready {
  opacity: 1;
}

.cc-image-transition.cc-image-error {
  filter: saturate(0.92);
}

.layui-form-switch {
  transition: background-color 180ms ease, border-color 180ms ease,
    box-shadow 180ms ease;
}

.layui-form-switch i {
  transition: left 180ms ease, background-color 180ms ease,
    box-shadow 180ms ease;
}

.layui-form-switch em {
  transition: color 180ms ease, opacity 180ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .cc-image-transition,
  .cc-connection-status,
  .cc-connection-status__spinner,
  .cc-send-spinner,
  .cc-message-sending,
  #myMessagesList[data-list-loading="true"]::before,
  #myFriendsList[aria-busy="true"]::before,
  #myRoomList[aria-busy="true"]::before,
  .layui-form-switch,
  .layui-form-switch i,
  .layui-form-switch em {
    transition: none;
  }
}
