/* ============================================================
 * i8HOME-Next 在线客服悬浮窗
 * 所有类名前缀 i8-service-，避免与主题样式冲突
 * ============================================================ */

.i8-service {
    position: fixed;
    z-index: 9990;
    font-family: system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
    box-sizing: border-box;
}

.i8-service * {
    box-sizing: border-box;
}

/* ============ 位置 ============ */

.i8-service[data-position="right-bottom"] {
    right: 20px;
    bottom: 20px;
}

.i8-service[data-position="left-bottom"] {
    left: 20px;
    bottom: 20px;
}

.i8-service[data-position="right-middle"] {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.i8-service[data-position="left-middle"] {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* ============ 悬浮按钮 ============ */

.i8-service-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0a7a35;
    color: #fff;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(10, 122, 53, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    padding: 0;
    outline: none;
}

.i8-service-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(10, 122, 53, 0.45);
}

.i8-service-btn svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
    display: block;
}

/* 呼吸动画（未打开面板时，吸引注意力） */
.i8-service-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(10, 122, 53, 0.4);
    animation: i8-service-pulse 2s infinite;
    pointer-events: none;
}

.i8-service.is-open .i8-service-btn::after {
    display: none;
}

@keyframes i8-service-pulse {
    0%   { transform: scale(1);    opacity: 0.7; }
    70%  { transform: scale(1.25); opacity: 0;   }
    100% { transform: scale(1.25); opacity: 0;   }
}

/* ============ 面板 ============ */

.i8-service-panel {
    position: absolute;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    pointer-events: none;
}

.i8-service.is-open .i8-service-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* 面板位置：底部锚点时在按钮上方 */
.i8-service[data-position="right-bottom"] .i8-service-panel,
.i8-service[data-position="left-bottom"] .i8-service-panel {
    bottom: 72px;
}

.i8-service[data-position="right-bottom"] .i8-service-panel,
.i8-service[data-position="right-middle"] .i8-service-panel {
    right: 0;
}

.i8-service[data-position="left-bottom"] .i8-service-panel,
.i8-service[data-position="left-middle"] .i8-service-panel {
    left: 0;
}

.i8-service[data-position="right-middle"] .i8-service-panel,
.i8-service[data-position="left-middle"] .i8-service-panel {
    top: 50%;
    transform: translateY(calc(-50% + 12px));
}

.i8-service.is-open[data-position="right-middle"] .i8-service-panel,
.i8-service.is-open[data-position="left-middle"] .i8-service-panel {
    transform: translateY(-50%);
}

/* ============ 面板头部 ============ */

.i8-service-header {
    background: linear-gradient(135deg, #0a7a35 0%, #0f9d4a 100%);
    color: #fff;
    padding: 18px 20px;
    position: relative;
}

.i8-service-header h4 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.i8-service-welcome {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.9;
}

.i8-service-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 0;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}

.i8-service-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============ 面板主体 ============ */

.i8-service-body {
    padding: 16px 20px 20px;
    max-height: 420px;
    overflow-y: auto;
}

.i8-service-body::-webkit-scrollbar {
    width: 4px;
}

.i8-service-body::-webkit-scrollbar-thumb {
    background: #dcdcdc;
    border-radius: 2px;
}

/* 二维码区块 */
.i8-service-qr {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.i8-service-qr img {
    width: 160px;
    height: 160px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 0 auto 8px;
    background: #fafbfc;
    padding: 6px;
    border: 1px solid #f0f0f0;
}

.i8-service-qr-text {
    font-size: 12px;
    color: #999;
    margin: 0;
}

/* 信息列表 */
.i8-service-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.i8-service-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

.i8-service-item:last-child {
    border-bottom: 0;
}

.i8-service-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    color: #0a7a35;
    margin-top: 1px;
}

.i8-service-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: block;
}

.i8-service-content {
    flex: 1;
    min-width: 0;
}

.i8-service-label {
    font-size: 12px;
    color: #999;
    display: block;
    margin-bottom: 2px;
    line-height: 1.3;
}

.i8-service-value {
    font-size: 14px;
    color: #222;
    line-height: 1.5;
    word-break: break-word;
    text-decoration: none;
    display: block;
}

.i8-service-value.is-link {
    color: #0a7a35;
    cursor: pointer;
    transition: color 0.15s;
}

.i8-service-value.is-link:hover {
    text-decoration: underline;
}

/* 复制按钮 */
.i8-service-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #0a7a35;
    background: #eafaf0;
    border: 1px solid #c4e7d0;
    border-radius: 4px;
    padding: 2px 8px;
    margin-left: 6px;
    cursor: pointer;
    transition: all 0.15s;
    vertical-align: middle;
}

.i8-service-copy:hover {
    background: #d8f2e2;
}

.i8-service-copy.is-copied {
    background: #0a7a35;
    border-color: #0a7a35;
    color: #fff;
}

/* 工作时间 */
.i8-service-worktime {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #f0f0f0;
    font-size: 12px;
    color: #999;
    text-align: center;
    line-height: 1.6;
}

/* ============ 移动端 ============ */

@media (max-width: 640px) {
    .i8-service[data-position="right-bottom"],
    .i8-service[data-position="right-middle"] {
        right: 14px;
    }

    .i8-service[data-position="left-bottom"],
    .i8-service[data-position="left-middle"] {
        left: 14px;
    }

    .i8-service[data-position="right-bottom"],
    .i8-service[data-position="left-bottom"] {
        bottom: 14px;
    }

    .i8-service-btn {
        width: 48px;
        height: 48px;
    }

    .i8-service-btn svg {
        width: 22px;
        height: 22px;
    }

    .i8-service-panel {
        width: calc(100vw - 28px);
        max-width: 340px;
    }

    .i8-service[data-position="right-bottom"] .i8-service-panel,
    .i8-service[data-position="left-bottom"] .i8-service-panel {
        bottom: 62px;
    }

    .i8-service-body {
        max-height: 60vh;
    }
}