/**
 * ============================================================================
 * vmsSwitchBtn.css - 视频模式切换按钮样式 v5.2
 * 新增：返回顶部按钮样式及联动动画
 * ============================================================================
 */

/* ... (保留原有 root 变量) ... */
:root {
    --vms-card-bg-light: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --vms-card-text-light: #ffffff;
    --vms-card-shadow-light: 0 10px 40px rgba(102, 126, 234, 0.4);
    
    --vms-card-bg-dark: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --vms-card-text-dark: #ffffff;
    --vms-card-shadow-dark: 0 10px 40px rgba(79, 70, 229, 0.5);
}

/* ============================================
   按钮容器 & 定位 (增加过渡效果以支持联动)
   ============================================ */
.vms-fab {
    position: fixed;
    /* 默认位置：bottom: 96px */
    bottom: 96px; 
    right: 8px;
    z-index: 502;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 增加 bottom 的过渡动画，使其在避让时平滑移动 */
    transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 当返回顶部按钮出现时，主按钮上移避让 */
.vms-fab.lift-up {
    /* 96px + 36px(按钮高) + 8px(间距) = 140px */
    bottom: 140px;
}

/* ============================================
   返回顶部按钮样式 (复刻 .JHraiF99)
   ============================================ */
.vms-back-to-top {
    /* 基础样式复刻 */
    background-color: #f8f9fd;
    background-color: var(--color-bg-1, #f8f9fd);
    border-radius: 24px;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
    box-shadow: var(--shadow-2, 0 0 24px rgba(0, 0, 0, 0.2));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    
    /* 初始隐藏状态：高度为0，透明，无边距 */
    height: 0;
    opacity: 0;
    margin-bottom: 0;
    overflow: hidden;
    transform: scale(0.8);
    
    /* 动画过渡 */
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 图标样式 */
.vms-back-to-top svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    color: var(--color-text-3, #555);
    transition: transform 0.3s ease;
}

.vms-back-to-top:hover svg {
    color: var(--color-text-1, hsla(0, 0%, 100%, .8));
    transform: translateY(-2px);
}

/* 激活状态：显示 */
.vms-back-to-top.show {
    height: 36px;
    opacity: 1;
    margin-bottom: 8px; /* 撑开间距 */
    transform: scale(1);
}

/* ... (保留原有的 vms-fab-btn, vms-fab-icon 等样式) ... */
.vms-fab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 24px; 
    cursor: pointer;
    background-color: var(--color-bg-1, #f8f9fd);
    box-shadow: var(--shadow-2, 0 0 24px rgba(0, 0, 0, 0.2));
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
    position: relative;
    color: var(--color-text-3, #555);
}

.vms-fab-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    color: var(--color-primary, #667eea);
}

.vms-fab-btn:active {
    transform: scale(0.92);
}

.vms-fab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}

.vms-fab-btn.active::after {
    content: '';
    position: absolute;
    top: -4px; left: -4px; right: -4px; bottom: -4px;
    border-radius: 50%;
    border: 1px solid rgba(102, 126, 234, 0.5);
    opacity: 0;
    z-index: -1;
    animation: vms-pulse-ring 2s infinite;
}

@keyframes vms-pulse-ring {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

.vms-fab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.vms-fab-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    stroke: none;
    transition: all 0.3s ease;
}

.vms-fab-btn:hover .vms-fab-icon svg path {
    animation: vms-icon-float 0.8s ease-in-out infinite alternate;
}

@keyframes vms-icon-float {
    0% { transform: translateY(0); }
    100% { transform: translateY(-1px); }
}

.vms-fab-text { display: none; }

/* Tooltip 样式 */
.vms-fab-tooltip {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.vms-fab-tooltip::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    margin-top: -4px;
    border-width: 4px;
    border-style: solid;
    border-color: transparent transparent transparent rgba(0, 0, 0, 0.8);
}

.vms-fab-btn:hover + .vms-fab-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.vms-fab-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid var(--color-bg-1, #fff);
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.vms-fab-btn.active .vms-fab-indicator {
    opacity: 1;
    transform: scale(1);
}

/* 气泡卡片样式 */
.vms-bubble-card {
    position: fixed;
    z-index: 503;
    max-width: 260px;
    padding: 14px 18px;
    border-radius: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    bottom: 90px;
    right: 60px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* 气泡卡片也需要跟随按钮移动 */
.vms-bubble-card.lift-up {
    bottom: 134px; /* 90 + 44 */
}

html[dark="true"] .vms-bubble-card {
    background: rgba(40, 44, 52, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.vms-bubble-card.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}

.vms-bubble-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vms-bubble-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    color: #fff;
}

.vms-bubble-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.vms-bubble-text { flex: 1; }

.vms-bubble-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 2px 0;
    line-height: 1.2;
}

.vms-bubble-desc {
    font-size: 11px;
    opacity: 0.8;
    margin: 0;
    line-height: 1.4;
}

.vms-bubble-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 0.5;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vms-bubble-close:hover { opacity: 1; }

.vms-bubble-card::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: inherit;
    border-top: 1px solid rgba(255,255,255,0.5);
    border-right: 1px solid rgba(255,255,255,0.5);
    border-radius: 0 4px 0 0;
    transform: translateY(-50%) rotate(45deg);
    z-index: 1;
}

html[dark="true"] .vms-bubble-card::after {
    border-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   响应式 - 移动端适配
   ============================================ */
@media (max-width: 768px) {
    .vms-fab {
        /* 默认: 155px */
        bottom: 155px; 
        right: 8px;
    }
    
    .vms-fab.lift-up {
        /* 155 + 44 = 199px */
        bottom: 199px;
    }
    
    .vms-fab-tooltip { display: none; }

    .vms-bubble-card {
        right: 54px;
        bottom: 150px;
        max-width: 220px;
    }
    
    .vms-bubble-card.lift-up {
        bottom: 194px;
    }
}