/* ================================
   Base.css - 全局样式和重置样式
   ================================ */

/* 防止页面闪烁的全局预加载机制 */
html {
    visibility: visible;
    opacity: 1;
}

html.page-loaded {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* CSS重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全局字体和基础样式 - 现代化升级 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "微软雅黑", sans-serif;
    line-height: 1.6;
    background-color: #f5f7fa;
    color: #2c3e50;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* 静态背景图片 + 现代化叠加效果 */
    background-image: 
        linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%),
        url('/images/background.jpg');
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* 预加载背景图片 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/images/background.jpg');
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    z-index: -1;
    opacity: 0;
}

.site-wrapper {
    flex: 1 0 auto;
}

/* 现代化毛玻璃容器 */
.page-container {
    width: 100%;
    max-width: 1300px;
    margin: 40px auto;
    padding: 30px;
    /* 毛玻璃效果 */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* 现代阴影层次 */
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 容器悬浮交互效果 */
.page-container:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* 链接重置 */
a {
    text-decoration: none;
    color: inherit;
}

/* 图片懒加载和占位符样式 */
img {
    background-color: #e9ecef;
    background-image: radial-gradient(circle at 50% 50%, #dee2e6 2px, transparent 2px);
    background-size: 20px 20px;
    transition: opacity 0.3s ease;
}

img:not([src]) {
    opacity: 0.7;
}

/* 懒加载图片样式 */
img.lazy-loading {
    filter: blur(2px);
    opacity: 0.6;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

img.lazy-loaded {
    filter: blur(0);
    opacity: 1;
}

img.lazy-error {
    opacity: 0.5;
    border: 2px dashed #f44336;
}

/* 移动端图片优化 */
@media (max-width: 768px) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    img.lazy-loading {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading-shimmer 1.5s infinite;
    }
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 横幅图片专用样式 - 更简洁的占位符 */
.banner-img, .carousel-main img, .main-carousel img {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 100% 100%;
    min-height: 200px;
    transition: opacity 0.3s ease;
}

/* 当图片已加载时，不显示背景渐变 */
.banner-img[src]:not([src=""]):not([src*="placeholder"]) {
    background: none;
}

.game-card img, .news-card img {
    min-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.user-avatar, .author-avatar {
    min-height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* 新闻详情页图片样式 */
.news-detail img {
    margin: 10px 0;
    padding: 10px 0;
    display: block;
    max-width: 100%;
    height: auto;
}