/* ============================================================
   零源机构 · 悬浮反馈组件
   右下角圆形耳机按钮 + 对话弹窗
   ============================================================ */

/* 悬浮按钮 */
.fw-widget-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b9d, #c44df5);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 6px 24px rgba(196,77,255,0.4);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fw-widget-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 10px 36px rgba(196,77,255,0.55);
}

.fw-widget-btn.pulse::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(196,77,255,0.4);
    animation: fwPulse 2s ease-out infinite;
}

@keyframes fwPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* 弹窗遮罩 */
.fw-widget-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s ease;
    background: rgba(30,20,60,0.3);
    backdrop-filter: blur(6px);
}

.fw-widget-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 弹窗容器 */
.fw-widget-panel {
    position: absolute;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 140px);
    border-radius: 28px 28px 28px 28px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(28px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 20px 60px rgba(30,20,60,0.3);
    transform: translateY(30px) scale(0.9);
    transform-origin: bottom right;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fw-widget-overlay.active .fw-widget-panel {
    transform: translateY(0) scale(1);
}

/* 弹窗头部 */
.fw-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.4);
    flex-shrink: 0;
}

.fw-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b9d, #c44df5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(196,77,255,0.3);
}

.fw-chat-info { flex: 1; }

.fw-chat-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a1a2e;
}

.fw-chat-status {
    font-size: 0.72rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.fw-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 6px #2ecc71;
    animation: fwStatusPulse 2s ease-in-out infinite;
}

@keyframes fwStatusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.fw-chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.5);
    color: #666;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    line-height: 1;
}

.fw-chat-close:hover {
    background: #ff6b9d;
    color: #fff;
    border-color: transparent;
    transform: rotate(90deg);
}

/* 消息列表 */
.fw-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.fw-chat-messages::-webkit-scrollbar { width: 4px; }
.fw-chat-messages::-webkit-scrollbar-track { background: transparent; }
.fw-chat-messages::-webkit-scrollbar-thumb { background: rgba(196,77,255,0.2); border-radius: 2px; }

/* 消息通用 */
.fw-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: fwMsgIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fwMsgIn {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 助手消息 */
.fw-message.fw-bot {
    align-self: flex-start;
}

.fw-message.fw-bot .fw-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b9d, #c44df5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.fw-message.fw-bot .fw-msg-bubble {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 6px 16px 16px 16px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #1a1a2e;
    line-height: 1.7;
    box-shadow: 0 2px 10px rgba(120,80,200,0.08);
}

/* 用户消息 */
.fw-message.fw-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.fw-message.fw-user .fw-msg-bubble {
    background: linear-gradient(135deg, #ff6b9d, #c44df5);
    color: #fff;
    border-radius: 16px 6px 16px 16px;
    padding: 10px 14px;
    font-size: 0.85rem;
    line-height: 1.7;
    box-shadow: 0 2px 10px rgba(196,77,255,0.25);
}

/* 打字动画 */
.fw-typing {
    display: flex;
    gap: 4px;
    padding: 2px 0;
}

.fw-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c44df5;
    opacity: 0.4;
    animation: fwTypingBounce 1.2s ease-in-out infinite;
}

.fw-typing span:nth-child(2) { animation-delay: 0.15s; }
.fw-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes fwTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* 快捷回复 */
.fw-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 10px;
}

.fw-quick-replies:empty { display: none; }

.fw-quick-btn {
    padding: 6px 14px;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 16px 24px 18px 26px;
    font-size: 0.78rem;
    color: #555;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.fw-quick-btn:hover {
    background: linear-gradient(135deg, #ff6b9d, #c44df5);
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(196,77,255,0.25);
}

/* 输入区域 */
.fw-input-area {
    padding: 12px 16px 14px;
    background: rgba(255,255,255,0.3);
    border-top: 1px solid rgba(255,255,255,0.4);
    flex-shrink: 0;
}

.fw-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.fw-chat-input {
    flex: 1;
    padding: 10px 16px;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 20px 28px 22px 30px;
    font-size: 0.85rem;
    color: #1a1a2e;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.fw-chat-input::placeholder { color: #999; }

.fw-chat-input:focus {
    border-color: #c44df5;
    background: rgba(255,255,255,0.8);
    box-shadow: 0 0 0 3px rgba(196,77,255,0.1);
}

.fw-chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fw-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff6b9d, #c44df5);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(196,77,255,0.3);
}

.fw-send-btn:hover:not(:disabled) {
    transform: scale(1.08) rotate(-10deg);
}

.fw-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
