/* 暗黑模式规则已迁入 dark-mode-unified.css（原 footer-buttons.css） */
/**
 * ========================================
 * 🎨 浮动功能按钮样式 - 简约设计
 * 🚀 性能优化版本
 * ========================================
 * 包含: 回到顶部、暗黑模式、在线客服
 * 组件: templates/china/components/floating_buttons.html
 * 更新日期: 2026-02-03
 */

/* ========================================
   📦 浮动按钮容器 - 右侧垂直居中
   ElevenLabs 风格：极简、微妙 🚀 性能优化
   ======================================== */
.floating-buttons {
    position: fixed;
    right: 24px; /* 预留滚动条空间，避免覆盖 */
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    
    /* 玻璃质感条：比纯白块 + 重描边更耐看 */
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50px;
    padding: 7px 0;
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid rgba(15, 23, 42, 0.09);
    border-radius: 26px;
    box-shadow:
        0 4px 24px rgba(15, 23, 42, 0.07),
        0 1px 2px rgba(15, 23, 42, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
    transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
    
    cursor: grab;
    user-select: none;
    contain: layout style;
}

.floating-buttons:hover {
    border-color: rgba(15, 23, 42, 0.11);
    box-shadow:
        0 8px 28px rgba(15, 23, 42, 0.1),
        0 2px 6px rgba(15, 23, 42, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.floating-buttons:active {
    cursor: grabbing;
}

/* ========================================
   🎯 按钮基础样式 - ElevenLabs 极简设计 🚀 性能优化
   ======================================== */
.floating-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 🚀 性能优化：明确指定过渡属性 */
    transition: background-color 0.15s ease, transform 0.15s ease;
    position: relative;
}

.floating-btn:hover {
    background: rgba(15, 23, 42, 0.05);
}

.floating-btn:active {
    transform: scale(0.92);
}

.floating-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

/* 图标：默认中性灰，悬停加深 */
.floating-btn svg {
    width: 20px;
    height: 20px;
    stroke: #64748b;
    stroke-width: 1.65;
    fill: none;
    transition: stroke 0.18s ease, filter 0.18s ease, transform 0.18s ease;
}

.floating-btn:hover svg {
    stroke: #334155;
}

/* ========================================
   ⬆️ 回到顶部按钮 - 丝滑动画
   ======================================== */
#btn-top {
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: height 0.25s ease, opacity 0.25s ease, overflow 0s 0.25s;
}

#btn-top.show {
    height: 42px;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
    transition: height 0.25s ease, opacity 0.25s ease, overflow 0s 0s;
}

/* ========================================
   明暗主题按钮（月亮 ⇄ 太阳）：用色克制，避免高饱和紫渐变显廉价
   ======================================== */
#btn-dark.floating-btn-theme {
    color: #475569;
}

#btn-dark.floating-btn-theme svg {
    stroke: currentColor;
}

#btn-dark.floating-btn-theme:hover {
    color: #4f46e5;
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.04) 100%);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.14);
}

#btn-dark.floating-btn-theme:hover svg {
    filter: drop-shadow(0 1px 2px rgba(79, 70, 229, 0.15));
}

#btn-dark .icon-sun {
    display: none;
}


/* ========================================
   💬 在线客服按钮
   ======================================== */
#btn-chat svg {
    stroke: #2196f3;
}

#btn-chat:hover svg {
    stroke: #1976d2;
}

/* 通知红点 */
.notification-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    background: #ff4757;
    border-radius: 8px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fbfbfb;
    box-shadow: 0 2px 6px rgba(255, 71, 87, 0.4);
}

.notification-dot.show {
    display: flex;
    animation: notificationPulse 2s ease-in-out infinite;
    /* 🚀 性能优化：GPU 加速 */
    will-change: transform;
}

/* 🚀 性能优化：使用 scale3d 触发 GPU 加速 */
@keyframes notificationPulse {
    0%, 100% { transform: scale3d(1, 1, 1); }
    50% { transform: scale3d(1.1, 1.1, 1); }
}


/* ========================================
   💬 悬浮提示 - 简约设计
   ======================================== */
.floating-tooltip {
    position: absolute;
    right: 62px;
    top: 50%;
    transform: translateY(-50%);
    
    /* 简约背景 */
    background: #333;
    
    /* 文字样式 */
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    
    /* 阴影 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    
    /* 动画 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.floating-tooltip::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-left-color: #333;
}

.floating-btn:hover .floating-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   🌙 深色模式适配 - ElevenLabs 风格
   ======================================== */












/* ========================================
   📱 移动端适配 - 底部水平居中
   ElevenLabs 风格
   🔧 修复：增加底部安全距离，避免被微信等App内置浏览器的导航栏遮挡
   ======================================== */
@media (max-width: 768px) {
    .floating-buttons {
        /* 右下角固定，上下排列 */
        right: 12px;
        left: auto;
        top: auto;
        bottom: 80px;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        transform: none;

        /* 竖向排列（与桌面端一致） */
        flex-direction: column;
        width: 44px;
        padding: 6px 0;
        border-radius: 22px;
        gap: 2px;
    }
    
    .floating-btn {
        width: 38px;
        height: 38px;
    }
    
    .floating-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .floating-tooltip {
        display: none;
    }
    
    /* 移动端回到顶部按钮：隐藏时高度收起 */
    #btn-top {
        width: 38px;
        height: 0;
        overflow: hidden;
        transition: height 0.2s ease, opacity 0.2s ease;
    }
    
    #btn-top.show {
        width: 38px;
        height: 38px;
    }
}

/* 小屏手机优化 */
@media (max-width: 480px) {
    .floating-buttons {
        right: 10px;
        bottom: 72px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        width: 40px;
        padding: 5px 0;
        border-radius: 20px;
    }
    
    .floating-btn {
        width: 34px;
        height: 34px;
    }
    
    .floating-btn svg {
        width: 18px;
        height: 18px;
    }
    
    #btn-top {
        width: 34px;
        height: 0;
    }
    
    #btn-top.show {
        width: 34px;
        height: 34px;
    }
}

/* ========================================
   🚀 性能优化：尊重用户动画偏好
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .floating-buttons,
    .floating-btn,
    .floating-btn svg,
    #btn-top,
    .floating-tooltip {
        transition: none;
    }
    
    .floating-btn:active {
        transform: none;
    }
    
    .notification-dot.show {
        animation: none;
    }
}
