/**
 * Fairplus 侧边栏样式
 * 
 * 右侧固定侧边栏，包含快捷操作按钮和返回顶部功能
 */

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 侧边栏主容器 */
.fp-sidebar {
    position: fixed;
    right: 20px;
    bottom: 5%;
    transform: translateY(-5%);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.fp-sidebar-container {
    display: flex;
    flex-direction: column;
    background: #000;
    border-radius: 8px;
    overflow: visible;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* 侧边栏项目 */
.fp-sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    color: #fff;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
    font-family: inherit;
    padding: 8px;
    position: relative;
}

.fp-sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
    transform: scale(1.05);
}


.fp-sidebar-item i {
    font-size: 20px;
    margin-bottom: 6px;
    display: block;
    transition: transform 0.2s ease;
}

.fp-sidebar-item:hover i {
    transform: scale(1.1);
}

.fp-sidebar-item span {
    font-size: 10px;
    text-align: center;
    line-height: 1.2;
    display: block;
    font-weight: 500;
}

/* 返回顶部按钮特殊样式 */
.fp-back-to-top {
    background-color: var(--fp-color-primary, #ff8c00) !important;
    display: none; /* 默认隐藏，滚动时显示 */
}

.fp-back-to-top.fp-show {
    display: flex;
}

.fp-back-to-top:hover {
    background-color: var(--fp-color-primary-dark, #ff7700) !important;
}

/* Hover / 聚焦文字提示
   提示文本就放在 .fp-tooltip-text 里（HTML 内联，无需 JS 搬运），
   键盘聚焦时同样可见。 */
.fp-tooltip-text {
    position: absolute;
    right: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--fp-color-primary, #6d28d9);
    color: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1001;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.fp-sidebar-item:hover .fp-tooltip-text,
.fp-sidebar-item:focus-visible .fp-tooltip-text {
    opacity: 1;
    visibility: visible;
}

/* 旧版 data-tooltip 属性方案（保留兼容） */
.fp-sidebar-item[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--fp-color-primary);
    color: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1001;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.fp-sidebar-item[data-tooltip]::after {
    content: '';
    position: absolute;
    right: calc(100% + 0px);
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: var(--fp-color-primary);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1001;
    pointer-events: none;
}

.fp-sidebar-item[data-tooltip]:hover::before,
.fp-sidebar-item[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 弹窗样式 */
.fp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

.fp-modal.fp-modal-active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fp-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.fp-modal-container {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: fp-modal-slide-in 0.3s ease;
}

@keyframes fp-modal-slide-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.fp-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.fp-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.fp-modal-close:hover {
    background: #e9ecef;
    color: #333;
}

.fp-modal-content {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

/* 弹窗内容样式优化 */
.fp-modal-content h1,
.fp-modal-content h2,
.fp-modal-content h3,
.fp-modal-content h4,
.fp-modal-content h5,
.fp-modal-content h6 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.fp-modal-content p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #555;
}

.fp-modal-content .fluentform {
    margin: 0;
}

/* 滚动时的动画效果 */
.fp-sidebar.fp-sidebar-scrolled {
    transform: translateY(0) scale(0.95);
}

/* 响应式设计 - 窄屏隐藏侧边栏
   侧栏固定宽 80px + right 20px，会压住 .container(1200px) 的内容列；
   经计算 1366px 以下内容列右缘与侧栏相交，故在 <1366px 隐藏，
   快捷入口由页头/页脚/移动底栏承担。 */
@media (max-width: 1365px) {
    .fp-sidebar {
        display: none !important;
    }
}

/* 防止弹窗打开时页面滚动 */
body.fp-modal-open {
    overflow: hidden;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .fp-sidebar-container {
        border: 2px solid #fff;
    }
    
    .fp-sidebar-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .fp-sidebar-item:last-child {
        border-bottom: none;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .fp-sidebar,
    .fp-sidebar-item,
    .fp-sidebar-item i,
    .fp-modal-container {
        transition: none;
        animation: none;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .fp-modal-container {
        background: #1a1a1a;
        color: #fff;
    }
    
    .fp-modal-header {
        background: #2a2a2a;
        border-bottom-color: #444;
    }
    
    .fp-modal-title {
        color: #fff;
    }
    
    .fp-modal-close {
        color: #ccc;
    }
    
    .fp-modal-close:hover {
        background: #444;
        color: #fff;
    }
    
    .fp-modal-content h1,
    .fp-modal-content h2,
    .fp-modal-content h3,
    .fp-modal-content h4,
    .fp-modal-content h5,
    .fp-modal-content h6 {
        color: #fff;
    }
    
    .fp-modal-content p {
        color: #ccc;
    }
}

/* ========================================
   移动端底部快捷栏
   ======================================== */
.fp-mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    .fp-mobile-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        /* 低于页头的 z-index(1000)：打开菜单时遮罩才能盖住本栏 */
        z-index: 990;
        background: #fff;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #eee;
        /* iPhone 底部手势条安全区 */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .fp-mobile-nav-container {
        display: flex;
        justify-content: space-around;
        align-items: stretch;
    }

    .fp-mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px 5px;
        color: #666;
        text-decoration: none;
        background: transparent;
        border: none;
        cursor: pointer;
        font-family: inherit;
        transition: color 0.2s ease, background-color 0.2s ease;
        min-height: 60px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(109, 40, 217, 0.12);
    }

    .fp-mobile-nav-item:hover,
    .fp-mobile-nav-item:active {
        color: var(--fp-color-primary, #6d28d9);
        background: rgba(109, 40, 217, 0.05);
    }

    .fp-mobile-nav-item i {
        font-size: 20px;
        margin-bottom: 4px;
    }

    .fp-mobile-nav-item span {
        font-size: 11px;
        text-align: center;
        line-height: 1.2;
    }

    /* 给底栏留出空间（含安全区） */
    body.lm-static-page {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }
}

@media (min-width: 769px) {
    .fp-mobile-nav {
        display: none !important;
    }
}
