/* ============================================================
   用户端样式（浮动窗口 user-float.js + 全屏页 chat-full.html）
   ============================================================ */

/* ============ 一、浮动窗口 ============ */
.cf-float-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99998;
  font-family: var(--cf-font);
}

/* 浮动按钮 */
.cf-float-btn {
  position: relative;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cf-accent), var(--cf-accent-hover));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--cf-shadow-float-btn);
  transition: transform var(--cf-fast), box-shadow var(--cf-fast);
}
.cf-float-btn:hover { transform: translateY(-3px) scale(1.05); }
.cf-float-btn:active { transform: scale(.96); }
.cf-float-btn svg { width: 27px; height: 27px; }

/* 脉冲光环 */
.cf-float-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(249, 115, 22, .55);
  animation: cfPulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes cfPulse {
  0% { transform: scale(1); opacity: 1; }
  70%, 100% { transform: scale(1.55); opacity: 0; }
}

.cf-float-btn .cf-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  animation: cfBadgeIn .3s var(--cf-ease);
}
@keyframes cfBadgeIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* 聊天窗口 */
.cf-float-win {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 380px;
  height: 540px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 110px);
  max-height: calc(100dvh - 110px);
  background: var(--cf-surface);
  border-radius: var(--cf-radius-l);
  box-shadow: var(--cf-shadow-pop);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity var(--cf-normal), transform var(--cf-normal);
}
.cf-float-win--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 头部 */
.cf-chat-head {
  flex-shrink: 0;
  background: linear-gradient(120deg, var(--cf-ink-900), var(--cf-ink-700));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.cf-chat-head__icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--cf-accent), #fbbf24);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cf-chat-head__icon svg { width: 21px; height: 21px; color: #fff; }
.cf-chat-head__info { flex: 1; min-width: 0; }
.cf-chat-head__title { font-size: 15px; font-weight: 600; letter-spacing: .03em; }
.cf-chat-head__sub { margin-top: 3px; display: flex; align-items: center; }
.cf-chat-head__actions { display: flex; gap: 4px; }
.cf-head-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--cf-radius-s);
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--cf-fast), color var(--cf-fast);
}
.cf-head-btn:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.cf-head-btn svg { width: 15px; height: 15px; }

/* 消息区背景 */
.cf-float-win .cf-messages,
.cf-fullpage-card .cf-messages {
  background:
    radial-gradient(600px 240px at 90% 0%, rgba(249, 115, 22, .05), transparent 60%),
    var(--cf-bg);
}

/* 会话已结束提示 */
.cf-closed-bar {
  flex-shrink: 0;
  padding: 9px 14px;
  background: #fff8e6;
  color: #92600a;
  font-size: 12.5px;
  text-align: center;
  border-top: 1px solid #f5e3b3;
}

/* 未登录引导 */
.cf-login-guide {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px;
  text-align: center;
  color: var(--cf-text-sub);
  font-size: 14px;
  line-height: 1.8;
}
.cf-login-guide__icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--cf-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.cf-login-btn {
  height: 40px;
  padding: 0 28px;
  border: none;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--cf-accent), var(--cf-accent-hover));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--cf-font);
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(249, 115, 22, .35);
  transition: transform var(--cf-fast);
}
.cf-login-btn:hover { transform: translateY(-1px); }

/* 浮动窗口 - 移动端 */
@media (max-width: 480px) {
  .cf-float-root { right: 14px; bottom: 14px; }
  .cf-float-win {
    position: fixed;
    right: 8px;
    left: 8px;
    bottom: 8px;
    top: 8px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    transform-origin: bottom center;
  }
  .cf-float-btn { width: 54px; height: 54px; }
}

/* ============ 二、全屏独立页 ============ */
.cf-fullpage {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(249, 115, 22, .14), transparent 55%),
    radial-gradient(800px 500px at 95% 110%, rgba(99, 102, 241, .12), transparent 55%),
    linear-gradient(160deg, #f4f3ef, #ecebe6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  font-family: var(--cf-font);
}
.cf-fullpage-card {
  width: 880px;
  max-width: 100%;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  max-height: 820px;
  background: var(--cf-surface);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(22, 26, 36, .16), 0 2px 8px rgba(22, 26, 36, .06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cfCardIn .45s var(--cf-ease);
}
@keyframes cfCardIn {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cf-fullpage-card .cf-chat-head { padding: 16px 22px; }
.cf-fullpage-card .cf-chat-head__icon { width: 44px; height: 44px; border-radius: 13px; }
.cf-fullpage-card .cf-chat-head__title { font-size: 17px; }

.cf-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, .8);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 13px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .1);
  transition: background var(--cf-fast), color var(--cf-fast);
}
.cf-back-link:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.cf-back-link svg { width: 14px; height: 14px; }

.cf-fullpage-card .cf-messages { padding: 26px 32px 14px; }
.cf-fullpage-card .cf-msg-body { max-width: 62%; }
.cf-fullpage-card .cf-input-area { padding: 12px 26px 18px; }
.cf-fullpage-card .cf-textarea { min-height: 46px; }
.cf-fullpage-card .cf-send-btn { height: 46px; padding: 0 30px; font-size: 15px; }
.cf-fullpage-card .cf-bubble--image img { max-width: 280px; max-height: 300px; }

/* 全屏页 - 移动端 */
@media (max-width: 640px) {
  .cf-fullpage { padding: 0; align-items: stretch; }
  .cf-fullpage-card {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    animation: none;
  }
  .cf-fullpage-card .cf-messages { padding: 16px 14px 10px; }
  .cf-fullpage-card .cf-msg-body { max-width: 78%; }
  .cf-fullpage-card .cf-input-area {
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  }
  .cf-back-link span { display: none; }
}

/* ============ 三、加载更多历史消息 ============ */
.cf-load-more {
  text-align: center;
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--cf-text-sub);
  cursor: pointer;
  user-select: none;
  transition: color var(--cf-fast);
}
.cf-load-more:hover {
  color: var(--cf-accent);
}

/* 顶部加载指示器（旋转 spinner） */
.cf-load-top {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
}
