/**
 * Crystal Products Styles - Crystal商品系统样式
 *
 * @package Crystal
 */

/* 商品列表页面样式 */
.crystal-products-archive {
    /* 使用主题现有的样式变量 */
}

.crystal-products-archive .page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.crystal-products-archive .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.crystal-products-archive .product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.crystal-products-archive .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #8b5cf6;
}

.crystal-products-archive .product-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

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

.crystal-products-archive .product-card:hover .product-image img {
    transform: scale(1.05);
}

.crystal-products-archive .product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crystal-products-archive .product-badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crystal-products-archive .product-badge.featured {
    background: linear-gradient(45deg, #f59e0b, #d97706);
}

.crystal-products-archive .product-badge.on-sale {
    background: linear-gradient(45deg, #ef4444, #dc2626);
}

.crystal-products-archive .product-info {
    padding: 1.5rem;
}

.crystal-products-archive .product-category {
    color: #8b5cf6;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.crystal-products-archive .product-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.crystal-products-archive .product-title:hover {
    color: #8b5cf6;
}

.crystal-products-archive .product-description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.crystal-products-archive .product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #8b5cf6;
    margin-bottom: 1rem;
}

.crystal-products-archive .product-price del {
    color: #9ca3af;
    font-weight: 400;
    font-size: 1rem;
    margin-right: 0.5rem;
}

.crystal-products-archive .product-actions {
    display: flex;
    gap: 0.5rem;
}

.crystal-products-archive .btn-view-product {
    flex: 1;
    background: linear-gradient(45deg, #8b5cf6, #7c3aed);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.crystal-products-archive .btn-view-product:hover {
    background: linear-gradient(45deg, #7c3aed, #6d28d9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    color: white;
}

/* 商品详情页面样式 */
.crystal-product-single {
    /* 使用主题现有的样式 */
}

.crystal-product-single .product-gallery {
    position: sticky;
    top: 2rem;
}

.crystal-product-single .product-main-image {
    aspect-ratio: 1;
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
}

.crystal-product-single .product-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.crystal-product-single .product-thumbnail {
    aspect-ratio: 1;
    background: #f9fafb;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.crystal-product-single .product-thumbnail:hover,
.crystal-product-single .product-thumbnail.active {
    border-color: #8b5cf6;
}

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

.crystal-product-single .product-info {
    /* 商品信息区域样式 */
}

.crystal-product-single .product-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.crystal-product-single .product-price {
    font-size: 2rem;
    font-weight: 700;
    color: #8b5cf6;
    margin-bottom: 1.5rem;
}

.crystal-product-single .product-tabs {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

.crystal-product-single .product-tab-nav {
    display: flex;
    gap: 2rem;
}

.crystal-product-single .product-tab-btn {
    padding: 1rem 0;
    border: none;
    background: transparent;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.crystal-product-single .product-tab-btn:hover,
.crystal-product-single .product-tab-btn.active {
    color: #8b5cf6;
    border-bottom-color: #8b5cf6;
}

.crystal-product-single .product-tab-content {
    line-height: 1.7;
    color: #374151;
}

.crystal-product-single .product-attributes {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.crystal-product-single .product-attributes h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

.crystal-product-single .attributes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.crystal-product-single .attribute-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.crystal-product-single .attribute-label {
    font-weight: 600;
    color: #6b7280;
}

.crystal-product-single .attribute-value {
    color: #1f2937;
}

/* 相关商品样式 */
.crystal-product-single .related-products {
    border-top: 1px solid #e5e7eb;
    padding-top: 3rem;
    margin-top: 3rem;
}

.crystal-product-single .related-products h2 {
    text-align: center;
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 2rem;
}

.crystal-product-single .related-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* 搜索和筛选样式 */
.crystal-products-filter {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.crystal-products-filter .filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.crystal-products-filter .search-box {
    flex: 1;
    min-width: 250px;
}

.crystal-products-filter .search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.crystal-products-filter .search-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.crystal-products-filter .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
}

.crystal-products-filter .sort-select {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
}

/* 分页样式 */
.crystal-products-pagination {
    display: flex;
    justify-content: center;
    margin: 3rem 0;
}

.crystal-products-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin: 0 0.25rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.crystal-products-pagination .page-numbers:hover,
.crystal-products-pagination .page-numbers.current {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

.crystal-products-pagination .page-numbers.prev,
.crystal-products-pagination .page-numbers.next {
    font-weight: 600;
}

/* 空状态样式 */
.crystal-products-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.crystal-products-empty .empty-icon {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1.5rem;
}

.crystal-products-empty h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.crystal-products-empty p {
    color: #6b7280;
    margin-bottom: 2rem;
}

.crystal-products-empty .btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #8b5cf6;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.crystal-products-empty .btn-back:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .crystal-products-archive .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .crystal-product-single .product-title {
        font-size: 1.5rem;
    }
    
    .crystal-product-single .product-price {
        font-size: 1.5rem;
    }
    
    .crystal-product-single .product-tab-nav {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .crystal-products-filter .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .crystal-products-filter .search-box {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .crystal-products-archive .products-grid {
        grid-template-columns: 1fr;
    }
    
    .crystal-product-single .product-thumbnails {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 加载动画 */
.crystal-products-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.crystal-products-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #8b5cf6;
    border-radius: 50%;
    animation: crystal-spin 1s linear infinite;
}

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

/* 实用工具类 */
.crystal-fade-in {
    animation: crystal-fadeIn 0.5s ease-in;
}

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

.crystal-slide-up {
    animation: crystal-slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes crystal-slideUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 与主题Tailwind CSS的集成 */
.crystal-products-archive,
.crystal-product-single {
    /* 确保与主题样式兼容 */
    font-family: inherit;
    line-height: inherit;
}

/* 覆盖可能的冲突样式 */
.crystal-products-archive *,
.crystal-product-single * {
    box-sizing: border-box;
}

/* 确保图片响应式 */
.crystal-products-archive img,
.crystal-product-single img {
    max-width: 100%;
    height: auto;
}
