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

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    min-height: 100vh;
}

/* 头部样式 */
header {
    background: linear-gradient(120deg, #3498db, #5dade2);
    color: white;
    padding: 1.5rem 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

header h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 1px;
    position: relative;
}

header h1 .logo {
    display: inline-block;
    width: 180px;
    height: 50px;
    background: url('images/tuceologo.png') no-repeat center left;
    background-size: contain;
    vertical-align: middle;
    margin-right: 10px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
}

nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

nav a:hover,
nav a.active {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* 主体内容 */
main {
    max-width: 100%;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    text-align: center;
    font-weight: 300;
    font-size: 1.8rem;
    position: relative;
}

h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #2c3e50);
    margin: 0.8rem auto;
    border-radius: 3px;
}

.category-description {
    text-align: center;
    margin-bottom: 2.5rem;
    color: #7f8c8d;
    font-size: 1.1rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* 搜索样式 */
.search-container {
    max-width: 700px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
}

.search-form {
    width: 100%;
    position: relative;
}

.search-input-group {
    display: flex;
    gap: 0;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    color: #333;
    border-radius: 50px 0 0 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    border-right: none;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.15);
    border-color: #3498db;
}

.search-input::placeholder {
    color: #aaa;
}

.search-button {
    background: linear-gradient(120deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 1rem 1.8rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0 50px 50px 0;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.search-button:hover {
    background: linear-gradient(120deg, #2980b9, #3498db);
    box-shadow: 0 7px 20px rgba(52, 152, 219, 0.4);
}

.search-clear {
    background: linear-gradient(120deg, #e74c3c, #c0392b);
    color: white;
    text-decoration: none;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
    margin-left: 10px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.search-clear:hover {
    background: linear-gradient(120deg, #c0392b, #e74c3c);
    box-shadow: 0 7px 20px rgba(231, 76, 60, 0.4);
}

/* 图片网格布局 */
.image-grid {
    column-count: 7;
    column-gap: 1.5rem;
    padding: 0 1rem;
    column-width: auto;
    width: 100%;
}

@media (min-width: 1200px) {
    .image-grid {
        column-count: 7;
        column-gap: 1.5rem;
    }
}

.image-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    break-inside: avoid;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.image-item.show {
    opacity: 1;
    transform: translateY(0);
}

.image-item.show-fast {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.image-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.image-item:nth-child(2n) {
    transition-delay: 0.1s;
}

.image-item:nth-child(3n) {
    transition-delay: 0.2s;
}

.image-item:nth-child(4n) {
    transition-delay: 0.3s;
}

.image-item:nth-child(5n) {
    transition-delay: 0.4s;
}

.image-item:nth-child(6n) {
    transition-delay: 0.5s;
}

.image-item:nth-child(7n) {
    transition-delay: 0.6s;
}

.image-container {
    overflow: hidden;
    position: relative;
    max-height: 460px; /* 限制图片容器的最大高度 */
    min-height: 150px; /* 确保容器有最小高度 */
}

@media (max-width: 992px) and (min-width: 769px) {
    .image-container {
        max-height: 280px; /* 在大平板屏幕上适配图片容器高度 */
        min-height: 140px;
    }
    .image-loader {
        height: 180px;
    }
}

@media (max-width: 768px) {
    .image-container {
        max-height: 250px; /* 在中等屏幕上适配图片容器高度 */
        min-height: 120px;
    }
    .image-loader {
        height: 160px;
    }
}

@media (max-width: 576px) {
    .image-container {
        max-height: 200px; /* 在小屏幕上进一步限制图片容器高度 */
        min-height: 100px;
    }
    .image-loader {
        height: 140px;
    }
}

@media (max-width: 400px) {
    .image-container {
        max-height: 180px; /* 在极小屏幕上进一步限制图片容器高度 */
        min-height: 90px;
    }
    .image-loader {
        height: 120px;
    }
}

.image-container img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.6s ease, transform 0.5s ease;
    object-fit: cover;
    background-color: #f8f9fa;
    opacity: 0;
}

.image-container img.loaded {
    opacity: 1;
}

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

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-container:hover .image-overlay {
    opacity: 1;
}

.image-info {
    padding: 1.5rem;
    break-inside: avoid;
}

.image-info h3 {
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    color: #2c3e50;
    font-weight: 500;
}

.category-name {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.category-name::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #3498db;
    border-radius: 50%;
    margin-right: 8px;
}

.download-btn {
    display: inline-block;
    background: linear-gradient(120deg, #3498db, #2c3e50);
    color: white;
    text-decoration: none;
    padding: 0.7rem 1.5rem;
    border-radius: 30px;
    transition: all 0.3s ease;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: center;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.image-overlay .download-btn {
    width: auto;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
}

.image-overlay .detail-link {
    width: auto;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    background: rgba(44, 62, 80, 0.8);
    margin-top: 1rem;
}

.image-meta {
    display: flex;
    justify-content: space-between;
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.no-images {
    text-align: center;
    color: #7f8c8d;
    font-size: 1.3rem;
    margin-top: 4rem;
}

/* 底部样式 */
footer {
    background: linear-gradient(120deg, #2c3e50, #4a6491);
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    color: rgba(255, 255, 255, 0.8);
}

/* 响应式设计 */
@media (max-width: 992px) {
    .image-grid {
        column-count: 4;
        column-gap: 1.5rem;
        padding: 0 1rem;
        width: 100%;
    }
    
    header h1 {
        font-size: 1.7rem;
    }
    
    main {
        margin: 2rem auto;
    }
}

@media (max-width: 768px) {
    .image-grid {
        column-count: 3;
        column-gap: 1.2rem;
        padding: 0 1rem;
        width: 100%;
    }
    
    header {
        padding: 1.2rem 1rem;
    }
    
    header h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    nav {
        display: none !important;
        gap: 0.5rem;
    }
    
    nav a {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    main {
        margin: 1.5rem auto;
        padding: 0 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .category-description {
        font-size: 1rem;
    }
    
    .image-container {
        max-height: 250px; /* 在中等屏幕上适配图片容器高度 */
        min-height: 120px;
    }
    
    /* 移除之前隐藏导航项的规则，确保在移动端侧边栏中显示所有菜单项 */
    .image-loader {
        height: 160px;
    }
}

@media (max-width: 576px) {
    .image-grid {
        column-count: 2;
        column-gap: 1rem;
        padding: 0 0.5rem;
        width: 100%;
    }
    
    header {
        padding: 1rem 0.75rem;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    nav {
        display: none !important;
        flex-wrap: wrap;
    }
    
    nav a {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        margin: 0.2rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    .image-info {
        padding: 1rem;
    }
    
    .image-info h3 {
        font-size: 1rem;
    }
    
    .search-container {
        padding: 0 0.5rem;
    }
    
    .search-input {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .search-button,
    .search-clear {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .image-container {
        max-height: 200px; /* 在小屏幕上进一步限制图片容器高度 */
        min-height: 100px;
    }
    .image-loader {
        height: 140px;
    }
}

@media (max-width: 400px) {
    .image-grid {
        column-count: 1;
        column-gap: 0.8rem;
        padding: 0 0.5rem;
        width: 100%;
    }
    
    nav a {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .image-info {
        padding: 0.8rem;
    }
    
    .image-info h3 {
        font-size: 0.9rem;
    }
    
    .search-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .search-button,
    .search-clear {
        width: 100%;
        justify-content: center;
    }
    
    .image-container {
        max-height: 180px; /* 在极小屏幕上进一步限制图片容器高度 */
        min-height: 90px;
    }
    .image-loader {
        height: 120px;
    }
}

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(30px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* 图片项动画延迟，实现逐个显示效果 */
.image-item {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

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

.image-item:nth-child(2n) {
    animation-delay: 0.1s;
}

.image-item:nth-child(3n) {
    animation-delay: 0.2s;
}

.image-item:nth-child(4n) {
    animation-delay: 0.3s;
}

/* 单独的淡入动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 为图片容器添加淡入效果 */
.image-item {
    animation: fadeIn 0.5s ease-out forwards;
}

.image-item:nth-child(2n) {
    animation-delay: 0.1s;
}

.image-item:nth-child(3n) {
    animation-delay: 0.2s;
}

.image-item:nth-child(4n) {
    animation-delay: 0.3s;
}

.image-item:nth-child(5n) {
    animation-delay: 0.4s;
}

.image-item:nth-child(6n) {
    animation-delay: 0.5s;
}

.image-item:nth-child(7n) {
    animation-delay: 0.6s;
}

/* 图片详情页面样式 */
.detail-container {
    display: flex;
    gap: 2rem;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.detail-image {
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
}

.detail-image img {
    width: 100%;
    height: auto;
    display: block;
    cursor: zoom-in;
}

.detail-image .image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: zoom-in;
}

.detail-image .image-overlay i {
    color: white;
    font-size: 3rem;
}

.detail-image:hover .image-overlay {
    opacity: 1;
}

.detail-info {
    flex: 1;
    padding: 1rem 0;
}

.detail-info h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-weight: 500;
    text-align: left;
}

.detail-info h2::after {
    display: none;
}

.detail-meta {
    margin-bottom: 2rem;
}

.meta-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.meta-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.meta-item i {
    width: 24px;
    color: #3498db;
    font-size: 1.1rem;
}

.meta-item span {
    margin-left: 1rem;
    color: #495057;
}

.detail-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.detail-actions .download-btn {
    flex: 1;
    min-width: 200px;
    text-align: center;
    padding: 1rem;
    font-size: 1.1rem;
}

.preview-btn {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(120deg, #2c3e50, #4a6491);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.preview-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.3);
}

.detail-description {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.detail-description h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.detail-description h3 i {
    margin-right: 0.5rem;
}

.detail-description p {
    color: #495057;
    line-height: 1.8;
}

/* 相似图片部分样式 */
.similar-images {
    margin-top: 2rem;
}

.similar-images h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.similar-images h3 i {
    margin-right: 0.5rem;
}

.similar-images .image-grid {
    column-count: 4;
    column-gap: 1.5rem;
}

.similar-images .image-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

.similar-images .image-item .image-info {
    display: none;
}

@media (max-width: 1200px) {
    .similar-images .image-grid {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .similar-images .image-grid {
        column-count: 2;
    }
}

@media (max-width: 480px) {
    .similar-images .image-grid {
        column-count: 1;
    }
}

/* 图片放大模态框样式 */
.zoom-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    cursor: zoom-out;
}

.zoom-content {
    display: block;
    max-width: 95vw;
    max-height: 95vh;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    transition: transform 0.3s ease;
    border-radius: 8px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.close-zoom {
    position: absolute;
    top: 30px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
}

.close-zoom:hover {
    color: #bbb;
}

.zoom-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2001;
    display: flex;
    gap: 15px;
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
}

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

/* 图片预览模态框 */
.preview-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.preview-content {
    margin: auto;
    display: block;
    max-width: 95vw;
    max-height: 95vh;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 8px;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: zoom-in; /* 添加手型光标表示可以点击放大 */
}

.close-preview {
    position: absolute;
    top: 30px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.close-preview:hover {
    color: #bbb;
}

/* 响应式详情页面 */
@media (max-width: 992px) {
    .detail-container {
        flex-direction: column;
    }
    
    .detail-actions {
        flex-direction: column;
    }
    
    .detail-actions .download-btn,
    .preview-btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .detail-container {
        padding: 1.5rem;
    }
    
    .detail-info h2 {
        font-size: 1.5rem;
    }
    
    .image-container {
        max-height: 250px; /* 在中等屏幕上适配图片容器高度 */
    }
}

@media (max-width: 576px) {
    .detail-container {
        padding: 1rem;
    }
    
    .meta-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .meta-item i {
        margin-bottom: 0.5rem;
    }
    
    .meta-item span {
        margin-left: 0;
    }
    
    .preview-content {
        max-width: 95vw;
        max-height: 95vh;
        width: auto;
        height: auto;
    }
    
    .image-container {
        max-height: 200px; /* 在小屏幕上进一步限制图片容器高度 */
    }
}

/* 图片加载动画 */
.image-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    background-color: #f8f9fa;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 图片加载前的占位符 */
.image-placeholder {
    background-color: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #6c757d;
    font-size: 14px;
    height: 200px;
    width: 100%;
}

.similar-images .image-placeholder {
    height: 150px;
    font-size: 12px;
}

/* 添加透明渐显动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.image-container img {
    animation: fadeIn 0.5s ease-in forwards;
}
