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

:root {
    --primary-color: #8b4513;
    --primary-light: #a0522d;
    --primary-dark: #5d2e0d;
    --secondary-color: #d4a574;
    --accent-color: #c9a961;
    --bg-color: #faf8f5;
    --card-bg: #ffffff;
    --text-color: #2c1810;
    --text-light: #6b5344;
    --border-color: #e8e0d5;
    --shadow: 0 4px 20px rgba(139, 69, 19, 0.1);
    --shadow-hover: 0 8px 30px rgba(139, 69, 19, 0.2);
    --radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Noto Serif SC', serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.search-box {
    flex: 1;
    max-width: 500px;
    display: flex;
    gap: 0.5rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.search-box button {
    padding: 0.75rem 1.5rem;
    background: var(--accent-color);
    color: var(--primary-dark);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.search-box button:hover {
    background: var(--secondary-color);
}

.stats {
    font-size: 1rem;
    opacity: 0.9;
}

.stats span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* 主内容区 */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 200px);
}

/* 侧边栏 */
.sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.filter-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-section h3 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 300px;
    overflow-y: auto;
}

.category-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 0.9rem;
    color: var(--text-light);
}

.category-item:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.category-item.active {
    background: var(--primary-color);
    color: white;
}

.category-item.level-1 {
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-item.level-1 .arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.category-item.level-1.expanded .arrow {
    transform: rotate(90deg);
}

.category-item.level-2 {
    padding-left: 1.5rem;
    font-size: 0.85rem;
    display: none;
}

.category-item.level-2.show {
    display: block;
}

.type-filter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-item input {
    accent-color: var(--primary-color);
}

select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
    cursor: pointer;
    outline: none;
}

select:focus {
    border-color: var(--primary-color);
}

.reset-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.reset-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* 藏品网格 */
.collection-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* 藏品卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: var(--border-color);
}

.card-body {
    padding: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.card-tag {
    padding: 0.25rem 0.5rem;
    background: var(--bg-color);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-light);
}

.card-tag.type-collection {
    background: rgba(139, 69, 19, 0.1);
    color: var(--primary-color);
}

.card-tag.type-seeking {
    background: rgba(201, 169, 97, 0.2);
    color: #8b7355;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.card-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.card-price.no-price {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-light);
}

.card-nickname {
    font-size: 0.8rem;
    color: var(--text-color);
    background: var(--bg-light);
    padding: 0.15rem 0rem;
    border-radius: 4px;
}

.card-region {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* 加载更多 */
.load-more {
    text-align: center;
    padding: 2rem;
}

.load-more button {
    padding: 1rem 3rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.load-more button:hover {
    background: var(--primary-light);
}

.load-more button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    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: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: var(--bg-color);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

.modal-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-color);
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
    flex-shrink: 0;
}

.thumbnail:hover,
.thumbnail.active {
    opacity: 1;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-info h2 {
    font-size: 1.5rem;
    color: var(--text-color);
    font-weight: 600;
}

.info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.tag.nickname-tag {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.tag.category-tag {
    background: var(--primary-color);
    color: white;
}

.tag.type-tag {
    background: var(--accent-color);
    color: var(--primary-dark);
}

.tag.region-tag {
    background: var(--bg-color);
    color: var(--text-light);
}

.info-section {
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.info-section h4 {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.info-section p {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

/* 页脚 */
.footer {
    background: var(--primary-dark);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

/* 响应式设计 */

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 28px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* 侧边栏头部 */
.sidebar-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin: 0;
}

.sidebar-qrcode {
    text-align: center;
    padding: 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--bg-color), var(--bg-light));
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.sidebar-qrcode img {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.sidebar-qrcode p {
    font-size: 0.85rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 500;
}

.sidebar-close {
    width: 36px;
    height: 36px;
    background: var(--bg-color);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: var(--transition);
}

.sidebar-close:hover {
    background: var(--primary-color);
    color: white;
}

@media (max-width: 1024px) {
    .menu-toggle {
        display: flex;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar-overlay {
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        z-index: 200;
        border-radius: 0;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding-top: 1.5rem;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-header {
        display: flex;
    }

    .filter-section {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--border-color);
        border-right: none;
        padding-right: 0;
    }

    .filter-section:last-of-type {
        border-bottom: 1px solid var(--border-color);
    }

    .reset-btn {
        margin-top: 1rem;
    }

    .collection-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .header-left {
        width: 100%;
    }

    .search-box {
        width: 100%;
        max-width: none;
    }

    .stats {
        font-size: 0.9rem;
    }

    .stats span {
        font-size: 1.2rem;
    }

    .modal-body {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .modal-content {
        max-height: 85vh;
        margin: 0.5rem;
    }

    .modal-info h2 {
        font-size: 1.25rem;
    }

    .info-section {
        padding: 0.75rem;
    }

    .info-section h4 {
        font-size: 0.85rem;
    }

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

    /* 卡片底部移动端优化 */
    .card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .card-price {
        font-size: 1rem;
    }

    .card-nickname {
        font-size: 0.75rem;
    }

    .card-region {
        font-size: 0.75rem;
    }

    /* 二维码弹窗移动端 */
    .qrcode-content {
        padding: 1.5rem;
        max-width: 280px;
    }

    .qrcode-image {
        width: 160px;
        height: 160px;
    }

    /* 页脚移动端 */
    .footer {
        padding: 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    .stats {
        font-size: 0.8rem;
        text-align: center;
    }

    .stats span {
        font-size: 1rem;
    }

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

    /* 卡片底部小屏优化 */
    .card-footer {
        padding-top: 0.5rem;
    }

    .card-price.no-price {
        font-size: 0.8rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .card-title {
        font-size: 0.95rem;
    }

    .card-desc {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .card-meta {
        gap: 0.35rem;
        margin-bottom: 0.5rem;
    }

    .card-tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    /* 详情弹窗小屏优化 */
    .modal-content {
        max-height: 90vh;
        margin: 0;
        border-radius: 0;
    }

    .modal-body {
        padding: 0.75rem;
    }

    .main-image img {
        max-height: 250px;
    }

    .modal-info h2 {
        font-size: 1.1rem;
    }

    .tag {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .info-tags {
        gap: 0.35rem;
    }

    /* 二维码弹窗小屏 */
    .qrcode-content {
        padding: 1rem;
        max-width: 260px;
    }

    .qrcode-content h3 {
        font-size: 1rem;
    }

    .qrcode-image {
        width: 140px;
        height: 140px;
    }

    .phone-display {
        font-size: 1rem;
        padding: 0.5rem;
    }

    /* 页脚小屏 */
    .footer {
        padding: 0.75rem;
        font-size: 0.75rem;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1.1rem;
}

/* 联系方式解锁按钮 */
.contact-text {
    margin-bottom: 0.5rem;
}

.unlock-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
}

.unlock-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.unlock-icon {
    font-size: 1rem;
}

/* 二维码弹窗 */
.qrcode-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.qrcode-modal.active {
    display: flex;
}

.qrcode-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    position: relative;
    max-width: 320px;
    width: 100%;
    animation: qrcodeIn 0.3s ease;
}

@keyframes qrcodeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.qrcode-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    background: var(--bg-color);
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.qrcode-close:hover {
    background: var(--primary-color);
    color: white;
}

.qrcode-content h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.qrcode-image {
    width: 200px;
    height: 200px;
    margin: 0 auto 1rem;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
}

.qrcode-image canvas {
    max-width: 100%;
    max-height: 100%;
}

.qrcode-tip {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.phone-display {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 8px;
    letter-spacing: 0.1em;
}

/* 移动端底栏 */
.mobile-tabbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    z-index: 500;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
}

.tabbar-item:active {
    background: var(--bg-color);
}

.tabbar-icon {
    font-size: 1.25rem;
    margin-bottom: 0.2rem;
}

.tabbar-text {
    font-size: 0.7rem;
    color: var(--text-light);
}

.tabbar-item:active .tabbar-text {
    color: var(--primary-color);
}

/* 底栏弹窗 */
.tabbar-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.tabbar-modal.active {
    display: flex;
}

.tabbar-modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    max-width: 320px;
    width: 100%;
    animation: modalIn 0.3s ease;
}

.tabbar-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    background: var(--bg-color);
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.tabbar-modal-close:hover {
    background: var(--primary-color);
    color: white;
}

.tabbar-modal-content h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.tabbar-modal-image {
    width: 200px;
    height: 200px;
    margin: 0 auto 1rem;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    overflow: hidden;
}

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

.tabbar-modal-tip {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

@media (max-width: 768px) {
    .mobile-tabbar {
        display: flex;
    }

    .footer {
        padding-bottom: 4rem;
    }
}
