/**
 * 前端商城展示样式
 * 版本：v1.0 (2025-12-18)
 */

/* 商城容器 */
.mall-display-container {
    position: fixed;
    top: 60px;
    right: 0;
    width: 85%;
    height: calc(100vh - 60px);
    background: #f5f5f5;
    z-index: 9999;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

/* 商城头部 */
.mall-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.mall-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.mall-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
}

.mall-close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

/* 筛选按钮 */
.mall-filters {
    background: white;
    padding: 15px 30px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.mall-filter-btn {
    padding: 8px 20px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.mall-filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.mall-filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

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

/* 商品卡片 */
.mall-product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s;
    cursor: pointer;
}

.mall-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.product-cover {
    position: relative;
    width: 100%;
    height: 200px;
    background: #f5f5f5;
    overflow: hidden;
}

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

.mall-product-card:hover .product-cover img {
    transform: scale(1.05);
}

.product-cover .no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

.video-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.product-info {
    padding: 16px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-category {
    font-size: 12px;
    color: #999;
    margin: 0 0 4px 0;
}

.product-medicine-food {
    font-size: 12px;
    color: #52c41a;
    margin: 0 0 12px 0;
}

.product-price {
    margin: 12px 0;
}

.product-price .price {
    font-size: 24px;
    font-weight: 700;
    color: #f5222d;
}

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

.btn-view-detail,
.btn-add-cart {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-view-detail {
    background: #f0f0f0;
    color: #666;
}

.btn-view-detail:hover {
    background: #e0e0e0;
}

.btn-add-cart {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-add-cart:hover {
    opacity: 0.9;
}

/* 库存相关样式 */
.mall-product-card.out-of-stock {
    opacity: 0.7;
}

.mall-product-card.out-of-stock .product-cover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px 12px 0 0;
}

.stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

.stock-badge.out {
    background: #ff4d4f;
    color: white;
}

.stock-info {
    font-size: 12px;
    color: #52c41a;
    margin-left: 8px;
}

.stock-info.no-stock {
    color: #ff4d4f;
}

.product-price {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.btn-add-cart.disabled {
    background: #d9d9d9;
    color: #999;
    cursor: not-allowed;
}

.btn-add-cart.disabled:hover {
    opacity: 1;
}

/* 分页 */
.mall-pagination {
    padding: 20px 30px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 36px;
}

.page-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.page-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.page-ellipsis {
    color: #999;
    padding: 0 4px;
}

/* 加载状态 */
.mall-products-grid .loading,
.mall-products-grid .empty,
.mall-products-grid .error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

.mall-products-grid .error {
    color: #f5222d;
}

/* 商品详情弹窗 */
.mall-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mall-detail-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.mall-detail-modal .modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 2;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(0,0,0,0.7);
    transform: rotate(90deg);
}

.detail-media {
    width: 100%;
    background: #f5f5f5;
}

.no-media {
    padding: 100px 20px;
    text-align: center;
    color: #999;
}

.detail-info {
    padding: 30px;
}

.detail-info h2 {
    margin: 0 0 12px 0;
    font-size: 24px;
    color: #333;
}

.detail-code {
    font-size: 14px;
    color: #999;
    margin: 0 0 8px 0;
}

.detail-category,
.detail-medicine-food {
    font-size: 14px;
    color: #666;
    margin: 0 0 8px 0;
}

.detail-medicine-food {
    color: #52c41a;
}

.detail-price {
    font-size: 32px;
    font-weight: 700;
    color: #f5222d;
    margin: 20px 0;
}

.detail-description,
.detail-medicine-info {
    margin: 24px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.detail-description h3,
.detail-medicine-info h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
}

.detail-description p,
.detail-medicine-info p {
    margin: 8px 0;
    line-height: 1.6;
    color: #666;
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-buy-now,
.detail-actions .btn-add-cart {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-buy-now {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.btn-buy-now:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.detail-actions .btn-add-cart {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.detail-actions .btn-add-cart:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* 响应式 */
@media (max-width: 1200px) {
    .mall-display-container {
        width: 95%;
    }

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

@media (max-width: 768px) {
    .mall-display-container {
        width: 100%;
        top: 0;
        height: 100vh;
    }

    .mall-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        padding: 15px;
        gap: 12px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .detail-info {
        padding: 20px;
    }
}
