/* 前台展示样式 */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: 70px;
}

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

/* 头部导航 */
.header {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 24px;
}

.logo {
    text-decoration: none;
    flex-shrink: 0;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-box {
    flex: 1;
    max-width: 500px;
    display: flex;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 16px;
    padding-right: 50px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-box button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-box button svg {
    color: white;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

.user-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-area .user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.user-area .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

/* 移动端顶部导航 */
.mobile-header {
    display: none;
    background: white;
    height: 50px;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-header span {
    font-weight: 600;
}

.mobile-header button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.mobile-search-bar {
    display: none;
    background: white;
    padding: 12px 16px;
    gap: 12px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-search-bar .search-box {
    flex: 1;
    max-width: none;
}

/* 移动端底部导航 */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.mobile-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
}

.mobile-nav a.active {
    color: var(--primary-color);
}

.mobile-nav svg {
    margin-bottom: 2px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-color);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 公告区域 */
.announcements {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px 0;
}

.announcement-slider {
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.announcement-slider::before {
    content: '公告';
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 500;
    flex-shrink: 0;
}

/* 分类导航 */
.category-nav {
    background: white;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.category-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.category-scroll::-webkit-scrollbar {
    height: 4px;
}

.category-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 70px;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s;
}

.category-item:hover {
    transform: translateY(-2px);
}

.category-item img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--bg-color);
}

.category-item span {
    font-size: 12px;
    white-space: nowrap;
}

/* 热门标签 */
.hot-tags {
    padding: 20px 0;
}

.hot-tags h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-link {
    padding: 6px 14px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.tag-link:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 商品区域 */
.products-section {
    padding: 24px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

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

.sort-options {
    display: flex;
    gap: 8px;
}

.sort-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* 商品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.product-card .image-wrapper {
    position: relative;
    padding-top: 100%;
    background: var(--bg-color);
}

.product-card .image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card .info {
    padding: 14px;
}

.product-card .title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 10px;
}

.product-card .meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-card .price {
    color: var(--danger-color);
    font-size: 18px;
    font-weight: 600;
}

.product-card .price::before {
    content: '¥';
    font-size: 12px;
}

.product-card .commission {
    font-size: 12px;
    color: var(--success-color);
    background: #d1fae5;
    padding: 2px 8px;
    border-radius: 4px;
}

.product-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.product-card .tag {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 2px 8px;
    border-radius: 4px;
}

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* 商品详情页 */
.product-detail-page {
    padding-top: 0;
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 24px 0;
}

.product-gallery {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.main-image {
    position: relative;
    padding-top: 100%;
    cursor: zoom-in;
}

.main-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-color);
}

.thumbnail-list {
    display: flex;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
}

.thumbnail-list img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.thumbnail-list img.active,
.thumbnail-list img:hover {
    border-color: var(--primary-color);
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-info .title {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.4;
}

.product-info .price-section {
    background: linear-gradient(135deg, #fff5f5 0%, #fff0f0 100%);
    padding: 20px;
    border-radius: 12px;
}

.product-info .price {
    font-size: 32px;
    color: var(--danger-color);
    font-weight: 700;
}

.product-info .price::before {
    content: '¥';
    font-size: 18px;
}

.product-info .commission-info {
    margin-top: 8px;
    font-size: 14px;
    color: var(--success-color);
}

.product-info .info-list {
    display: grid;
    gap: 12px;
}

.product-info .info-item {
    display: flex;
    gap: 12px;
}

.product-info .info-item .label {
    color: var(--text-secondary);
    min-width: 80px;
}

.product-info .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.product-info .tag {
    padding: 6px 14px;
    background: var(--bg-color);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.product-info .actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.product-info .actions .btn {
    flex: 1;
    height: 48px;
}

.product-info .favorite-btn {
    border: 1px solid var(--border-color);
    background: white;
}

.product-info .favorite-btn.active {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.product-info .favorite-btn.active svg {
    fill: var(--danger-color);
}

/* 详情图区域 */
.detail-images {
    grid-column: 1 / -1;
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
}

.detail-images h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

.detail-images img {
    width: 100%;
    margin-bottom: 12px;
    border-radius: 8px;
}

/* 自定义字段 */
.custom-fields {
    background: white;
    border-radius: 12px;
    padding: 20px;
}

.custom-fields h3 {
    margin-bottom: 16px;
    font-size: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.field-item {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
}

.field-item:last-child {
    border-bottom: none;
}

.field-item .field-label {
    color: var(--text-secondary);
    min-width: 100px;
}

/* 分类页面 */
.category-page .main-content {
    padding: 0;
}

.category-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.category-sidebar {
    width: 200px;
    background: white;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

.category-list {
    padding: 16px 0;
}

.category-list .cat-item {
    display: block;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.2s;
}

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

.category-list .cat-child {
    padding-left: 36px;
    font-size: 14px;
    color: var(--text-secondary);
}

.category-content {
    flex: 1;
    padding: 24px;
}

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

.category-header h2 {
    font-size: 20px;
}

/* 搜索页 */
.search-page .search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-top: 24px;
}

.search-header h2 {
    font-size: 20px;
}

.result-count {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 收藏页 */
.favorites-page .page-header {
    padding-top: 24px;
    margin-bottom: 24px;
}

.login-required {
    text-align: center;
    padding: 60px 20px;
}

.login-required svg {
    margin-bottom: 16px;
}

.login-required p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* 移动端底部操作栏 */
.product-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    z-index: 100;
}

.product-bottom-bar button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.product-bottom-bar .favorite-btn {
    background: #f1f5f9;
    color: var(--text-color);
}

.product-bottom-bar .favorite-btn.active {
    color: var(--danger-color);
}

.product-bottom-bar .favorite-btn.active svg {
    fill: var(--danger-color);
}

.product-bottom-bar .contact-btn {
    background: var(--primary-color);
    color: white;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-sm {
    max-width: 400px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.modal-body {
    padding: 24px;
}

/* 图片预览 */
.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 300;
    justify-content: center;
    align-items: center;
}

.image-viewer.show {
    display: flex;
}

.image-viewer img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.viewer-nav {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
}

.viewer-nav button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
}

/* Toast提示 */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
}

.toast {
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    margin-bottom: 10px;
    animation: slideDown 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.toast.success { background: var(--success-color); }
.toast.error { background: var(--danger-color); }
.toast.warning { background: var(--warning-color); }
.toast.info { background: var(--primary-color); }

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 联系方式 */
.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 12px;
}

.contact-item:last-child {
    margin-bottom: 0;
}

.contact-item .label {
    color: var(--text-secondary);
    min-width: 80px;
}

.contact-item .value {
    font-weight: 500;
    word-break: break-all;
}

.contact-item .copy-btn {
    margin-left: auto;
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

/* 页脚 */
.footer {
    background: #1e293b;
    color: rgba(255, 255, 255, 0.6);
    padding: 30px 0;
    text-align: center;
    margin-bottom: -70px;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 1024px) {
    .product-detail {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .category-sidebar {
        width: 120px;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 60px;
    }

    .header {
        display: none;
    }

    .mobile-header {
        display: flex;
    }

    .mobile-search-bar {
        display: flex;
    }

    .mobile-nav {
        display: flex;
    }

    .product-bottom-bar {
        display: flex;
        gap: 12px;
    }

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

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-card .info {
        padding: 10px;
    }

    .product-card .title {
        font-size: 13px;
        height: 36px;
    }

    .product-card .price {
        font-size: 16px;
    }

    .product-info .title {
        font-size: 18px;
    }

    .product-info .price {
        font-size: 26px;
    }

    .product-info .actions {
        display: none;
    }

    .detail-images {
        margin-top: 0;
        border-radius: 0;
    }

    .category-layout {
        flex-direction: column;
    }

    .category-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .category-list {
        display: flex;
        overflow-x: auto;
        padding: 0;
    }

    .category-list .cat-item {
        white-space: nowrap;
        padding: 14px 16px;
    }

    .category-list .cat-child {
        display: none;
    }

    .category-content {
        padding: 16px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .sort-options {
        width: 100%;
        overflow-x: auto;
    }

    .sort-btn {
        white-space: nowrap;
    }

    .search-page .search-header {
        padding-top: 16px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .products-grid {
        gap: 10px;
    }

    .product-card .info {
        padding: 8px;
    }

    .product-card .meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .category-item {
        min-width: 60px;
    }

    .category-item img {
        width: 40px;
        height: 40px;
    }
}
