/**
 * 商城自定义样式 - 调整为匹配 Shop 风格
 */

/* ==================== 全局变量 (源自 Shop) ==================== */
:root {
    /* 核心色彩 */
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --text-dark: #2b2d42;
    --text-muted: #8d99ae;
    --bg-light: #f8f9fa;
    --price-color: #ef233c; /* 保持价格鲜艳，但在 Shop 中是 #ef233c */

    /* 阴影效果 */
    --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 15px 30px rgba(67, 97, 238, 0.15);

    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 16px; /* Shop 使用 16px */
    --radius-lg: 20px;
}

body {
    background-color: #fdfdfd;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-color);
}

/* 文本与排版增强 */
.fw-600 { font-weight: 600 !important; }
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }

/* 按钮样式复刻 */
.btn-primary {
    background-color: var(--primary-color);
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.4);
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    border-radius: 10px;
    font-weight: 600;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* ==================== 导航栏 (完全复刻 Shop) ==================== */
.navbar {
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
    background: linear-gradient(135deg, #1e1e2f 0%, #2d2d44 100%) !important;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    background: linear-gradient(45deg, #fff, #ccc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #fff !important; /* Fallback */
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: rgba(255,255,255,0.85) !important;
    transition: all 0.3s ease;
    margin: 0 5px;
    padding: 0 10px;
}

.navbar-nav .nav-link:hover {
    color: #fff !important;
    transform: translateY(-1px);
}

/* 购物车图标微调适配深色背景 */
.cart-icon-wrapper {
    position: relative;
    display: inline-block;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--price-color);
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* 搜索框优化 */
.search-box {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    display: flex;
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

.search-box input {
    background: transparent;
    border: none;
    color: #fff;
    box-shadow: none;
    padding-left: 20px;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-box button {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0 20px;
    transition: color 0.3s;
}

.search-box button:hover {
    color: #fff;
}

/* 分类导航条微调 */
.bg-white.border-bottom {
    border-bottom: 1px solid #eee !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

/* ==================== 轮播图 ==================== */
#mainCarousel {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    margin-top: 2rem;
}

#mainCarousel .carousel-item {
    height: 450px;
}

#mainCarousel .carousel-item img {
    height: 450px;
    width: 100%;
    object-fit: cover;
    filter: brightness(0.95);
}

/* ==================== 区域标题 ==================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0;
    border-bottom: none;
}

.section-header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

/* ==================== 商品卡片 (复刻 Shop .product-card) ==================== */
.goods-card {
    border: none;
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.goods-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--card-shadow-hover);
}

.goods-image-wrapper {
    position: relative;
    overflow: hidden;
    height: 240px; /* 固定高度 */
    padding-top: 0; /* 覆盖旧样式 */
    background-color: #f0f2f5;
}

.goods-image {
    position: relative; /* 覆盖旧样式 absolute */
    height: 100%;
    width: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.goods-card:hover .goods-image {
    transform: scale(1.1);
}

.card-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.goods-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    line-height: 1.5;
    height: 3em; /* 2 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.price {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--price-color);
    margin-bottom: 0;
}

.text-decoration-line-through {
    color: var(--text-muted) !important;
}

/* 卡片底部的按钮 */
.goods-card .card-footer {
    background: transparent;
    border: none;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

/* ==================== 页脚 (复刻 Shop) ==================== */
footer {
    background-color: #12121f !important;
    color: #ffffff !important;
    padding-top: 60px;
    margin-top: 60px;
}

footer h5, footer h6 {
    color: #ffffff !important;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

footer p, footer span, footer small, footer .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

footer a {
    color: rgba(255, 255, 255, 0.6) !important;
    transition: all 0.3s ease;
    text-decoration: none;
}

footer a:hover {
    color: #4361ee !important;
}

.footer-bottom {
    background-color: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
    margin-top: 40px;
}

/* ==================== 详情页与列表页适配 ==================== */
.breadcrumb-wrapper {
    background: transparent;
    box-shadow: none;
    padding: 10px 0;
}

.goods-detail-container {
    border: none;
    box-shadow: var(--card-shadow);
    border-radius: 20px;
    padding: 40px;
}

.detail-info h1 {
    font-weight: 800;
    color: var(--text-dark);
}

.detail-price-box {
    background: rgba(67, 97, 238, 0.05);
    border-radius: 12px;
}

.detail-price {
    color: var(--price-color);
}

.btn-buy-now {
    background: linear-gradient(to right, #4361ee, #3f37c9);
}
.btn-buy-now:hover {
    background: linear-gradient(to right, #3f37c9, #302b9e);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}

.btn-add-cart {
    background: linear-gradient(to right, #4895ef, #4361ee);
}
.btn-add-cart:hover {
    background: linear-gradient(to right, #3f37c9, #4361ee);
}

/* ==================== 列表页优化 ==================== */
.filter-bar {
    background: #fff;
    padding: 15px 20px;
    border-radius: 16px;
    margin-bottom: 30px; /* 增加间距，解决拥挤问题 */
    box-shadow: var(--card-shadow);
}

.category-sidebar {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

/* 优化分类标题：白色背景，深色文字 */
.category-header {
    background: #fff;
    color: var(--text-dark);
    padding: 18px 20px;
    font-weight: 800;
    font-size: 1.1rem;
    border-bottom: 1px solid #f0f0f0;
}

.category-list .list-group-item {
    border: none;
    padding: 14px 20px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
    background: transparent;
}

.category-list .list-group-item:hover,
.category-list .list-group-item.active {
    background-color: rgba(67, 97, 238, 0.06);
    color: var(--primary-color);
    padding-left: 28px;
    font-weight: 600;
    border-left: 4px solid var(--primary-color);
}

/* ==================== 购物车页面 (复刻 Shop) ==================== */
.cart-item {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.cart-item:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border-color: rgba(67, 97, 238, 0.1);
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    background-color: #f8f9fa;
}

.cart-summary {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 100px;
}

.quantity-input {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 30px;
    padding: 2px;
    border: 1px solid #eee;
    width: fit-content;
}

.quantity-input .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #fff;
    color: var(--text-dark);
    border-radius: 50% !important;
    font-size: 0.8rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.quantity-input .btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.quantity-input input {
    border: none;
    background: transparent;
    width: 50px !important;
    text-align: center;
    font-weight: 600;
    color: var(--text-dark);
}

.empty-state {
    text-align: center;
    padding: 3rem 0;
}

.empty-state i {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1.5rem;
    display: block;
}

.empty-state h5 {
    color: var(--text-dark);
    font-weight: 700;
    margin-bottom: 1rem;
}

.cart-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}
