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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* 头部样式 */
header {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    font-weight: 300;
}

/* 主要内容区域 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 照片网格布局 */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* 照片项容器 */
.photo-item {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 创建1:1的正方形容器 */
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    background-size: cover;
    background-position: center;
}

.photo-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.photo-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.6s ease-in-out;
    opacity: 0;
}

.photo-item img.loaded {
    opacity: 1;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* 灯箱样式 */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.show {
    display: flex;
    opacity: 1;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
}

#lightboxImg {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.lightbox-info {
    margin-top: 20px;
    color: white;
}

#imageTitle {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.lightbox-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: linear-gradient(45deg, #2980b9, #1f5f8b);
    transform: translateY(-2px);
}

.image-counter {
    color: #bdc3c7;
    font-size: 0.9rem;
}

/* 控制按钮 */
.close-btn, .prev-btn, .next-btn {
    position: absolute;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.close-btn:hover, .prev-btn:hover, .next-btn:hover {
    background: rgba(0,0,0,0.8);
    transform: scale(1.1);
}

.close-btn {
    top: 20px;
    right: 20px;
}

.prev-btn {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

.next-btn {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .lightbox-content {
        max-width: 95vw;
    }
    
    .close-btn, .prev-btn, .next-btn {
        font-size: 24px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-actions {
        flex-direction: column;
        gap: 10px;
    }
}
