/* =========================================================
   华医通荟 - 全站AI智能客服悬浮组件
   深色主题 · 蓝色#004098 · 深灰#142C4F · 金色描边
   ========================================================= */

/* ---------- 悬浮按钮 ---------- */
.ycq-kefu-float-btn {
    position: fixed;
    right: 20px;
    bottom: 30px;
    z-index: 99999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #004098 0%, #0057B7 50%, #0070D1 100%);
    border: 2px solid #D4A853;
    box-shadow: 0 4px 20px rgba(0, 64, 152, 0.4), 0 0 0 1px rgba(212,168,83,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    /* 悬浮立体感 */
    transform: perspective(800px) rotateX(0deg);
}

.ycq-kefu-float-btn:hover {
    transform: perspective(800px) rotateX(-5deg) translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 64, 152, 0.5), 0 0 0 2px rgba(212,168,83,0.4);
    background: linear-gradient(135deg, #0057B7 0%, #006FD6 50%, #0088E8 100%);
}

.ycq-kefu-float-btn:active {
    transform: perspective(800px) rotateX(0deg) scale(0.95);
}

/* 头像图标 */
.ycq-kefu-float-btn .kefu-icon {
    width: 28px;
    height: 28px;
    fill: #D4A853;
    transition: fill 0.3s;
}

.ycq-kefu-float-btn:hover .kefu-icon {
    fill: #E8C87A;
}

/* 未读消息红点 */
.ycq-kefu-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #E53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #0A1628;
    animation: kefu-pulse 2s infinite;
    display: none;
}

.ycq-kefu-badge.show {
    display: flex;
}

@keyframes kefu-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 在线状态指示 */
.ycq-kefu-online {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4CAF50;
    border: 2px solid #0A1628;
}

/* ---------- 弹窗主体 ---------- */
.ycq-kefu-popup {
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 99998;
    width: 380px;
    height: 560px;
    border-radius: 16px;
    background: linear-gradient(180deg, #0D1F35 0%, #0A1628 100%);
    border: 2px solid #D4A853;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,168,83,0.1), inset 0 1px 0 rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0.8);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ycq-kefu-popup.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* ---------- 头部 ---------- */
.ycq-kefu-header {
    padding: 16px 20px;
    background: linear-gradient(90deg, #004098 0%, #0057B7 100%);
    border-bottom: 1px solid rgba(212,168,83,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ycq-kefu-header .kefu-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 2px solid #D4A853;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ycq-kefu-header .kefu-avatar svg {
    width: 22px;
    height: 22px;
    fill: #D4A853;
}

.ycq-kefu-header .kefu-info {
    flex: 1;
    min-width: 0;
}

.ycq-kefu-header .kefu-title {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ycq-kefu-header .kefu-status {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ycq-kefu-header .kefu-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4CAF50;
    animation: kefu-blink 1.5s infinite;
}

@keyframes kefu-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.ycq-kefu-header .kefu-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.ycq-kefu-header .kefu-close:hover {
    background: rgba(255,255,255,0.2);
}

.ycq-kefu-header .kefu-close svg {
    width: 16px;
    height: 16px;
    fill: rgba(255,255,255,0.8);
}

/* ---------- 消息区域 ---------- */
.ycq-kefu-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.ycq-kefu-body::-webkit-scrollbar {
    width: 4px;
}

.ycq-kefu-body::-webkit-scrollbar-track {
    background: transparent;
}

.ycq-kefu-body::-webkit-scrollbar-thumb {
    background: rgba(212,168,83,0.3);
    border-radius: 2px;
}

/* 消息气泡 */
.ycq-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: msg-in 0.3s ease;
}

@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ycq-msg.bot {
    align-self: flex-start;
}

.ycq-msg.visitor {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ycq-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #004098, #0057B7);
    border: 1px solid rgba(212,168,83,0.5);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
}

.ycq-msg.visitor .ycq-msg-avatar {
    background: linear-gradient(135deg, #142C4F, #1A3A60);
    border-color: rgba(212,168,83,0.3);
}

.ycq-msg-avatar svg {
    width: 14px;
    height: 14px;
    fill: #D4A853;
}

.ycq-msg-content {
    background: rgba(20, 44, 79, 0.6);
    border: 1px solid rgba(212,168,83,0.2);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255,255,255,0.9);
    word-break: break-all;
}

.ycq-msg.visitor .ycq-msg-content {
    background: linear-gradient(135deg, rgba(0,64,152,0.6), rgba(0,87,183,0.6));
    border-color: rgba(212,168,83,0.4);
}

.ycq-msg.system .ycq-msg-content {
    background: rgba(0,0,0,0.2);
    border-color: rgba(212,168,83,0.15);
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    text-align: center;
    border-radius: 20px;
    padding: 6px 12px;
}

.ycq-msg-time {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
    padding: 0 4px;
}

.ycq-msg.visitor .ycq-msg-time {
    text-align: right;
}

/* 快捷问题按钮 */
.ycq-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.ycq-quick-btn {
    padding: 6px 12px;
    border-radius: 16px;
    background: rgba(0,64,152,0.3);
    border: 1px solid rgba(212,168,83,0.4);
    color: #D4A853;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.ycq-quick-btn:hover {
    background: rgba(0,64,152,0.5);
    border-color: #D4A853;
    transform: translateY(-1px);
}

/* ---------- 底部输入区 ---------- */
.ycq-kefu-footer {
    padding: 12px 16px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(212,168,83,0.15);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

.ycq-kefu-input {
    flex: 1;
    background: rgba(20, 44, 79, 0.5);
    border: 1px solid rgba(212,168,83,0.3);
    border-radius: 20px;
    padding: 10px 16px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    max-height: 80px;
    min-height: 40px;
    line-height: 1.4;
    font-family: inherit;
}

.ycq-kefu-input::placeholder {
    color: rgba(255,255,255,0.35);
}

.ycq-kefu-input:focus {
    border-color: #D4A853;
    box-shadow: 0 0 0 2px rgba(212,168,83,0.15);
}

.ycq-kefu-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D4A853, #C4943D);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.ycq-kefu-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(212,168,83,0.4);
}

.ycq-kefu-send:active {
    transform: scale(0.95);
}

.ycq-kefu-send svg {
    width: 18px;
    height: 18px;
    fill: #0A1628;
}

/* 转人工按钮 */
.ycq-kefu-transfer {
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(212,168,83,0.15);
    border: 1px solid rgba(212,168,83,0.4);
    color: #D4A853;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
}

.ycq-kefu-transfer:hover {
    background: rgba(212,168,83,0.25);
}

/* Typing 指示器 */
.ycq-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
    background: rgba(20, 44, 79, 0.6);
    border: 1px solid rgba(212,168,83,0.2);
    border-radius: 12px;
    width: fit-content;
}

.ycq-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #D4A853;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.ycq-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ycq-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.ycq-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---------- FAQ展开面板 ---------- */
.ycq-kefu-faq {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 16px;
    background: rgba(0,0,0,0.15);
    border-top: 1px solid rgba(212,168,83,0.1);
    display: none;
}

.ycq-kefu-faq.open {
    display: block;
}

.ycq-faq-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(212,168,83,0.08);
}

.ycq-faq-item:last-child {
    border-bottom: none;
}

.ycq-faq-q {
    color: #D4A853;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.ycq-faq-q:hover {
    color: #E8C87A;
}

.ycq-faq-q::before {
    content: 'Q';
    font-weight: 700;
    font-size: 10px;
    background: rgba(212,168,83,0.2);
    padding: 1px 5px;
    border-radius: 4px;
    flex-shrink: 0;
}

.ycq-faq-a {
    color: rgba(255,255,255,0.65);
    font-size: 12px;
    line-height: 1.5;
    margin-top: 4px;
    padding-left: 16px;
    display: none;
}

.ycq-faq-item.open .ycq-faq-a {
    display: block;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 480px) {
    .ycq-kefu-popup {
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 85vh;
        border-radius: 16px 16px 0 0;
    }

    .ycq-kefu-float-btn {
        right: 16px;
        bottom: 20px;
        width: 50px;
        height: 50px;
    }

    .ycq-msg {
        max-width: 92%;
    }
}
