/**
 * Product Archive Page Styles
 * Apple-style product listing with sidebar navigation
 */

/* 产品归档容器 */
.product-archive-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--apple-spacing-md, 24px);
    background: var(--apple-white, #ffffff);
}

/* 归档页面标题区域 */
.archive-header {
    padding: var(--apple-spacing-lg, 40px) 0 var(--apple-spacing-md, 24px);
    text-align: center;
    border-bottom: 1px solid var(--apple-gray-light, #f5f5f7);
    margin-bottom: var(--apple-spacing-md, 24px);
}

.archive-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--apple-text-primary, #1d1d1f);
    margin: 0 0 var(--apple-spacing-sm, 16px) 0;
    letter-spacing: -0.02em;
}

.archive-subtitle {
    font-size: 1.25rem;
    color: var(--apple-text-secondary, #86868b);
    margin: 0 0 var(--apple-spacing-lg, 40px) 0;
    font-weight: 400;
}


/* 主内容区域布局 */
.archive-main-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--apple-spacing-xl, 60px);
    align-items: start;
}

/* 左侧边栏 */
.product-sidebar {
    position: sticky;
    top: var(--apple-spacing-lg, 40px);
    background: var(--apple-white, #ffffff);
    border: 1px solid var(--apple-gray-light, #f5f5f7);
    border-radius: var(--apple-radius-lg, 18px);
    padding: var(--apple-spacing-lg, 40px) var(--apple-spacing-md, 24px);
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: var(--apple-spacing-lg, 40px);
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--apple-text-primary, #1d1d1f);
    margin: 0 0 var(--apple-spacing-sm, 16px) 0;
}

/* 分类导航 */
.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-item {
    margin-bottom: 8px;
}

.category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--apple-radius-md, 12px);
    text-decoration: none;
    color: var(--apple-text-primary, #1d1d1f);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.category-link:hover {
    background: var(--apple-gray-light, #f5f5f7);
    color: var(--apple-blue, #007aff);
}

.category-item.active .category-link {
    background: var(--apple-blue, #007aff);
    color: var(--apple-white, #ffffff);
    border-color: var(--apple-blue, #007aff);
}

.category-name {
    font-weight: 500;
    font-size: 14px;
}

.category-count {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.category-item.active .category-count {
    background: rgba(255, 255, 255, 0.3);
}

/* 高级筛选 */
.filter-group {
    margin-bottom: var(--apple-spacing-md, 24px);
}

.filter-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--apple-text-primary, #1d1d1f);
    margin: 0 0 12px 0;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--apple-text-primary, #1d1d1f);
    position: relative;
    padding-left: 28px;
}

.filter-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 18px;
    width: 18px;
    background: var(--apple-white, #ffffff);
    border: 2px solid var(--apple-gray-medium, #a1a1a6);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.filter-option:hover input ~ .checkmark {
    border-color: var(--apple-blue, #007aff);
}

.filter-option input:checked ~ .checkmark {
    background: var(--apple-blue, #007aff);
    border-color: var(--apple-blue, #007aff);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.filter-option input:checked ~ .checkmark:after {
    display: block;
}

/* 重置按钮 */
.reset-filters-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--apple-gray-light, #f5f5f7);
    border: 1px solid var(--apple-gray-medium, #a1a1a6);
    border-radius: var(--apple-radius-md, 12px);
    color: var(--apple-text-primary, #1d1d1f);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-filters-btn:hover {
    background: var(--apple-gray-medium, #a1a1a6);
    color: var(--apple-white, #ffffff);
}

/* 移动端侧边栏切换 */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: var(--apple-spacing-lg, 40px);
    right: var(--apple-spacing-lg, 40px);
    background: var(--apple-blue, #007aff);
    color: var(--apple-white, #ffffff);
    border: none;
    border-radius: 50px;
    padding: 16px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--apple-shadow-lg);
    z-index: 1000;
    align-items: center;
    gap: 8px;
}

.toggle-icon {
    width: 20px;
    height: 2px;
    background: currentColor;
    position: relative;
}

.toggle-icon::before,
.toggle-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: currentColor;
    transition: all 0.3s ease;
}

.toggle-icon::before {
    top: -6px;
}

.toggle-icon::after {
    bottom: -6px;
}

/* 产品主区域 */
.product-main-area {
    min-height: 600px;
}

/* 产品工具栏 */
.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--apple-spacing-md, 24px) 0;
    border-bottom: 1px solid var(--apple-gray-light, #f5f5f7);
    margin-bottom: var(--apple-spacing-lg, 40px);
}

.results-count {
    font-size: 16px;
    color: var(--apple-text-secondary, #86868b);
    font-weight: 500;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--apple-spacing-md, 24px);
    flex-shrink: 0;
    min-width: fit-content;
}

/* 排序选择器 */
.sort-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-width: fit-content;
}

.sort-label {
    font-size: 14px;
    color: var(--apple-text-secondary, #86868b);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.sort-select {
    padding: 8px 16px;
    border: 1px solid var(--apple-gray-light, #f5f5f7);
    border-radius: var(--apple-radius-md, 12px);
    background: var(--apple-white, #ffffff);
    font-size: 14px;
    color: var(--apple-text-primary, #1d1d1f);
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    min-width: 120px;
}

.sort-select:focus {
    border-color: var(--apple-blue, #007aff);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

/* 视图切换器 */
.view-switcher {
    display: flex;
    background: var(--apple-gray-light, #f5f5f7);
    border-radius: var(--apple-radius-md, 12px);
    padding: 4px;
}

.view-btn {
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: var(--apple-radius-sm, 8px);
    color: var(--apple-text-secondary, #86868b);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    color: var(--apple-text-primary, #1d1d1f);
}

.view-btn.active {
    background: var(--apple-white, #ffffff);
    color: var(--apple-blue, #007aff);
    box-shadow: var(--apple-shadow-sm);
}

/* 产品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--apple-spacing-lg, 40px);
    margin-bottom: var(--apple-spacing-xl, 60px);
}

.products-grid.list-view {
    grid-template-columns: 1fr;
    gap: var(--apple-spacing-md, 24px);
}

/* 产品卡片 */
.product-card {
    background: var(--apple-white, #ffffff);
    border: 1px solid var(--apple-gray-light, #f5f5f7);
    border-radius: var(--apple-radius-lg, 18px);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--apple-shadow-lg);
    border-color: var(--apple-blue, #007aff);
}

.product-card-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 产品图片区域 */
.product-image-container {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--apple-gray-light, #f5f5f7);
}

.product-image-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--apple-text-tertiary, #a1a1a6);
}

/* 产品徽章 */
.product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
}

.product-badge {
    background: var(--apple-blue, #007aff);
    color: var(--apple-white, #ffffff);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* 产品悬停层 */
.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.quick-view-btn {
    background: var(--apple-white, #ffffff);
    color: var(--apple-text-primary, #1d1d1f);
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    user-select: none;
}

.quick-view-btn:hover {
    background: var(--apple-blue, #007aff);
    color: var(--apple-white, #ffffff);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.3);
}

.quick-view-btn:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 图片数量指示器 */
.gallery-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--apple-white, #ffffff);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(10px);
}

/* 产品信息区域 */
.product-info {
    padding: var(--apple-spacing-md, 24px);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--apple-spacing-sm, 16px);
}

.product-title {
    margin: 0;
}

.product-title-link {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--apple-text-primary, #1d1d1f);
    text-decoration: none;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.product-title-link:hover {
    color: var(--apple-blue, #007aff);
}

.product-excerpt {
    color: var(--apple-text-secondary, #86868b);
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
}

/* 产品规格 */
.product-specs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.spec-label {
    color: var(--apple-text-secondary, #86868b);
    font-weight: 500;
}

.spec-value {
    color: var(--apple-text-primary, #1d1d1f);
    font-weight: 600;
}

/* 产品特色标签 */
.product-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feature-tag {
    background: var(--apple-gray-light, #f5f5f7);
    color: var(--apple-text-primary, #1d1d1f);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.feature-more {
    background: var(--apple-blue, #007aff);
    color: var(--apple-white, #ffffff);
    padding: 4px 8px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}


/* 无结果状态 */
.no-products-found {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--apple-spacing-xl, 60px) var(--apple-spacing-md, 24px);
    color: var(--apple-text-secondary, #86868b);
}

.no-products-icon {
    margin-bottom: var(--apple-spacing-md, 24px);
    opacity: 0.5;
}

.no-products-found h3 {
    font-size: 1.5rem;
    color: var(--apple-text-primary, #1d1d1f);
    margin-bottom: var(--apple-spacing-sm, 16px);
}

.no-products-found p {
    font-size: 1rem;
    margin: 0;
}

/* 分页导航 */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: var(--apple-spacing-xl, 60px);
}

.pagination-container .page-numbers {
    list-style: none;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    background: none !important; /* 确保ul没有背景色 */
    border: none !important; /* 确保ul没有边框 */
    box-shadow: none !important; /* 去除ul的阴影 */
}

.pagination-container .page-numbers li {
    margin: 0;
    background: none !important; /* 确保li没有背景色 */
    border: none !important; /* 确保li没有边框 */
    color: inherit !important; /* 确保li文字颜色不被覆盖 */
    box-shadow: none !important; /* 确保li没有阴影 */
}

.pagination-container .page-numbers a,
.pagination-container .page-numbers span {
    display: block;
    padding: 12px 16px;
    border: 1px solid var(--apple-gray-light, #f5f5f7);
    border-radius: var(--apple-radius-md, 12px);
    color: var(--apple-text-primary, #1d1d1f);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 48px;
    text-align: center;
    background: var(--apple-white, #ffffff); /* 明确设置背景色 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* 给每个按钮添加阴影 */
}

/* 只对链接和span元素应用hover效果，不对ul或li应用 */
.pagination-container .page-numbers a:hover {
    background: var(--apple-blue, #007aff);
    color: var(--apple-white, #ffffff);
    border-color: var(--apple-blue, #007aff);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3); /* hover时加强阴影 */
}

/* 当前激活页面的样式 - 使用更高优先级确保不被其他hover样式覆盖 */
.pagination-container .page-numbers .current,
.pagination-container .page-numbers .current:hover,
.pagination-container:hover .page-numbers .current {
    background: var(--apple-blue, #007aff) !important;
    color: var(--apple-white, #ffffff) !important;
    border-color: var(--apple-blue, #007aff) !important;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4) !important; /* 激活状态的阴影 */
}

/* 强制防止ul和li元素的所有hover样式 */
.pagination-container .page-numbers:hover {
    background: none !important;
    border: none !important;
    color: inherit !important;
}

.pagination-container .page-numbers li:hover {
    background: none !important;
    border: none !important;
    color: inherit !important;
}

/* 防止任何父级hover样式影响分页器 */
.pagination-container:hover .page-numbers {
    background: none !important;
    border: none !important;
}

.pagination-container:hover .page-numbers li {
    background: none !important;
    border: none !important;
    color: inherit !important;
}

/* 加载指示器 */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--apple-white, #ffffff);
    padding: var(--apple-spacing-lg, 40px);
    border-radius: var(--apple-radius-lg, 18px);
    box-shadow: var(--apple-shadow-lg);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: var(--apple-spacing-sm, 16px);
    z-index: 9999;
}

.loading-indicator.show {
    display: flex;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--apple-gray-light, #f5f5f7);
    border-top: 3px solid var(--apple-blue, #007aff);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 列表视图样式 */
.products-grid.list-view .product-card {
    border-radius: var(--apple-radius-md, 12px);
}

.products-grid.list-view .product-card-inner {
    flex-direction: row;
    align-items: center;
}

.products-grid.list-view .product-image-container {
    width: 200px;
    aspect-ratio: 1;
    flex-shrink: 0;
}

.products-grid.list-view .product-info {
    flex: 1;
    padding: var(--apple-spacing-md, 24px);
}


/* 响应式设计 */
@media (max-width: 1024px) {
    .archive-main-content {
        grid-template-columns: 240px 1fr;
        gap: var(--apple-spacing-lg, 40px);
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: var(--apple-spacing-md, 24px);
    }
}

@media (max-width: 768px) {
    .archive-header {
        padding: var(--apple-spacing-lg, 40px) 0 var(--apple-spacing-md, 24px);
    }

    .archive-title {
        font-size: 2rem;
    }

    .archive-subtitle {
        font-size: 1rem;
    }

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

    .product-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: var(--apple-white, #ffffff);
        z-index: 9999;
        transition: left 0.3s ease;
        border-radius: 0;
        border: none;
        box-shadow: var(--apple-shadow-lg);
        max-height: none;
        overflow-y: auto;
    }

    .product-sidebar.open {
        left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: var(--apple-spacing-sm, 16px);
    }

    .products-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--apple-spacing-sm, 16px);
    }

    .toolbar-right {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: var(--apple-spacing-sm, 16px);
    }

    .sort-container {
        gap: 8px;
    }

    .sort-select {
        min-width: 100px;
        padding: 8px 12px;
    }

    .products-grid.list-view .product-card-inner {
        flex-direction: column;
    }

    .products-grid.list-view .product-image-container {
        width: 100%;
        aspect-ratio: 4/3;
    }

}

@media (max-width: 480px) {
    .product-archive-container {
        padding: 0 var(--apple-spacing-sm, 16px);
    }

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


    .product-info {
        padding: var(--apple-spacing-sm, 16px);
    }

}

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

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

/* 打印样式 */
@media print {
    .product-sidebar,
    .sidebar-toggle,
    .products-toolbar,
    .pagination-container,
    .loading-indicator {
        display: none;
    }

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

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

    .product-card {
        break-inside: avoid;
        border: 1px solid #ddd;
    }

    .product-overlay {
        display: none;
    }
}