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

:root {
    --primary-color: #d4af37;
    --primary-light: #e8d48a;
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --bg-main: #faf9f6;
    --bg-white: #fff;
    --border-color: #e0e0e0;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 20px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
    --max-width: 1200px;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== 顶部导航栏 ===== */
.top-nav {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-light);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 28px;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 2px;
}

.logo p {
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: 4px;
}

.search-box {
    display: flex;
    gap: 10px;
    width: 400px;
}

.search-input {
    flex: 1;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.search-btn:hover {
    background: #c49b2f;
    transform: translateY(-1px);
}

/* ===== Banner区域 ===== */
.banner {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
    padding: 80px 0;
    text-align: center;
}

.banner-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.banner h2 {
    font-size: 42px;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 3px;
    margin-bottom: 15px;
}

.banner p {
    font-size: 18px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

/* ===== 通用区域样式 ===== */
.categories-section,
.images-section {
    max-width: var(--max-width);
    margin: 0 auto 50px;
    padding: 0 20px;
}

.section-header {
    text-align: center;
    margin: 50px 0 30px;
}

.section-header h2 {
    font-size: 28px;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    margin: 0 auto;
    border-radius: 2px;
}

/* ===== 分类区域 ===== */
.categories-wrapper {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.category-group {
    margin-bottom: 20px;
}

.category-group-title {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 20px;
    padding-left: 15px;
    border-left: 4px solid var(--primary-color);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-color);
}

.category-name {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
}

.category-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.category-count {
    display: inline-block;
    font-size: 12px;
    color: var(--text-muted);
    background: #f5f5f5;
    padding: 4px 12px;
    border-radius: 15px;
}

/* ===== 图片网格 ===== */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.image-card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.image-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-color);
}

.image-wrapper {
    height: 220px;
    overflow: hidden;
    position: relative;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.image-card:hover .image-wrapper img {
    transform: scale(1.1);
}

.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
    color: var(--text-muted);
}

.image-placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.image-info {
    padding: 18px;
}

.image-title {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    font-size: 12px;
    color: var(--primary-color);
    background: rgba(212, 175, 55, 0.1);
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition);
}

.page-btn:hover:not(.active):not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

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

/* ===== 弹窗 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 16px;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .modal-body {
        flex-direction: row;
    }
}

.modal-image-wrapper {
    flex: 1;
    min-height: 300px;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.modal-image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-info {
    padding: 30px;
    flex: 0 0 350px;
    overflow-y: auto;
}

.modal-info h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.modal-info p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 20px;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.modal-actions {
    margin-top: 20px;
}

.btn-primary {
    width: 100%;
    padding: 14px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: #c49b2f;
}

/* ===== 页脚 ===== */
.footer {
    background: #333;
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-top: 50px;
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.footer p {
    font-size: 14px;
    color: #999;
    letter-spacing: 1px;
}

/* ===== 加载状态 ===== */
.loading-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

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

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 16px;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .nav-content {
        flex-direction: column;
        gap: 15px;
    }

    .search-box {
        width: 100%;
    }

    .banner h2 {
        font-size: 28px;
    }

    .banner p {
        font-size: 14px;
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    .image-wrapper {
        height: 160px;
    }

    .modal-info {
        flex: none;
        max-height: 40vh;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 22px;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .section-header h2 {
        font-size: 22px;
    }
}
