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

body {
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* 头部样式 */
header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
main {
    background: white;
    border-radius: 20px 20px 0 0;
    min-height: 80vh;
    padding: 2rem 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
}

/* 控制面板 */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.search-box input {
    padding: 0.8rem 1.2rem;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 1rem;
    width: 300px;
    transition: all 0.3s ease;
}

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

.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.8rem 1.5rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.view-btn:hover,
.view-btn.active {
    background: #667eea;
    color: white;
}

.sort-controls select {
    padding: 0.8rem 1.2rem;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

/* 页面大小选择 */
.page-size-controls select {
    padding: 0.8rem 1.2rem;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    color: #667eea;
    font-weight: 500;
}

/* 统计信息 */
.stats {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    color: #666;
}

/* 图片画廊 */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.image-gallery.list-view {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.image-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

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

.image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: all 0.3s ease;
}

.image-item:hover img {
    transform: scale(1.05);
}

.image-info {
    padding: 1rem;
}

.image-info h3 {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.image-info p {
    font-size: 0.8rem;
    color: #666;
}

/* 列表视图样式 */
.list-view .image-item {
    display: flex;
    align-items: center;
    padding: 1rem;
}

.list-view .image-item img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    margin-right: 1rem;
    flex-shrink: 0;
}

.list-view .image-info {
    padding: 0;
    flex-grow: 1;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 3rem;
}

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

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

/* 无图片状态 */
.no-images {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.2rem;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 2rem;
    width: 90%;
    max-width: 800px;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
}

.modal img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.close {
    position: absolute;
    top: 1rem;
    right: 2rem;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.close:hover {
    opacity: 0.7;
}

.modal-info {
    color: white;
    margin-top: 1rem;
}

.modal-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.modal-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.modal-nav {
    display: flex;
    gap: 1rem;
}

.rotate-controls {
    display: flex;
    gap: 0.5rem;
}

.nav-btn, .rotate-btn, .download-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.rotate-btn {
    padding: 0.8rem 1rem;
    font-size: 1.2rem;
    min-width: 50px;
}

.download-btn {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
    color: #4CAF50;
    font-weight: 500;
}

.nav-btn:hover, .rotate-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.download-btn:hover {
    background: rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.download-controls {
    display: flex;
    gap: 0.5rem;
}

/* 图片旋转动画 */
.modal img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    transform-origin: center center;
}

/* 底部 */
footer {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
}

/* 搜索高亮 */
.highlight {
    background-color: yellow;
    font-weight: bold;
}

/* 分页样式 */
.pagination-container {
    margin: 2rem 0;
    padding: 1rem 0;
    border-top: 1px solid #eee;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.pagination-btn:disabled {
    background: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
    border-color: #eee;
}

.pagination-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.pagination-btn.page-number {
    min-width: 44px;
    font-weight: 500;
}

.pagination-ellipsis {
    padding: 0.5rem;
    color: #999;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    height: 44px;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
}

/* 控制面板响应式设计 */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .view-controls {
        justify-content: center;
    }
    
    .sort-controls select,
    .page-size-controls select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .controls {
        padding: 1rem;
    }
    
    .view-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .sort-controls select,
    .page-size-controls select {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* 分页响应式设计 */
@media (max-width: 768px) {
    .pagination {
        gap: 0.3rem;
    }
    
    .pagination-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        min-width: 40px;
        height: 40px;
    }
    
    .pagination-ellipsis {
        height: 40px;
        padding: 0.4rem;
    }
}

@media (max-width: 480px) {
    .pagination-container {
        margin: 1rem 0;
    }
    
    .pagination {
        gap: 0.2rem;
    }
    
    .pagination-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        min-width: 36px;
        height: 36px;
    }
    
    .pagination-ellipsis {
        height: 36px;
        padding: 0.3rem;
        font-size: 0.8rem;
    }
}
