/* ============================================================
   静白 AI 助手 · 悬浮控件样式
   固定在页面右下角，出现在全站每个页面。
   ============================================================ */

#wangwang-widget {
    position: fixed;
    z-index: 9999;
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- 悬浮按钮（位于返回顶部按钮上方） ---------- */
.wangwang-fab {
    position: fixed;
    right: 24px;
    bottom: 88px;
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 20px rgba(46, 139, 87, 0.35);
    cursor: grab;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease;
    animation: ww-bounce 2.4s ease-in-out infinite;
    touch-action: none;
}
.wangwang-fab.ww-dragging { cursor: grabbing; animation: none; }
.wangwang-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 26px rgba(46, 139, 87, 0.5);
}
.wangwang-fab img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}
.wangwang-fab-tip {
    position: absolute;
    right: 74px;
    bottom: 18px;
    background: #2E8B57;
    color: #fff;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(8px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}
.wangwang-fab-tip::after {
    content: "";
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 0 5px 6px;
    border-style: solid;
    border-color: transparent transparent transparent #2E8B57;
}
.wangwang-fab:hover .wangwang-fab-tip {
    opacity: 1;
    transform: translateX(0);
}
@keyframes ww-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ---------- 对话面板 ---------- */
.wangwang-panel {
    position: fixed;
    right: 24px;
    bottom: 162px;
    width: 366px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 200px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: ww-pop .22s ease;
}
.wangwang-panel.hidden {
    display: none;
}
@keyframes ww-pop {
    from { opacity: 0; transform: scale(.92) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* 头部 */
.wangwang-header {
    background: linear-gradient(135deg, #3CB371 0%, #2E8B57 100%);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.wangwang-header.ww-dragging { cursor: grabbing; }
.wangwang-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    flex: 0 0 auto;
}
.wangwang-header-info { flex: 1 1 auto; line-height: 1.3; }
.wangwang-name {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.wangwang-badge {
    font-size: 11px;
    font-weight: 400;
    background: rgba(255, 255, 255, 0.25);
    padding: 1px 7px;
    border-radius: 10px;
}
.wangwang-status {
    font-size: 12px;
    opacity: 0.92;
    display: flex;
    align-items: center;
    gap: 5px;
}
.wangwang-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7CFC9B;
    box-shadow: 0 0 6px #7CFC9B;
}
.wangwang-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.9;
}
.wangwang-close:hover { opacity: 1; }

/* 消息区 */
.wangwang-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 12px;
    background: #f4f7f6;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ww-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
}
.ww-msg.ww-user {
    flex-direction: row-reverse;
}
.ww-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.ww-bubble {
    max-width: 78%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.ww-bot .ww-bubble {
    background: #fff;
    color: #2c3e35;
    border-top-left-radius: 4px;
}
.ww-user .ww-bubble {
    background: linear-gradient(135deg, #3CB371, #2E8B57);
    color: #fff;
    border-top-right-radius: 4px;
}

/* 正在输入动画 */
.ww-typing {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}
.ww-typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b7c6bf;
    animation: ww-typing 1.2s infinite ease-in-out;
}
.ww-typing i:nth-child(2) { animation-delay: .2s; }
.ww-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes ww-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* 快捷提问气泡 */
.ww-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 12px 8px;
    background: #f4f7f6;
}
.ww-chip {
    font-size: 13px;
    color: #2E8B57;
    background: #fff;
    border: 1px solid #cfe6da;
    border-radius: 14px;
    padding: 5px 11px;
    cursor: pointer;
    transition: background .15s ease;
}
.ww-chip:hover { background: #e7f4ee; }

/* 输入区 */
.wangwang-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eef1f0;
    background: #fff;
}
#wangwang-input {
    flex: 1 1 auto;
    border: 1px solid #dfe6e3;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 15px;
    outline: none;
    transition: border-color .15s ease;
}
#wangwang-input:focus { border-color: #2E8B57; }
#wangwang-send {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #3CB371, #2E8B57);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease;
}
#wangwang-send:hover { transform: scale(1.06); }
#wangwang-send:disabled { opacity: .6; cursor: default; transform: none; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 768px) {
    .wangwang-fab { right: 16px; bottom: 80px; width: 58px; height: 58px; }
    .wangwang-fab img { width: 50px; height: 50px; }
    .wangwang-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 150px;
        height: 70vh;
    }
    .ww-bubble { font-size: 15px; }
}
