/*
Theme Name: Waterfall Theme
Theme URI: 
Author: 元宝
Author URI: 
Description: 响应式瀑布流WordPress主题，PC端4列，手机端2列
Version: 1.0
Text Domain: waterfall-theme
*/

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.site-header {
    background-color: #ffffff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-logo {
    height: 40px;
    width: auto;
}

.site-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    text-decoration: none;
    color: #2c3e50;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
}

.site-title a:hover {
    opacity: 0.9;
}

.main-navigation {
    display: flex;
    align-items: center;
}

.main-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    margin: 0;
    padding: 0;
}

.menu-item a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
}

.menu-item a:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.menu-item.current-menu-item a {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* 瀑布流样式 */
.waterfall-container {
    padding: 30px 0 60px;
    min-height: calc(100vh - 200px);
}

.waterfall-grid {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.waterfall-item {
    position: absolute;
    width: 100%;
    transition: transform 0.3s, opacity 0.3s;
    will-change: transform, opacity;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.waterfall-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.waterfall-item:hover .post-thumbnail {
    transform: scale(1.05);
}

.post-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.post-thumbnail-container {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.post-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s ease;
}

.post-title-container {
    padding: 20px;
    background: white;
}

.post-title {
    font-size: 16px;
    line-height: 1.4;
    color: #333;
    font-weight: 600;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 响应式列数 */
@media (min-width: 1200px) {
    .waterfall-item {
        width: calc(25% - 15px) !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .waterfall-item {
        width: calc(33.333% - 13.33px) !important;
    }
}

@media (max-width: 767px) {
    .waterfall-item {
        width: calc(50% - 10px) !important;
    }
}

@media (max-width: 480px) {
    .waterfall-item {
        width: 100% !important;
    }
}

/* 加载状态 */
.waterfall-loading {
    text-align: center;
    padding: 20px 0;
    display: none;
}

.waterfall-loading.active {
    display: block;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 瀑布流动画 */
@keyframes itemFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.waterfall-item.animated {
    animation: itemFadeIn 0.5s ease-out;
}

/* 个人中心样式 */
.user-center-page {
    padding: 40px 0 80px;
    min-height: calc(100vh - 200px);
}

.user-center-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.user-sidebar {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.user-profile {
    text-align: center;
    margin-bottom: 30px;
}

.user-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.user-name {
    font-size: 24px;
    color: #2c3e50;
    margin-bottom: 5px;
    font-weight: 600;
}

.user-email {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 20px;
}

.user-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 20px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.user-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.user-menu-item {
    margin-bottom: 10px;
}

.user-menu-link {
    display: block;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.user-menu-link:hover,
.user-menu-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.section-title {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        height: auto;
        padding: 15px 0;
    }
    
    .main-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        margin-top: 15px;
    }
    
    .user-center-container {
        grid-template-columns: 1fr;
    }
    
    .user-sidebar {
        position: static;
    }
}

/* 页脚样式 */
.site-footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 0 30px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-widget h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: white;
    position: relative;
    padding-bottom: 10px;
}

.footer-widget h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
}

.footer-widget ul {
    list-style: none;
    padding: 0;
}

.footer-widget li {
    margin-bottom: 10px;
}

.footer-widget a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-widget a:hover {
    color: white;
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* 文章详情页 */
.single-post {
    padding: 40px 0;
    max-width: 800px;
    margin: 0 auto;
}

.entry-header {
    margin-bottom: 40px;
    text-align: center;
}

.entry-title {
    font-size: 36px;
    color: #2c3e50;
    margin-bottom: 20px;
    line-height: 1.3;
}

.entry-meta {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 20px;
}

.entry-content {
    font-size: 18px;
    line-height: 1.8;
    color: #2c3e50;
}

.entry-content p {
    margin-bottom: 25px;
}

.entry-content h2 {
    color: #2c3e50;
    margin: 40px 0 20px;
    font-size: 28px;
}

.entry-content h3 {
    color: #2c3e50;
    margin: 30px 0 15px;
    font-size: 24px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
    color: white;
}

.btn-secondary {
    background: #f8f9fa;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* 表单样式 */
.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 消息提示 */
.message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}


/* 修复瀑布流显示问题 */
.waterfall-grid {
    position: relative;
    width: 100%;
    min-height: 100px; /* 确保有最小高度 */
    margin: 0 auto;
    overflow: visible !important; /* 确保项目可见 */
}

.waterfall-item {
    position: absolute !important; /* 使用 !important 确保优先级 */
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    will-change: transform, opacity;
}

.waterfall-positioned {
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 确保图片容器正确显示 */
.post-thumbnail-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.post-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    min-height: 1px; /* 防止图片高度为0 */
    transition: transform 0.6s ease;
}

.post-title-container {
    padding: 20px;
    background: white;
    min-height: 60px; /* 确保标题容器有最小高度 */
}

.post-title {
    font-size: 16px;
    line-height: 1.4;
    color: #333;
    font-weight: 600;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 响应式列数 - 使用更具体的选择器 */
@media (min-width: 1200px) {
    .waterfall-item {
        width: calc(25% - 15px) !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .waterfall-item {
        width: calc(33.333% - 13.33px) !important;
    }
}

@media (max-width: 767px) {
    .waterfall-item {
        width: calc(50% - 10px) !important;
    }
}

@media (max-width: 480px) {
    .waterfall-item {
        width: 100% !important;
    }
}

/* 修复加载状态 */
.waterfall-loading {
    text-align: center;
    padding: 40px 0;
    position: relative;
    z-index: 1;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* 修复没有图片时的显示 */
.waterfall-item:not(:has(.post-thumbnail)) .post-title-container {
    padding: 40px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* 修复图片加载错误时的显示 */
.post-thumbnail[src=""],
.post-thumbnail:not([src]) {
    display: none;
}

.waterfall-item:has(.post-thumbnail[src=""]) .post-title-container,
.waterfall-item:has(.post-thumbnail:not([src])) .post-title-container {
    padding: 40px 20px;
    min-height: 200px;
}