/**
 * 子比主题美化增强插件 - 前端样式
 */

/* ==================== 页面加载动画 ==================== */
#zbp-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--body-bg-color, #f5f6f7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#zbp-page-loader.zbp-loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.zbp-loader-inner {
    text-align: center;
}

.zbp-loader-text {
    margin-top: 20px;
    color: var(--main-color, #4e5358);
    font-size: 14px;
    letter-spacing: 2px;
}

/* 波浪加载 */
.zbp-loader-wave {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    height: 40px;
}

.zbp-loader-wave span {
    display: inline-block;
    width: 8px;
    height: 100%;
    background: var(--loader-color, #f04494);
    border-radius: 4px;
    animation: zbp-wave 1.2s ease-in-out infinite;
}

.zbp-loader-wave span:nth-child(1) { animation-delay: -0.4s; height: 60%; }
.zbp-loader-wave span:nth-child(2) { animation-delay: -0.3s; height: 80%; }
.zbp-loader-wave span:nth-child(3) { animation-delay: -0.2s; height: 100%; }
.zbp-loader-wave span:nth-child(4) { animation-delay: -0.1s; height: 80%; }
.zbp-loader-wave span:nth-child(5) { animation-delay: 0s; height: 60%; }

@keyframes zbp-wave {
    0%, 100% { transform: scaleY(0.6); opacity: 0.6; }
    50% { transform: scaleY(1); opacity: 1; }
}

/* 旋转加载 */
.zbp-loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(240, 68, 148, 0.2);
    border-top-color: var(--loader-color, #f04494);
    border-radius: 50%;
    animation: zbp-spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes zbp-spin {
    to { transform: rotate(360deg); }
}

/* 脉冲加载 */
.zbp-loader-pulse {
    width: 48px;
    height: 48px;
    background: var(--loader-color, #f04494);
    border-radius: 50%;
    margin: 0 auto;
    animation: zbp-pulse 1.2s ease-in-out infinite;
}

@keyframes zbp-pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1); opacity: 1; }
}

/* 极简加载 */
.zbp-loader-minimal {
    width: 48px;
    height: 48px;
    border: 3px solid var(--loader-color, #f04494);
    border-radius: 50%;
    border-bottom-color: transparent;
    margin: 0 auto;
    animation: zbp-spin 1s linear infinite;
}

/* ==================== 阅读进度条 ==================== */
#zbp-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--theme-color, #f04494);
    z-index: 99998;
    transition: width 0.1s linear;
}

/* ==================== 返回顶部按钮 ==================== */
#zbp-back-top {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--main-bg-color, #fff);
    color: var(--back-top-color, var(--theme-color, #f04494));
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9990;
}

#zbp-back-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#zbp-back-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.16);
    background: var(--back-top-color, var(--theme-color, #f04494));
    color: #fff;
}

.zbp-back-top-circle { border-radius: 50%; }
.zbp-back-top-square { border-radius: var(--main-radius, 8px); }
.zbp-back-top-minimal { border-radius: 4px; background: transparent; border: 1px solid var(--main-border-color); }

/* ==================== 文章卡片悬浮效果 ==================== */
.zbp-beautify-enabled .posts-item,
.zbp-beautify-enabled .theme-box {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.zbp-beautify-enabled .posts-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12) !important;
}

.zbp-beautify-enabled .item-thumbnail img {
    transition: transform 0.5s ease;
}

.zbp-beautify-enabled .posts-item:hover .item-thumbnail img {
    transform: scale(1.05);
}

/* ==================== 图片灯箱 ==================== */
.zbp-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: zoom-out;
}

.zbp-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.zbp-lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border-radius: var(--main-radius, 8px);
}

.zbp-lightbox-overlay.active .zbp-lightbox-img {
    transform: scale(1);
}

.zbp-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.zbp-lightbox-close:hover {
    opacity: 1;
}

/* ==================== 代码块样式 ==================== */
.zbp-code-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--muted-bg-color, #f6f7f8);
    border-bottom: 1px solid var(--main-border-color, rgba(50,50,50,0.06));
    border-radius: var(--main-radius, 8px) var(--main-radius, 8px) 0 0;
    margin-bottom: 0;
}

.zbp-code-dots {
    display: flex;
    gap: 6px;
    margin-right: 12px;
}

.zbp-code-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f56;
}

.zbp-code-dots span:nth-child(2) { background: #ffbd2e; }
.zbp-code-dots span:nth-child(3) { background: #27c93f; }

.zbp-code-lang {
    flex: 1;
    font-size: 12px;
    color: var(--muted-color, #777);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.zbp-code-copy {
    padding: 4px 12px;
    font-size: 12px;
    color: var(--muted-color, #777);
    background: var(--main-bg-color, #fff);
    border: 1px solid var(--main-border-color);
    border-radius: var(--mini-radius, 6px);
    cursor: pointer;
    transition: all 0.2s;
}

.zbp-code-copy:hover {
    color: var(--theme-color, #f04494);
    border-color: var(--theme-color, #f04494);
}

.zbp-code-minimal .zbp-code-dots,
.zbp-code-border .zbp-code-dots {
    display: none;
}

.zbp-code-minimal {
    background: transparent;
    border-bottom: 1px solid var(--main-border-color);
}

.zbp-code-border {
    background: var(--body-bg-color, #f5f6f7);
    border: 1px solid var(--main-border-color);
    border-bottom: none;
}

/* ==================== 粒子背景 ==================== */
#zbp-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.zbp-particles-enabled #page {
    position: relative;
    z-index: 1;
}

/* ==================== 移动端底部导航 ==================== */
#zbp-mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--blur-bg, rgba(255,255,255,0.85));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--main-border-color, rgba(50,50,50,0.06));
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 9995;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

#zbp-mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted-color, #777);
    text-decoration: none;
    font-size: 11px;
    gap: 3px;
    transition: color 0.2s;
    flex: 1;
    height: 100%;
}

#zbp-mobile-bottom-nav a.active,
#zbp-mobile-bottom-nav a:hover {
    color: var(--theme-color, #f04494);
}

.zbp-mobile-bottom-nav #page {
    padding-bottom: 70px !important;
}

/* ==================== 目录增强 ==================== */
.zbp-toc-enhance {
    border-left: 2px solid var(--main-border-color);
    padding-left: 12px;
}

.zbp-toc-enhance a {
    display: block;
    padding: 6px 10px;
    border-radius: var(--mini-radius, 6px);
    color: var(--muted-color, #777);
    transition: all 0.2s;
    margin-bottom: 2px;
}

.zbp-toc-enhance a:hover,
.zbp-toc-enhance a.active {
    color: var(--theme-color, #f04494);
    background: var(--focus-shadow-color, rgba(253,83,161,0.1));
    padding-left: 14px;
}

.zbp-toc-float {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

/* ==================== 毛玻璃效果增强 ==================== */
.zbp-glass-effect .theme-box,
.zbp-glass-effect .navbar-top,
.zbp-glass-effect .modal-content,
.zbp-glass-effect .dropdown-menu {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ==================== 通用动画 ==================== */
@keyframes zbp-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.zbp-beautify-enabled .posts-item {
    animation: zbp-fadeInUp 0.5s ease forwards;
}

.zbp-beautify-enabled .posts-item:nth-child(1) { animation-delay: 0.05s; }
.zbp-beautify-enabled .posts-item:nth-child(2) { animation-delay: 0.1s; }
.zbp-beautify-enabled .posts-item:nth-child(3) { animation-delay: 0.15s; }
.zbp-beautify-enabled .posts-item:nth-child(4) { animation-delay: 0.2s; }
.zbp-beautify-enabled .posts-item:nth-child(5) { animation-delay: 0.25s; }
.zbp-beautify-enabled .posts-item:nth-child(6) { animation-delay: 0.3s; }

/* ==================== 自定义鼠标指针 ==================== */
#zbp-cursor {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 99999;
    mix-blend-mode: difference;
}

.zbp-cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    background: var(--theme-color, #f04494);
    border-radius: 50%;
    transition: transform 0.05s ease;
}

.zbp-cursor-ring {
    position: fixed;
    width: 32px;
    height: 32px;
    border: 1px solid var(--theme-color, #f04494);
    border-radius: 50%;
    transition: transform 0.15s ease, width 0.2s, height 0.2s;
}

#zbp-cursor.active .zbp-cursor-ring {
    width: 48px;
    height: 48px;
    background: rgba(240, 68, 148, 0.1);
}

/* 移动端隐藏自定义指针 */
@media (pointer: coarse) {
    #zbp-cursor { display: none; }
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 768px) {
    #zbp-back-top {
        right: 15px;
        bottom: 75px;
        width: 42px;
        height: 42px;
    }

    .zbp-lightbox-img {
        max-width: 95%;
        max-height: 80%;
    }

    .zbp-code-header {
        padding: 8px 12px;
    }
}
