/* ============================================
   老兵平台 — 悬浮聊天组件样式 (chat-fab)
   ============================================ */

/* 悬浮按钮 */
.chat-fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c8102e, #e63946);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(200, 16, 46, 0.4);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.chat-fab:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(200, 16, 46, 0.3);
}

.chat-fab .fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffc107;
    color: #333;
    font-size: 10px;
    line-height: 18px;
    text-align: center;
    display: none;
}

/* 聊天面板 */
.chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 160px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: "Microsoft YaHei", sans-serif;
}

.chat-panel.open {
    display: flex;
}

/* 面板头部 */
.chat-panel-header {
    background: linear-gradient(135deg, #c8102e, #a80d26);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-panel-header .chat-title {
    font-size: 16px;
    font-weight: bold;
}

.chat-panel-header .chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* 消息列表 */
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f8f5ee;
}

.search-empty {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 40px 20px;
}

.search-result-count {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.search-result-item {
    display: block;
    text-decoration: none;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: box-shadow 0.15s;
}

.search-result-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-color: #c8102e;
}

.search-result-item .result-title {
    font-size: 15px;
    font-weight: bold;
    color: #c8102e;
    margin-bottom: 4px;
    line-height: 1.4;
}

.search-result-item .result-snippet {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 4px;
}

.search-result-item .result-url {
    font-size: 11px;
    color: #2a7d2a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* 输入区域 */
.chat-input-area {
    display: flex;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    gap: 8px;
}

.chat-input-area input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    background: #f8f5ee;
}

.chat-input-area input:focus {
    border-color: #c8102e;
}

.chat-input-area button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #c8102e;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* 打字指示器 */
.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 6px 14px;
}

.typing-indicator.active {
    display: flex;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c8102e;
    margin: 0 2px;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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


/* 响应式：小屏全宽 */
@media (max-width: 400px) {
    .chat-panel {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        height: 400px;
    }
}

/* 百度查看更多链接 */
.baidu-more-link {
    display: inline-block;
    padding: 8px 20px;
    background: #f0f0f0;
    color: #666;
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    transition: background 0.2s;
}
.baidu-more-link:hover {
    background: #c8102e;
    color: #fff;
}

/* 百度结果底部 */
.baidu-footer {
    text-align: center;
    margin-top: 12px;
    padding: 0 0 8px;
}
.baidu-disclaimer {
    font-size: 11px;
    color: #bbb;
    margin-top: 8px;
    line-height: 1.4;
}
