/********************************
 * 电脑壁纸网站
 * 重构版 UI - 16:9比例版本
 ********************************/
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1002;
    background: #667eea;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.mobile-menu-btn span {
    width: 20px;
    height: 2px;
    background: white;
    margin: 3px 0;
    transition: 0.3s;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff 0%, #f8f9fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    margin: 0;
    white-space: nowrap;
}

/* 主导航 */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.main-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: block;
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(255, 255, 255, 0.15);
}

/* 下拉分类菜单 */
.has-submenu {
    position: relative;
}

.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    width: 300px;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1001;
    overflow: hidden;
}

.has-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.category-scroll {
    max-height: 380px;
    overflow-y: auto;
    padding: 1rem;
}

#tags {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

#tags li {
    margin: 0;
    padding: 0;
}

#tags a {
    color: #333;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid #eee;
    text-align: center;
    transition: all 0.2s ease;
}

#tags a:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

/* 移动端分类菜单 */
.mobile-categories {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 1003;
    padding: 20px;
    overflow-y: auto;
}

.mobile-categories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.mobile-categories-header h3 {
    color: #667eea;
    margin: 0;
}

.close-mobile-categories {
    background: none;
    border: none;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.mobile-categories .category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.mobile-categories .category-list a {
    display: block;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}

.mobile-categories .category-list a:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* 主容器 */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

.filter-btn:hover:not(.active) {
    background: #e0e0e0;
}

.view-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-controls span {
    color: #666;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.view-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.view-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.view-btn:hover:not(.active) {
    border-color: #667eea;
}

/* 壁纸网格 - 16:9比例 */
.wallpaper-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.wallpaper-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.wallpaper-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.wallpaper-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.wallpaper-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.wallpaper-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

/* 16:9比例图片容器 */
.wallpaper-img-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
    background: #f5f5f5;
}

.wallpaper-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wallpaper-item:hover .wallpaper-img {
    transform: scale(1.05);
}

.wallpaper-tags {
    padding: 1rem;
    background: white;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: #f0f0f0;
    color: #666;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.tag:hover {
    background: #667eea;
    color: white;
}

/* 加载指示器 */
.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
}

.loading-indicator.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

/* 页脚 */
.footer {
    background: #2c3e50;
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
    padding: 0 1rem;
}

/* 全屏图片查看 - 更新版 */
.fullscreen-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.fullscreen-viewer.active {
    display: flex;
}

.fullscreen-content {
    width: 100%;
    max-width: 95vw;
    height: 95vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

#fullscreenImg {
    flex: 1;
    width: 100%;
    height: calc(100% - 100px); /* 为控制栏留出空间 */
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

.fullscreen-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    margin-top: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.1rem;
}

.btn-text {
    font-size: 0.9rem;
}

.image-info {
    text-align: center;
    padding: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-top: 0.5rem;
}

/* 分辨率选择弹窗 */
.resolution-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2001;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.resolution-popup.active {
    display: flex;
}

.popup-content {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
}

.popup-content h4 {
    margin-bottom: 1rem;
    color: #333;
    text-align: center;
    font-size: 1.1rem;
}

.resolution-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.resolution-options button {
    padding: 0.7rem;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.resolution-options button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.close-popup {
    width: 100%;
    padding: 0.7rem;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.close-popup:hover {
    background: #ddd;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .wallpaper-grid[data-columns="4"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .header-content {
        padding: 1rem;
    }
    
    .main-nav {
        display: none;
    }
    
    .main-nav.active {
        display: block;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        z-index: 1002;
        padding: 1rem;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    }
    
    .main-nav.active ul {
        flex-direction: column;
        gap: 0;
    }
    
    .main-nav.active a {
        color: #333;
        padding: 1rem;
        border-bottom: 1px solid #eee;
    }
    
    .main-nav.active a:hover {
        background: #f8f9fa;
    }
    
    .submenu {
        display: none;
    }
    
    .filter-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .view-controls {
        justify-content: center;
    }
    
    .wallpaper-grid[data-columns="2"],
    .wallpaper-grid[data-columns="3"],
    .wallpaper-grid[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .fullscreen-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
    
    .resolution-options {
        grid-template-columns: 1fr;
    }
    
    #fullscreenImg {
        height: calc(100% - 150px); /* 移动端控制栏需要更多空间 */
    }
}

@media (max-width: 480px) {
    .wallpaper-grid[data-columns="2"],
    .wallpaper-grid[data-columns="3"],
    .wallpaper-grid[data-columns="4"] {
        grid-template-columns: 1fr;
    }
    
    .logo {
        font-size: 1.4rem;
    }
    
    #fullscreenImg {
        height: calc(100% - 180px);
    }
}