/* ========================================
   右侧悬浮侧边栏 - 华易文档
   ======================================== */

.floating-sidebar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0;
}

/* ---- 按钮组 ---- */
.floating-btns {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.float-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 28px;
    background: #fff;
    color: #1e40af;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.25s ease;
    position: relative;
    text-decoration: none;
    font-family: inherit;
}

.float-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.2);
    color: #2563eb;
}

.float-btn--phone {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #fff;
}
.float-btn--phone:hover {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
}

.float-btn--chat {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
}
.float-btn--chat:hover {
    background: linear-gradient(135deg, #047857, #059669);
    color: #fff;
}

/* 企业微信按钮 */
.float-btn--wecom {
    background: linear-gradient(135deg, #0b5ca0, #1e88e5);
    color: #fff;
}
.float-btn--wecom:hover {
    background: linear-gradient(135deg, #094a82, #1976d2);
    color: #fff;
}
.float-btn--wecom.active {
    background: linear-gradient(135deg, #094a82, #1565c0);
    box-shadow: 0 2px 16px rgba(11, 92, 160, 0.35);
}

/* 企业微信二维码面板 */
.wecom-qrcode-panel {
    position: absolute;
    right: 68px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    padding: 20px 18px;
    min-width: 200px;
    width: 200px;
    animation: wecomSlideIn 0.25s ease forwards;
    z-index: 10000;
}
.wecom-qrcode-panel.active {
    display: block;
}
@keyframes wecomSlideIn {
    from { opacity: 0; transform: translateY(-50%) translateX(12px) scale(0.92); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
}
.wecom-qrcode-inner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.wecom-qrcode-inner img {
    width: 160px !important;
    height: 160px !important;
    max-width: 160px !important;
    border: 6px solid #f0f7ff;
    border-radius: 10px;
    margin-bottom: 12px;
    display: block;
    object-fit: contain;
    background: #f8fafc;
}
.wecom-qrcode-inner p {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.5;
    white-space: nowrap;
}

.float-btn--top {
    background: #f1f5f9;
    color: #64748b;
    width: 44px;
    height: 44px;
    border-radius: 22px;
}
.float-btn--top:hover {
    background: #e2e8f0;
    color: #334155;
}

.float-btn-label {
    display: none; /* 默认隐藏，hover或展开时显示 */
    position: absolute;
    right: 62px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    background: #fff;
    padding: 5px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.float-btn:hover .float-btn-label {
    display: block;
}

/* ---- 在线咨询面板 ---- */
.chat-panel {
    position: absolute;
    right: 68px;
    top: 0;
    width: 340px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: right center;
    animation: chatSlideIn 0.3s ease forwards;
}

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

@keyframes chatSlideIn {
    from { opacity: 0; transform: translateX(20px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
}

.chat-panel-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-panel-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.chat-panel-close:hover { opacity: 1; }

.chat-panel-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* 欢迎语 */
.chat-welcome {
    margin-bottom: 18px;
    padding: 14px 16px;
    background: #f0fdf4;
    border-left: 3px solid #10b981;
    border-radius: 0 10px 10px 0;
}

.chat-welcome p {
    margin: 0;
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
}

/* 表单 */
.chat-form .form-group {
    margin-bottom: 12px;
}

.chat-form input,
.chat-form textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
    outline: none;
    color: #334155;
    background: #f8fafc;
}

.chat-form input:focus,
.chat-form textarea:focus {
    border-color: #10b981;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.chat-form input::placeholder,
.chat-form textarea::placeholder {
    color: #94a3b8;
}

.chat-form textarea {
    resize: vertical;
    min-height: 72px;
}

/* 提交按钮 */
.chat-submit-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.5px;
}

.chat-submit-btn:hover {
    background: linear-gradient(135deg, #047857, #059669);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.chat-submit-btn:active {
    transform: translateY(0);
}

.chat-submit-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 提交结果 */
.chat-result {
    text-align: center;
    padding: 30px 15px;
}

.chat-result.success .result-icon {
    width: 52px;
    height: 52px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: #16a34a;
    font-size: 26px;
}

.chat-result.error .result-icon {
    width: 52px;
    height: 52px;
    background: #fee2e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: #dc2626;
    font-size: 26px;
}

.chat-result h5 {
    margin: 0 0 6px;
    font-size: 16px;
    color: #1f2937;
}

.chat-result p {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}

/* ---- 响应式 ---- */

/* 平板：缩小间距和尺寸 */
@media (max-width: 1024px) {
    .floating-sidebar {
        right: 12px;
        transform: translateY(-50%) scale(0.95);
    }

    .chat-panel {
        width: 300px;
        max-height: 480px;
        right: 60px;
    }
}

/* 手机端：隐藏侧边栏，改为底部浮动条 */
@media (max-width: 768px) {
    .floating-sidebar {
        position: fixed;
        right: 0;
        bottom: 0;
        top: auto;
        transform: none;
        left: 0;
        z-index: 9999;
        padding: 8px 16px;
        background: #fff;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
        border-top: 1px solid #f1f5f9;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .floating-btns {
        flex-direction: row;
        gap: 0;
        width: 100%;
        justify-content: center;
    }

    .float-btn {
        width: auto;
        height: auto;
        border-radius: 999px;
        padding: 10px 18px;
        flex-direction: row;
        gap: 6px;
    }

    .float-btn-label {
        display: inline-block !important;
        position: static;
        font-size: 13px;
        background: none;
        box-shadow: none;
        padding: 0;
        border-radius: 0;
        color: inherit;
    }

    .float-btn svg {
        flex-shrink: 0;
    }

    /* 手机端面板从底部弹出 */
    .chat-panel {
        position: fixed;
        bottom: 70px;
        left: 10px;
        right: 10px;
        top: auto;
        width: auto;
        max-height: 65vh;
        border-radius: 16px 16px 0 0;
        transform-origin: bottom center;
        right: 10px;
    }

    @keyframes chatSlideIn {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .float-btn--top {
        display: none;
    }

    /* 手机端企业微信二维码面板 */
    .wecom-qrcode-panel {
        position: fixed;
        bottom: 70px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        top: auto;
        padding: 14px;
    }
    @keyframes wecomSlideIn {
        from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.92); }
        to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    }
    .wecom-qrcode-inner img {
        width: 140px !important;
        height: 140px !important;
    }
}
