/*
 * 简悦装饰 - 商城公共样式 v1.0
 * 适用于：index/mall/lists.html, index/mall/detail.html, index/mall/cart.html
 * 主色调：中国红 #e60012 ｜ 品牌绿 #18bc9c
 */

:root {
    --primary: #e60012;
    --primary-dark: #c4000f;
    --primary-light: #fff5f5;
    --accent: #18bc9c;
    --accent-dark: #16a085;
    --text-dark: #2c3e50;
    --text-gray: #6c757d;
    --bg-page: #f5f6fa;
    --bg-card: #ffffff;
    --border-light: #f0f0f0;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 6px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 15px 35px rgba(0,0,0,0.12);
    --shadow-hover: 0 20px 40px rgba(230, 0, 18, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Bootstrap5 常用工具类兼容（当前项目为 BS3）
   ============================================ */
.d-flex { display: flex !important; }
.align-items-center { align-items: center !important; }
.align-items-baseline { align-items: baseline !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-fill { flex: 1 1 auto !important; }
.w-100 { width: 100% !important; }

.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.top-0 { top: 0 !important; }
.bottom-0 { bottom: 0 !important; }
.start-0 { left: 0 !important; }
.start-100 { left: 100% !important; }
.end-0 { right: 0 !important; }
.translate-middle { transform: translate(-50%, -50%) !important; }

.text-start { text-align: left !important; }
.text-end { text-align: right !important; }
.text-decoration-none { text-decoration: none !important; }
.fw-bold { font-weight: 700 !important; }

.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: 999px !important; }

.gap-2 { gap: 8px !important; }
.gap-4 { gap: 16px !important; }
.gap-5 { gap: 24px !important; }

.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 16px !important; }
.mt-4 { margin-top: 24px !important; }
.mt-5 { margin-top: 32px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 24px !important; }
.mb-5 { margin-bottom: 32px !important; }
.me-2 { margin-right: 8px !important; }
.me-3 { margin-right: 16px !important; }
.ms-2 { margin-left: 8px !important; }
.mx-5 { margin-left: 32px !important; margin-right: 32px !important; }
.p-4 { padding: 24px !important; }
.p-5 { padding: 32px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-3 { padding-top: 16px !important; padding-bottom: 16px !important; }
.py-5 { padding-top: 32px !important; padding-bottom: 32px !important; }
.px-5 { padding-left: 32px !important; padding-right: 32px !important; }

/* BS3 缺失的栅格别名，避免 col-2/col-6 失效 */
.col-2,
.col-6 {
    position: relative;
    min-height: 1px;
    float: left;
    padding-left: 15px;
    padding-right: 15px;
}
.col-2 { width: 16.66666667%; }
.col-6 { width: 50%; }

/* ============================================
   全局基础
   ============================================ */
body {
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
    background: var(--bg-page);
    color: #333;
    line-height: 1.6;
}

a {
    transition: color 0.2s ease;
}

/* ============================================
   顶部导航栏
   ============================================ */
.top-nav {
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 0;
    backdrop-filter: blur(10px);
}

.top-nav .logo {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary) 0%, #ff4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.nav-menu a {
    color: #444;
    font-weight: 500;
    margin: 0 12px;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 20px;
    transition: var(--transition);
    position: relative;
}

.nav-menu a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-menu a.active-nav {
    color: var(--primary);
    font-weight: 700;
}

/* 搜索框 */
.search-container {
    max-width: 500px;
    margin: 0 auto;
}

.search-box {
    border: 2px solid var(--primary);
    border-radius: 25px 0 0 25px;
    padding: 10px 18px;
    font-size: 14px;
    height: 44px;
    box-shadow: 0 2px 8px rgba(230,0,18,0.1);
    transition: var(--transition);
}

.search-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230,0,18,0.12);
}

.search-btn {
    border-radius: 0 25px 25px 0;
    background: linear-gradient(135deg, var(--primary), #ff3333);
    color: white;
    padding: 0 28px;
    font-weight: 600;
    height: 44px;
    border: none;
    transition: var(--transition);
}

.search-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark), #e60012);
    box-shadow: 0 4px 12px rgba(230,0,18,0.3);
}

/* 购物车图标 */
.cart-icon {
    font-size: 22px;
    position: relative;
    color: #444;
    transition: var(--transition);
}

.cart-icon:hover {
    color: var(--primary);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(230,0,18,0.3);
}

/* ============================================
   分类导航栏
   ============================================ */
.cat-item {
    display: block;
    text-align: center;
    padding: 14px 8px;
    border-radius: 12px;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.cat-item:hover {
    background: var(--primary-light);
    border-color: rgba(230,0,18,0.1);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(230,0,18,0.08);
}
.cat-link {
    text-decoration: none;
    color: inherit;
}
.cat-link:focus,
.cat-link:hover {
    text-decoration: none;
    color: inherit;
}
.cat-item.active-cat {
    background: var(--primary-light);
    border-color: rgba(230,0,18,0.35);
    box-shadow: 0 6px 16px rgba(230,0,18,0.12);
}

.cat-item i {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 6px;
    transition: var(--transition);
}

.cat-item:hover i {
    transform: scale(1.15);
}

/* ============================================
   大图轮播Banner
   ============================================ */
.hero-banner {
    height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative;
    margin-bottom: 40px;
}

.hero-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 6s ease;
}

.hero-banner:hover img {
    transform: scale(1.03);
}

.hero-banner .carousel-control {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    color: #333;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: var(--transition);
}

.hero-banner:hover .carousel-control {
    opacity: 0.9;
}

/* ============================================
   筛选栏
   ============================================ */
.filter-bar {
    background: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 28px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

/* ============================================
   商品卡片网格
   ============================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
}

.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

/* 商品标签角标 */
.product-card .badge-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* 商品图片 */
.product-img {
    height: 210px;
    object-fit: cover;
    width: 100%;
    transition: transform 0.5s ease;
}

.product-card:hover .product-img {
    transform: scale(1.06);
}

/* 商品信息区 */
.product-info {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-title {
    font-size: 14px;
    line-height: 1.4;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 8px;
    color: var(--text-dark);
    transition: color 0.2s;
}

.product-title:hover {
    color: var(--primary);
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.product-price .price-unit {
    font-size: 13px;
    font-weight: 500;
}

/* ============================================
   商品详情页
   ============================================ */

/* 详情导航 */
.detail-nav {
    background: white;
    box-shadow: 0 1px 8px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* 商品主图区域 */
.product-hero {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
    margin-bottom: 36px;
}

.gallery-main {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    position: relative;
}

.gallery-main img {
    width: 100%;
    height: 440px;
    object-fit: contain;
    background: #f8f9fa;
    transition: transform 0.4s ease;
}

.gallery-main:hover img {
    transform: scale(1.02);
}

/* 缩略图 */
.thumb-list {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.thumb {
    width: 72px;
    height: 72px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.thumb:hover {
    border-color: rgba(230,0,18,0.4);
    transform: scale(1.05);
}

.thumb.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230,0,18,0.15);
    transform: scale(1.08);
}

/* 商品标题 */
.detail-info h1 {
    font-size: 24px;
    line-height: 1.4;
    margin-bottom: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

/* 价格区域 */
.price-box {
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
    border: 2px solid rgba(230,0,18,0.1);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 18px 0;
}

.price-box .price {
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.price-box .price-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

/* 规格按钮 */
.spec-btn {
    border: 2px solid #e0e0e0;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    margin: 5px 6px 5px 0;
    transition: var(--transition);
    font-weight: 500;
    background: white;
    color: #555;
    cursor: pointer;
}

.spec-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #fafafa;
}

.spec-btn.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary-light), #ffebee);
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230,0,18,0.12);
    font-weight: 700;
}

/* 数量选择器 */
.qty-control {
    display: inline-flex;
    align-items: center;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.qty-control .qty-btn {
    width: 38px;
    height: 42px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-control .qty-btn:hover {
    background: #f5f5f5;
    color: var(--primary);
}

.qty-control .qty-btn:active {
    background: #eee;
}

.qty-control .qty-val {
    width: 52px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
    border-left: 1px solid #e8e8e8;
    border-right: 1px solid #e8e8e8;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
}

/* 底部操作栏 */
.buy-bar {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 2px solid rgba(230,0,18,0.15);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 1050;
    padding: 14px 0;
    backdrop-filter: blur(10px);
}

.action-btn {
    height: 52px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 26px;
    transition: var(--transition);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 6px;
    margin-bottom: 4px;
}

.tag-success {
    background: rgba(24,188,156,0.1);
    color: var(--accent);
    border: 1px solid rgba(24,188,156,0.2);
}

.tag-primary {
    background: rgba(230,0,18,0.08);
    color: var(--primary);
    border: 1px solid rgba(230,0,18,0.15);
}

.tag-info {
    background: rgba(52,152,219,0.08);
    color: #3498db;
    border: 1px solid rgba(52,152,219,0.15);
}

/* ============================================
   详情Tab切换
   ============================================ */
.detail-tab {
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
}

.detail-tab .nav-link {
    color: #777;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    position: relative;
    transition: var(--transition);
}

.detail-tab .nav-link:hover {
    color: var(--primary);
}

.detail-tab .nav-link.active {
    color: var(--primary);
    background: transparent;
    font-weight: 700;
}

.detail-tab .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

/* ============================================
   购物车页
   ============================================ */

.cart-page-header {
    border-bottom: 3px solid var(--accent);
    padding-bottom: 14px;
    margin-bottom: 28px;
    position: relative;
}

.cart-page-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 56px;
    height: 3px;
    background: linear-gradient(to right, var(--accent), #2ecc71);
    border-radius: 2px;
}

.cart-items {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 28px;
}

.cart-header-row {
    background: linear-gradient(135deg, #f8f9fa, #f0f4f8);
    padding: 16px 24px;
    border-bottom: 2px solid #eee;
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

.cart-item-row {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    transition: all 0.25s ease;
}

.cart-item-row:last-child {
    border-bottom: none;
}

.cart-item-row:hover {
    background: #f9fdfb;
    transform: translateX(4px);
}

.cart-item-row .goods-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.cart-item-row .goods-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cart-item-row:hover .goods-img img {
    transform: scale(1.08);
}

.cart-item-row .goods-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}

.cart-item-row .goods-name:hover {
    color: var(--accent);
}

/* 购物车空状态 */
.cart-empty {
    text-align: center;
    padding: 80px 20px;
    background: #f8f9fa;
    border-radius: var(--radius-md);
    border: 2px dashed #dee2e6;
}

/* 购物车总计区 */
.cart-total-box {
    background: #fff;
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 22px 26px;
    box-shadow: 0 6px 24px rgba(24,188,156,0.08);
}

/* ============================================
   通用按钮增强
   ============================================ */

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #2472a4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--primary), #ff3333);
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--primary-dark), #e60012);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #1abc9c);
    border: none;
    color: white;
    border-radius: 25px;
    transition: var(--transition);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--accent-dark), #18bc9c);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(24,188,156,0.3);
    color: white;
}

/* ============================================
   响应式适配
   ============================================ */
@media (max-width: 768px) {
    .hero-banner {
        height: 220px;
        border-radius: var(--radius-md);
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-img {
        height: 150px;
    }

    .product-info {
        padding: 10px 12px;
    }

    .product-title {
        font-size: 13px;
        height: 36px;
    }

    .product-price {
        font-size: 16px;
    }

    .gallery-main img {
        height: 300px;
    }

    .detail-info h1 {
        font-size: 20px;
    }

    .price-box .price {
        font-size: 24px;
    }

    .search-container {
        max-width: 100%;
    }

    .cart-header-row {
        display: none;
    }

    .cart-item-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px !important;
        gap: 12px;
    }

    .cart-item-row > div {
        width: 100% !important;
        text-align: left !important;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-img {
        height: 130px;
    }
}

/* ============================================
   Fastadmin分页组件美化
   ============================================ */
.pagination > li > a,
.pagination > li > span {
    border-radius: 6px;
    margin: 0 3px;
    transition: var(--transition);
    border: 1px solid #e0e0e0;
    color: #555;
}

.pagination > li > a:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination > .active > span {
    background: var(--primary);
    border-color: var(--primary);
}

/* ============================================
   过渡动画辅助
   ============================================ */
.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}