/**
 * WhatsApp/LINE客服分流插件 - 样式表
 * 设计原则：高转化率 + Google Ads合规
 * - 不使用欺骗性UI（如假通知、假消息数）
 * - 使用标准的客服组件视觉语言
 * - GPU加速动画确保流畅
 */

:root {
    --wlkf-primary: #25D366;
    --wlkf-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    --wlkf-shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.2);
    --wlkf-radius: 16px;
    --wlkf-transition: cubic-bezier(0.32, 0.72, 0, 1);
}

.wlkf-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.wlkf-right-bottom { right: 20px; bottom: 20px; }
.wlkf-left-bottom { left: 20px; bottom: 20px; }

.wlkf-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--wlkf-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--wlkf-shadow);
    position: relative;
    transition: transform 0.3s var(--wlkf-transition), box-shadow 0.3s ease;
    transform: translateZ(0) scale(0);
    animation: wlkf-fab-enter 0.5s var(--wlkf-transition) 0.1s forwards;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

@keyframes wlkf-fab-enter {
    from { transform: translateZ(0) scale(0); }
    to { transform: translateZ(0) scale(1); }
}

.wlkf-fab:hover {
    transform: translateZ(0) scale(1.08);
    box-shadow: var(--wlkf-shadow-lg);
}

.wlkf-fab:active {
    transform: translateZ(0) scale(0.95);
}

.wlkf-fab-icon {
    width: 28px;
    height: 28px;
    position: absolute;
    transition: transform 0.4s var(--wlkf-transition), opacity 0.3s ease;
}

.wlkf-fab-icon svg {
    width: 100%;
    height: 100%;
    fill: #fff;
}

.wlkf-fab-icon-chat {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.wlkf-fab-icon-close {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.wlkf-open .wlkf-fab-icon-chat {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

.wlkf-open .wlkf-fab-icon-close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.wlkf-greeting {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 280px;
    background: #fff;
    border-radius: var(--wlkf-radius);
    box-shadow: var(--wlkf-shadow-lg);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    opacity: 0;
    transform: translateZ(0) translateY(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s var(--wlkf-transition);
    cursor: pointer;
}

.wlkf-left-bottom .wlkf-greeting {
    right: auto;
    left: 0;
}

.wlkf-greeting-show {
    opacity: 1;
    transform: translateZ(0) translateY(0) scale(1);
    pointer-events: auto;
}

.wlkf-greeting-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.wlkf-greeting-close:hover { opacity: 1; }
.wlkf-greeting-close svg { width: 100%; height: 100%; fill: #666; }

.wlkf-greeting-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--wlkf-primary);
    flex-shrink: 0;
    position: relative;
}

.wlkf-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    border: 2px solid #fff;
}

.wlkf-greeting-body { flex: 1; min-width: 0; }

.wlkf-greeting-name {
    font-size: 12px;
    color: #4caf50;
    font-weight: 600;
    margin-bottom: 4px;
}

.wlkf-greeting-text {
    font-size: 14px;
    color: #333;
    word-wrap: break-word;
}

.wlkf-panel {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: var(--wlkf-radius);
    box-shadow: var(--wlkf-shadow-lg);
    overflow: hidden;
    opacity: 0;
    transform: translateZ(0) translateY(20px) scale(0.9);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.4s var(--wlkf-transition);
    transform-origin: bottom right;
}

.wlkf-left-bottom .wlkf-panel {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.wlkf-open .wlkf-panel {
    opacity: 1;
    transform: translateZ(0) translateY(0) scale(1);
    pointer-events: auto;
}

.wlkf-panel-header {
    background: var(--wlkf-primary);
    color: #fff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wlkf-panel-title {
    font-size: 15px;
    font-weight: 600;
}

.wlkf-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.wlkf-panel-close:hover { opacity: 1; }
.wlkf-panel-close svg { width: 100%; height: 100%; fill: #fff; }

.wlkf-panel-body {
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.wlkf-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    gap: 14px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.wlkf-item:hover { background: #f5f5f5; }
.wlkf-item:active { transform: scale(0.98); background: #eeeeee; }

.wlkf-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wlkf-item-icon svg { width: 22px; height: 22px; }

.wlkf-item-whatsapp .wlkf-item-icon { background: #e8f8ee; }
.wlkf-item-whatsapp .wlkf-item-icon svg { fill: #25D366; }
.wlkf-item-line .wlkf-item-icon { background: #e8f5e9; }
.wlkf-item-line .wlkf-item-icon svg { fill: #00B900; }
.wlkf-item-custom .wlkf-item-icon { background: #e3f2fd; }
.wlkf-item-custom .wlkf-item-icon svg { fill: #1976d2; }

.wlkf-item-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.wlkf-item-arrow {
    font-size: 18px;
    color: #bbb;
    transition: transform 0.2s;
}

.wlkf-item:hover .wlkf-item-arrow { transform: translateX(3px); }

.wlkf-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wlkf-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999998;
    background: #fff;
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.1);
    transform: translateZ(0) translateY(100%);
    animation: wlkf-bar-enter 0.4s var(--wlkf-transition) 0.1s forwards;
}

@keyframes wlkf-bar-enter {
    to { transform: translateZ(0) translateY(0); }
}

.wlkf-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.wlkf-bar-item:hover { background: #f5f5f5; }
.wlkf-bar-item:active { background: #eee; }

.wlkf-bar-icon { width: 24px; height: 24px; }
.wlkf-bar-icon svg { width: 100%; height: 100%; }
.wlkf-bar-whatsapp .wlkf-bar-icon svg { fill: #25D366; }
.wlkf-bar-line .wlkf-bar-icon svg { fill: #00B900; }
.wlkf-bar-custom .wlkf-bar-icon svg { fill: #1976d2; }

.wlkf-bar-label {
    font-size: 11px;
    color: #555;
    font-weight: 500;
}

@media (max-width: 768px) {
    .wlkf-container { right: 16px; bottom: 80px; }
    .wlkf-left-bottom { left: 16px; right: auto; }

    .wlkf-fab { width: 56px; height: 56px; }
    .wlkf-fab-icon { width: 26px; height: 26px; }

    .wlkf-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: var(--wlkf-radius) var(--wlkf-radius) 0 0;
        transform: translateZ(0) translateY(100%);
        transform-origin: bottom center;
        max-height: 70vh;
    }

    .wlkf-open .wlkf-panel {
        transform: translateZ(0) translateY(0);
    }

    .wlkf-open .wlkf-overlay {
        display: block;
        opacity: 1;
    }

    .wlkf-greeting {
        width: calc(100vw - 90px);
        max-width: 280px;
    }
}

@media (hover: hover) {
    .wlkf-fab:hover {
        transform: translateZ(0) scale(1.08);
    }
}
