/* 自定义CSS样式 */

/* Grid布局 - 从左到右按行排列 */
.masonry-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .masonry-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .masonry-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1280px) {
    .masonry-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1rem;
    display: inline-block;
    width: 100%;
    aspect-ratio: 9/16 !important;
}

/* 壁纸卡片样式 */
.wallpaper-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    cursor: pointer;
    background: white;
    width: 100%;
    aspect-ratio: 9/16 !important;
}

.dark .wallpaper-card {
    background: #374151;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.wallpaper-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dark .wallpaper-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.wallpaper-image {
    width: 100% !important;
    aspect-ratio: 9/16 !important;
    height: auto !important;
    object-fit: cover !important;
    transition: transform 0.3s ease;
    display: block !important;
    background-color: #f3f4f6;
}

/* 动态壁纸video样式 */
.wallpaper-image[src*=".mp4"],
.wallpaper-image[src*=".MOV"],
video.wallpaper-image {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 9/16 !important;
    object-fit: cover !important;
    background-color: #f3f4f6;
}

/* 确保video元素的9:16比例 */
.wallpaper-card video {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 9/16 !important;
    object-fit: cover !important;
    max-height: none !important;
    min-height: auto !important;
}

/* 确保placeholder也保持9:16比例 */
.wallpaper-card .wallpaper-image {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 9/16 !important;
    display: block !important;
}

/* HEIC占位符特殊样式 */
.wallpaper-image[style*="position: relative"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.dark .wallpaper-image {
    background-color: #374151;
}

.dark video.wallpaper-image {
    background-color: #374151;
}

.wallpaper-card:hover .wallpaper-image {
    transform: scale(1.05);
}

/* 卡片覆盖层 */
.wallpaper-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
}

.wallpaper-card:hover .wallpaper-overlay {
    opacity: 1;
}

.wallpaper-title {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.wallpaper-info {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.wallpaper-tag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
}

.wallpaper-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.action-btn.favorited {
    background: #ec4899;
    color: white;
}

/* 动态壁纸指示器 */
.dynamic-indicator {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(147, 51, 234, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}



/* 筛选按钮样式 */
.filter-btn.active {
    background: #ec4899 !important;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 10px 25px -5px rgba(236, 72, 153, 0.4);
}

/* 自定义下拉框样式 */
select::-ms-expand {
    display: none;
}

select option {
    background-color: white;
    color: #374151;
}

.dark select option {
    background-color: #4b5563;
    color: #f3f4f6;
}

/* 加载动画 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 模态框样式 */
#imageModal {
    backdrop-filter: blur(4px);
}

/* 懒加载图片样式 */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* 返回顶部按钮 */
#backToTop {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#backToTop.visible {
    opacity: 1;
    visibility: visible;
}

#backToTop:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 搜索结果高亮 */
.search-highlight {
    background: #fef3c7;
    color: #92400e;
    border-radius: 0.25rem;
    padding: 0.125rem 0.25rem;
}

.dark .search-highlight {
    background: #92400e;
    color: #fef3c7;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* 响应式调整 */
@media (max-width: 640px) {
    .wallpaper-overlay {
        padding: 0.75rem;
    }
    
    .wallpaper-title {
        font-size: 0.875rem;
    }
    
    .wallpaper-tag {
        font-size: 0.625rem;
        padding: 0.125rem 0.375rem;
    }
    
    .action-btn {
        width: 36px;
        height: 36px;
    }
}

/* 统计数字动画 */
.counter {
    transition: all 0.3s ease;
}

/* 加载更多按钮动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.loading-pulse {
    animation: pulse 2s infinite;
}

/* 成功提示样式 */
.toast {
    position: fixed;
    top: 5rem;
    right: 1rem;
    background: #10b981;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 60;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: #ef4444;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.dark .empty-state-icon {
    color: #6b7280;
}

/* 筛选动画 */
.filter-transition {
    transition: all 0.3s ease;
}

.filter-transition.hiding {
    opacity: 0;
    transform: scale(0.8);
}

/* 主题切换动画 */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* 图片加载失败样式 */
.image-error {
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #9ca3af;
    font-size: 1.5rem;
}

.dark .image-error {
    background: #374151;
    color: #6b7280;
} 