/**
 * iCMS 商城样式文件
 * 基于 Bootstrap 5
 */

/* ==================== 全局样式 ==================== */
:root {
    --shop-primary: #007bff;
    --shop-danger: #dc3545;
    --shop-success: #28a745;
    --shop-warning: #ffc107;
    --shop-info: #17a2b8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
    background-color: #f8f9fa;
}

/* ==================== 导航栏 ==================== */
.navbar {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

/* ==================== 商品卡片 ==================== */
.goods-item {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e9ecef;
}

.goods-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.goods-item .card-img-top {
    transition: transform 0.3s ease;
}

.goods-item:hover .card-img-top {
    transform: scale(1.05);
}

.goods-item .card-body {
    padding: 1rem;
}

.goods-item .card-title {
    font-size: 0.95rem;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ==================== 价格样式 ==================== */
.price {
    color: #ff4757;
    font-size: 1.5rem;
    font-weight: bold;
}

.market-price {
    color: #999;
    text-decoration: line-through;
    font-size: 0.9rem;
}

/* ==================== 分类卡片 ==================== */
.category-card {
    transition: all 0.2s ease;
    border: 1px solid #e9ecef;
}

.category-card:hover {
    background-color: #f8f9fa;
    border-color: var(--shop-primary);
}

/* ==================== 轮播图 ==================== */
.banner-slide {
    min-height: 400px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
}

/* ==================== 购物车 ==================== */
.cart-item {
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 0;
}

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

.cart-summary {
    position: sticky;
    top: 20px;
}

/* ==================== 规格按钮 ==================== */
.spec-btn {
    margin: 0.25rem;
    transition: all 0.2s ease;
}

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

.spec-btn:hover {
    transform: scale(1.05);
}

/* ==================== 数量选择器 ==================== */
.num-input {
    width: 80px;
    text-align: center;
}

.num-input::-webkit-outer-spin-button,
.num-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ==================== 分页 ==================== */
.pagination {
    margin-top: 2rem;
}

.page-link {
    color: var(--shop-primary);
    border-radius: 4px;
    margin: 0 2px;
}

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

.page-item.active .page-link {
    background-color: var(--shop-primary);
    border-color: var(--shop-primary);
}

/* ==================== 标签徽章 ==================== */
.badge-recommend {
    background-color: var(--shop-warning);
}

.badge-hot {
    background-color: var(--shop-danger);
}

.badge-new {
    background-color: var(--shop-success);
}

/* ==================== 图片预览 ==================== */
.img-thumbnail {
    cursor: pointer;
    transition: all 0.2s ease;
}

.img-thumbnail:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .banner-slide {
        min-height: 250px;
    }
    
    .goods-item .card-title {
        font-size: 0.85rem;
    }
    
    .price {
        font-size: 1.2rem;
    }
}

/* ==================== 加载动画 ==================== */
.loading {
    text-align: center;
    padding: 2rem;
}

.loading::after {
    content: "加载中...";
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 1rem;
}

/* ==================== 工具类 ==================== */
.cursor-pointer {
    cursor: pointer;
}

.text-line-through {
    text-decoration: line-through;
}

.hover-shadow:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
