/* fab.css —— 弧形展开 FAB 菜单 (Speed Dial) */

.fab-wrapper {
    position: fixed;
    right: 25px;
    bottom: 60px; /* 往上提一点，展开更从容 */
    z-index: var(--z-drawer);
}

/* 基础 FAB 按钮样式 */
.fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

body.dark-theme .fab {
    background: rgba(30, 34, 41, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
}

.fab:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
    border-color: var(--primary-color);
}

.fab svg { font-size: 1.4rem; }

/* 聚合菜单容器（不设宽高，靠内部绝对定位） */
.fab-container {
    position: relative;
    width: 48px;
    height: 48px;
}

/* 子菜单列表（作为一个参考点，放在主按钮位置） */
.fab-menu {
    position: absolute;
    inset: 0;
    pointer-events: none; /* 默认不响应鼠标事件 */
}

/* 子按钮初始状态：藏在主按钮里 */
.fab-item {
    position: absolute;
    bottom: 0;
    right: 0;
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition-delay: calc(var(--i, 0) * 0.04s);
}

/* 主按钮（要盖在所有子按钮最上面） */
.fab-main {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 56px;
    height: 56px;
    z-index: 10;
    font-size: 1.6rem;
    background: var(--primary-color);
    color: white;
    border: none;
}
body.dark-theme .fab-main { 
    background: var(--primary-color); 
    border: none;
}

/* 主按钮的加号旋转动画 */
.fab-container.active .fab-main svg {
    transform: rotate(45deg);
    transition: transform 0.3s ease;
}
.fab-main svg {
    transition: transform 0.3s ease;
}

/* 展开状态 */
.fab-container.active .fab-menu {
    pointer-events: auto;
}

.fab-container.active .fab-item {
    opacity: 1;
}

/* 扇形展开轨迹 (90度弧形，半径约 90px) */
/* 第1个（正左） */
.fab-container.active .fab-item:nth-child(1) { transform: translate(-85px, 0) scale(1); }
/* 第2个（左上 45 度） */
.fab-container.active .fab-item:nth-child(2) { transform: translate(-60px, -60px) scale(1); }
/* 第3个（正上） */
.fab-container.active .fab-item:nth-child(3) { transform: translate(0, -85px) scale(1); }

/* 返回顶部按钮初始隐藏 */
.back-to-top {
    position: absolute;
    bottom: 4px;
    right: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(-120px); /* 避开展开的扇形 */
}


/* 当菜单展开时，返回顶部按钮强制隐藏（由 JS 触发） */
.fab-wrapper.menu-open .back-to-top {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px) !important; /* 往下缩，做退避动画 */
    pointer-events: none;
}
