/*
Theme Name: GeneratePress Child
Template: generatepress
*/

/* ===== 排行榜风格核心样式（首页和分类页） ===== */

/* 标题包装器 - 上下两行布局 */
.rank-title-wrapper {
    display: flex;
    flex-direction: column;  /* 上下排列 */
    align-items: flex-start;
    gap: 4px;
    width: 100%;
}

/* TOP 标签 - 第一行 */
.rank-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 4.6em;
    height: 2.2em;
    background: #f0f0f0;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #333;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* 文章标题 - 第二行 */
.rank-title-wrapper .entry-title {
    display: block;
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}

/* TOP 1-3 - 金/银/铜标签 */
.rank-1.top-rank {
    background: linear-gradient(145deg, #ffd700, #f5a623);
    color: #7a5c00;
    border: 2px solid #f5a623;
    font-weight: 900;
}

.rank-2.top-rank {
    background: linear-gradient(145deg, #e8e8e8, #c0c0c0);
    color: #4a4a4a;
    border: 2px solid #b0b0b0;
    font-weight: 900;
}

.rank-3.top-rank {
    background: linear-gradient(145deg, #e8a87c, #cd7f32);
    color: #4d2e0e;
    border: 2px solid #b8702a;
    font-weight: 900;
}

/* TOP 4-10 - 蓝色标签 */
.rank-4.top-rank,
.rank-5.top-rank,
.rank-6.top-rank,
.rank-7.top-rank,
.rank-8.top-rank,
.rank-9.top-rank,
.rank-10.top-rank {
    background: #e8f0fe;
    color: #1a3c6e;
    border: 2px solid #d0ddea;
    font-size: 0.7rem;
    font-weight: 700;
}

/* 第11名以后 - 蓝色圆形 */
.rank-default {
    background: #e8f0fe;
    color: #1a3c6e;
    width: 2.2em;
    height: 2.2em;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid #d0ddea;
}

/* 悬停效果 */
.rank-icon:hover {
    transform: scale(1.1);
}

/* ===== 文章内容页排名信息样式 ===== */
.post-rank-info {
    margin: 15px 0 10px 0;
    padding: 12px 18px;
    background: #f8f9fa;
    border-left: 4px solid #ffd700;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px 30px;
}

.rank-badge {
    font-size: 0.95rem;
    color: #333;
    display: inline-flex;
    align-items: center;
}

.rank-badge strong {
    color: #1a3c6e;
    font-size: 1.1rem;
    margin: 0 2px;
}

.category-rank strong {
    color: #2d7d46;
}

.all-rank strong {
    color: #c0392b;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .rank-icon,
    .rank-1.top-rank,
    .rank-2.top-rank,
    .rank-3.top-rank,
    .rank-4.top-rank,
    .rank-5.top-rank,
    .rank-6.top-rank,
    .rank-7.top-rank,
    .rank-8.top-rank,
    .rank-9.top-rank,
    .rank-10.top-rank {
        width: 4.2em;
        height: 2em;
        font-size: 0.75rem;
        letter-spacing: 0.4px;
    }
    
    .rank-default {
        width: 2em;
        height: 2em;
        font-size: 0.75rem;
    }
    
    .rank-title-wrapper {
        gap: 4px;
    }
    
    .post-rank-info {
        flex-direction: column;
        gap: 8px;
        padding: 10px 14px;
        font-size: 0.9rem;
    }
}

/* 右侧边栏滚动固定 - 适配 GeneratePress */
@media (min-width: 769px) {
    .right-sidebar .widget-area {
        position: sticky;
        top: 0px;
        align-self: flex-start;
    }
}

/* ===== 文章列表特色图统一尺寸 + 边框 ===== */

/* 统一图片最大宽度 500px，居中显示 */
.generate-columns-container .post-image,
.archive .post-image,
.blog .post-image {
    text-align: center;
    margin-bottom: 15px;
}

.generate-columns-container .post-image img,
.archive .post-image img,
.blog .post-image img {
    max-width: 500px;
    width: 100%;
    height: auto;
    border: 3px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 鼠标悬停时边框变色 */
.generate-columns-container .post-image img:hover,
.archive .post-image img:hover,
.blog .post-image img:hover {
    border-color: #ffd700;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.2);
}

/* ========================================
   按钮组 - 回到顶部 + 翻页按钮
   ======================================== */

/* 按钮组容器 */
.button-group {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 999;
    align-items: center;
}

/* 回到顶部按钮 */
.back-to-top {
    width: 48px;
    height: 48px;
    background: #f5f7fa;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1.6rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.25s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1;
}

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

.back-to-top:hover {
    background: #ffd700;
    border-color: #f5a623;
    color: #7a5c00;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.35);
}

.back-to-top:active {
    transform: scale(0.92);
}

/* 翻页按钮 */
.page-nav-btn {
    width: 48px;
    height: 48px;
    background: #f5f7fa;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.25s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1;
}

.page-nav-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.page-nav-btn:hover {
    background: #ffd700;
    border-color: #f5a623;
    color: #7a5c00;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.35);
}

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

/* 移动端适配 */
@media (max-width: 768px) {
    .button-group {
        bottom: 20px;
        right: 20px;
        gap: 4px;
    }

    .back-to-top,
    .page-nav-btn {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }

    .page-nav-btn {
        font-size: 0.9rem;
    }
}

/* ========================================
   排行榜导航小工具样式
   ======================================== */

.rank-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rank-nav-list li {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.rank-nav-list li:last-child {
    border-bottom: none;
}

.rank-nav-list li:hover {
    background: #f8f9fa;
    border-radius: 4px;
    padding-left: 4px;
}

.rank-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #333;
    font-size: 0.9rem;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.rank-nav-link:hover {
    color: #1a3c6e;
}

.rank-nav-number {
    flex-shrink: 0;
    width: 2.2em;
    height: 2.2em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8f0fe;
    color: #1a3c6e;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}

/* 前三名特殊颜色 - 字体大小和4-10名一致 */
.rank-nav-link[data-rank="1"] .rank-nav-number {
    background: linear-gradient(145deg, #ffd700, #f5a623);
    color: #7a5c00;
    font-size: 0.75rem;
}

.rank-nav-link[data-rank="2"] .rank-nav-number {
    background: linear-gradient(145deg, #e8e8e8, #c0c0c0);
    color: #4a4a4a;
    font-size: 0.75rem;
}

.rank-nav-link[data-rank="3"] .rank-nav-number {
    background: linear-gradient(145deg, #e8a87c, #cd7f32);
    color: #4d2e0e;
    font-size: 0.75rem;
}

.rank-nav-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 导航标题 */
.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ffd700;
}

/* 滚动高亮动画（点击后闪烁） */
.rank-nav-highlight {
    animation: highlight-flash 1.2s ease;
}

@keyframes highlight-flash {
    0% { background-color: rgba(255, 215, 0, 0.4); }
    100% { background-color: transparent; }
}

/* ========================================
   移动端隐藏所有排行小工具
   ======================================== */

@media (max-width: 768px) {
    .widget_rank_nav_widget,
    .widget_category_rank_widget {
        display: none !important;
    }
}

/* ========================================
   分类最新文章 - 隐藏数字图标
   ======================================== */

.widget_category_rank_widget .rank-nav-number {
    display: none !important;
}

.widget_category_rank_widget .rank-nav-link {
    gap: 4px;
    padding-left: 0;
}

.widget_category_rank_widget .rank-nav-list li {
    padding-left: 0;
}

.widget_category_rank_widget .rank-nav-list li:hover {
    padding-left: 4px;
    background: transparent;
}

/* ========================================
   编辑器插入的自定义链接按钮
   风格：扁平正方形，和回顶按钮一致
   ======================================== */

.custom-link-wrapper {
    text-align: center;
    margin: 18px 0;
}

.custom-link-btn {
    display: inline-block;
    padding: 10px 28px;
    background: #f5f7fa;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.custom-link-btn:hover {
    background: #ffd700;
    border-color: #f5a623;
    color: #7a5c00;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.35);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .custom-link-btn {
        padding: 8px 18px;
        font-size: 13px;
    }
}