/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #F5F7FA;
    color: #333333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 顶部导航栏 */
.header {
    background-color: #4A90E2;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.header-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav {
    display: flex;
    justify-content: center;
}

/* 上传按钮样式 */
.upload-btn {
    background-color: #FF9500;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.upload-btn:hover {
    background-color: #FF7A00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.category-list {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.category-item {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.category-item:hover,
.category-item.active {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* 主内容区域 */
.main {
    padding: 2rem 0;
}

/* 图片网格 */
.gallery {
    margin-top: 2rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }
.gallery-item:nth-child(7) { animation-delay: 0.7s; }
.gallery-item:nth-child(8) { animation-delay: 0.8s; }
.gallery-item:nth-child(9) { animation-delay: 0.9s; }

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item {
    position: relative;
}

.gallery-item-info {
    padding: 1rem;
}

.gallery-item-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.gallery-item-category {
    font-size: 0.85rem;
    color: #666;
    background-color: #F0F2F5;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    display: inline-block;
}

/* 删除按钮样式 */
.delete-btn {
    background-color: #FF3B30;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
}

.delete-btn:hover {
    background-color: #FF1C0A;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

/* 图片卡片上的删除按钮 */
.gallery-item .delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.gallery-item:hover .delete-btn {
    opacity: 1;
}

/* 模态框样式 */
.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;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
}

/* 模态框头部 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* 模态框删除按钮 */
.modal-delete-btn {
    border-radius: 20px;
    padding: 0.5rem 1rem;
    width: auto;
    height: auto;
    font-size: 0.9rem;
    font-weight: 600;
}

/* 上传模态框样式 */
.upload-modal-content {
    background-color: white;
    color: #333;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.upload-modal-content .modal-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.upload-modal-content .modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.upload-modal-content .close-btn {
    color: #666;
    top: 0;
    right: 0;
}

/* 上传表单样式 */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    padding: 0.8rem;
    border: 2px solid #E1E5E9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.cancel-btn,
.submit-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.cancel-btn {
    background-color: #F0F2F5;
    color: #666;
}

.cancel-btn:hover {
    background-color: #E1E5E9;
}

.submit-btn {
    background-color: #4A90E2;
    color: white;
}

.submit-btn:hover {
    background-color: #357ABD;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.submit-btn:disabled {
    background-color: #A0C4F1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.modal-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 2rem;
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    animation: zoomIn 0.3s ease;
}

.close-btn {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.close-btn:hover {
    opacity: 0.7;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 1rem;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1001;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.prev-btn {
    left: -60px;
}

.next-btn {
    right: -60px;
}

.modal-info {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.image-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.image-counter {
    font-size: 1rem;
    opacity: 0.8;
}

/* 底部样式 */
.footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 4rem;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .header-actions {
        gap: 1rem;
    }

    .upload-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .category-list {
        gap: 1rem;
    }

    .category-item {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    /* 上传模态框响应式 */
    .upload-modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .cancel-btn,
    .submit-btn {
        width: 100%;
    }

    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }

    .modal-image-container {
        margin: 0 1rem;
    }

    .nav-btn {
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
    }

    .prev-btn {
        left: -10px;
    }

    .next-btn {
        right: -10px;
    }

    .close-btn {
        top: -30px;
        font-size: 2rem;
    }

    .modal-info {
        bottom: -50px;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .image-title {
        font-size: 1rem;
    }

    .image-counter {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-item img {
        height: 250px;
    }

    .category-list {
        flex-wrap: wrap;
        justify-content: center;
    }

    .modal-image {
        max-height: 70vh;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1.2rem;
    color: #666;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4A90E2;
    border-radius: 50%;
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #4A90E2;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #357ABD;
}

/* 隐藏/显示动画 */
.gallery-item.hide {
    display: none;
}

.gallery-item.show {
    display: block;
    animation: fadeInUp 0.6s ease forwards;
}