/**
 * Custom Product Archive Styles
 * Full-width grid layout for WooCommerce products
 */

/* ===== 基础容器 ===== */
.custom-product-archive-wrapper {
    width: 100%;
    background: #f8f9fa;
    padding: 40px 0;
}

.custom-product-archive-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 页面头部 ===== */
.custom-archive-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #883E74 0%, #6d3159 100%);
    border-radius: 12px;
    color: white;
}

.archive-breadcrumb {
    font-size: 14px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.archive-breadcrumb a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.archive-breadcrumb a:hover {
    opacity: 0.8;
}

.archive-breadcrumb .separator {
    margin: 0 8px;
}

.archive-breadcrumb .current {
    font-weight: 600;
}

.archive-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: white;
}

.archive-subtitle {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.95;
}

/* ===== 控制栏 ===== */
.archive-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    flex-wrap: wrap;
}

.controls-left {
    flex: 1;
    min-width: 300px;
}

.controls-right {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

/* 分类筛选 */
.category-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: #e9ecef;
    border-color: #883E74;
    color: #883E74;
}

.filter-btn.active {
    background: #883E74;
    border-color: #883E74;
    color: white;
}

.filter-icon {
    font-size: 18px;
}

/* 搜索框 */
.search-box {
    position: relative;
    width: 250px;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #883E74;
    box-shadow: 0 0 0 3px rgba(136, 62, 116, 0.1);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    pointer-events: none;
}

/* 排序选择 */
.sort-select select {
    padding: 10px 35px 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23495057' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}

.sort-select select:focus {
    outline: none;
    border-color: #883E74;
    box-shadow: 0 0 0 3px rgba(136, 62, 116, 0.1);
}

/* 视图切换 */
.view-toggle {
    display: flex;
    gap: 5px;
    background: #f8f9fa;
    padding: 5px;
    border-radius: 8px;
}

.view-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background: white;
    color: #883E74;
}

.view-btn.active {
    background: white;
    color: #883E74;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 产品结果计数 */
.products-result-count {
    margin-bottom: 20px;
    padding: 0 5px;
}

.products-result-count span {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

/* ===== 产品网格 ===== */
.products-grid-wrapper {
    position: relative;
}

.products-grid {
    display: grid;
    gap: 25px;
    margin-bottom: 40px;
}

/* 网格视图 */
.products-grid.view-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* 列表视图 */
.products-grid.view-list {
    grid-template-columns: 1fr;
}

.products-grid.view-list .product-card {
    display: flex;
}

.products-grid.view-list .product-card-inner {
    display: flex;
    flex-direction: row;
    width: 100%;
}

.products-grid.view-list .product-image {
    width: 300px;
    flex-shrink: 0;
}

.products-grid.view-list .product-info {
    flex: 1;
    padding: 20px;
}

.products-grid.view-list .product-excerpt {
    display: block;
}

/* ===== 产品卡片 ===== */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 产品图片 */
.product-image {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    /* aspect-ratio: 4/3; */
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

/* 产品信息 */
.product-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.4;
    min-height: 50px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title a:hover {
    color: #883E74;
}

/* 产品分类 */
.product-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.product-category {
    display: inline-block;
    padding: 4px 10px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
}

/* 产品摘要 */
.product-excerpt {
    font-size: 14px;
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 15px;
    display: none; /* 默认隐藏，列表视图显示 */
}

/* 产品价格 */
.product-price {
    margin-bottom: 15px;
    margin-top: auto;
}

.price-label {
    font-size: 16px;
    font-weight: 700;
    color: #883E74;
}

/* 产品按钮 */
.product-actions {
    display: flex;
    gap: 10px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #883E74;
    color: white;
}

.btn-primary:hover {
    background: #6d3159;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(136, 62, 116, 0.3);
}

.btn-secondary {
    background: white;
    color: #883E74;
    border: 2px solid #883E74;
}

.btn-secondary:hover {
    background: #883E74;
    color: white;
    border-color: #883E74;
}

/* ===== 加载更多按钮 ===== */
.load-more-wrapper {
    text-align: center;
    margin: 40px 0;
}

.btn-load-more {
    padding: 15px 40px;
    background: #883E74;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-load-more:hover {
    background: #6d3159;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(136, 62, 116, 0.3);
}

.btn-load-more:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* 加载动画 */
.spinner {
    animation: spin 1s linear infinite;
}

.spinner circle {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* 加载指示器 */
#loading-indicator {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-spinner p {
    color: #6c757d;
    font-size: 14px;
}

/* 无更多产品 */
#no-more-products {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 14px;
}

/* 无产品找到 */
.no-products-found {
    text-align: center;
    padding: 80px 20px;
    grid-column: 1 / -1;
}

.no-products-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.no-products-found h3 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.no-products-found p {
    color: #6c757d;
    font-size: 1rem;
}

/* ===== 询盘弹窗 ===== */
.inquiry-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.inquiry-modal.show {
    display: flex;
}

.inquiry-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: 300;
    color: #ffffff;
    background: rgba(136, 62, 116, 0.8);
    border: none;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    line-height: 1;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.modal-close:hover {
    background: #883E74;
    transform: rotate(90deg);
}

.modal-header {
    padding: 40px 40px 20px 40px;
    text-align: center;
}

.modal-header h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin: 0 0 10px 0;
}

.modal-header p {
    color: #6c757d;
    margin: 0;
}

.modal-body {
    padding: 0 40px 40px 40px;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .products-grid.view-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 992px) {
    .archive-controls {
        flex-direction: column;
    }

    .controls-left,
    .controls-right {
        width: 100%;
    }

    .controls-right {
        justify-content: space-between;
    }

    .products-grid.view-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .custom-product-archive-container {
        padding: 0 15px;
    }

    .archive-title {
        font-size: 2rem;
    }

    .archive-subtitle {
        font-size: 1rem;
    }

    .products-grid.view-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .products-grid.view-list .product-card-inner {
        flex-direction: column;
    }

    .products-grid.view-list .product-image {
        width: 100%;
    }

    .product-info {
        padding: 15px;
    }

    .product-title {
        font-size: 1rem;
        min-height: 40px;
    }

    .product-actions {
        flex-direction: column;
    }

    .floating-inquiry-btn {
        bottom: 20px;
        right: 20px;
    }

    .float-text {
        display: none;
    }

    .float-btn {
        width: 60px;
        height: 60px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .modal-header,
    .modal-body {
        padding: 30px 20px;
    }

    .search-box {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-grid.view-grid {
        grid-template-columns: 1fr;
    }

    .category-filter {
        justify-content: center;
    }

    .filter-btn {
        font-size: 13px;
        padding: 8px 15px;
    }

    .archive-controls {
        padding: 15px;
    }
}
