/* 
 * assets/css/style.css 
 * 版本: V6 - 详情按钮修复 & 版权居中版
 */

:root {
    --primary-color: #ff6b81; 
    --primary-light: #fff0f3; 
    --secondary-color: #2ed573; 
    --accent-color: #ffa502; 
    --text-main: #2f3542;
    --text-light: #747d8c;
    --bg-body: #f7f8fa; 
    --card-bg: #ffffff;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-hover: 0 8px 24px rgba(255, 107, 129, 0.15);
    --font-logo: 'Pacifico', cursive;
    --font-body: 'Nunito', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* --- 头部导航 --- */
.main-header {
    background: #fff;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}
.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-family: var(--font-logo);
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-right: 15px;
    white-space: nowrap;
}

.main-nav {
    flex-grow: 1;
    display: flex;
    justify-content: flex-end;
}

.main-nav ul { 
    display: flex; 
    gap: 5px; 
    align-items: center; 
}

.main-nav a {
    font-weight: 700;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 50px;
    color: var(--text-light);
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
}
.main-nav a:hover, .main-nav a.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}
#cart-count {
    background: var(--primary-color);
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
    line-height: 1.2;
}

/* --- 搜索栏 --- */
.search-section {
    background: #fff;
    padding: 15px 0;
    margin-bottom: 20px;
}
.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}
.search-input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border: 2px solid #f1f2f6;
    border-radius: 50px;
    font-size: 0.95rem;
    background: #f1f2f6;
    transition: all 0.3s;
    outline: none;
}
.search-input:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.search-btn {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    width: 40px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 首页横幅 --- */
.hero-banner {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-radius: var(--radius-md);
    padding: 30px 20px;
    text-align: center;
    color: #fff;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}
.hero-banner h1 { margin: 0 0 10px; font-size: 2rem; text-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.hero-banner p { margin: 0; opacity: 0.9; font-size: 1rem; }

/* --- 商品网格 --- */
.products-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding-bottom: 40px;
}

/* --- 商品卡片 --- */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    position: relative;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: transparent;
}

.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; 
    overflow: hidden;
    background: #f8f9fa;
}
.product-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}
.product-card:hover .product-image-wrapper img { transform: scale(1.08); }

.card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 2;
}
.badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-discount { background: #ffc107; color: #333; }
.badge-rating { background: #fff; color: var(--accent-color); box-shadow: 0 2px 5px rgba(0,0,0,0.1); display: flex; align-items: center; gap: 3px; }

.card-content {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
}
.price-current {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
}
.price-current::before { content: '¥'; font-size: 0.8rem; margin-right: 1px; }
.price-original {
    font-size: 0.8rem;
    color: #b2bec3;
    text-decoration: line-through;
}
.sold-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: #a4b0be;
}

.progress-wrapper { margin-bottom: 10px; }
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-light);
    margin-bottom: 3px;
}
.progress-bar-bg {
    width: 100%;
    height: 5px;
    background: #f1f2f6;
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #7bed9f, var(--secondary-color));
    border-radius: 3px;
}

.tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}
.tag-item {
    font-size: 0.65rem;
    color: var(--primary-color);
    background: var(--primary-light);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 底部按钮行 */
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}
.btn-detail {
    flex: 1;
    padding: 8px;
    border: 1px solid #e1e1e1;
    background: #fff;
    color: var(--text-main);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
}
.btn-add {
    flex: 1;
    padding: 8px;
    background: linear-gradient(45deg, var(--primary-color), #ff9a9e);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 107, 129, 0.3);
}

/* --- 页脚 (绝对居中) --- */
.main-footer {
    background-color: #343a40;
    color: #adb5bd;
    text-align: center; 
    padding: 30px 0;
    margin-top: 40px;
    width: 100%;
}
.main-footer .container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* --- 移动端适配 --- */
@media (max-width: 768px) {
    .main-header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .logo {
        width: 100%;
        text-align: center;
        margin-right: 0;
    }
    .main-nav {
        width: 100%;
        overflow-x: auto; 
        padding-bottom: 5px; 
        justify-content: flex-start; 
    }
    .main-nav ul {
        width: max-content; 
        padding: 0 5px; 
    }
    .main-nav a {
        background: #f1f2f6; 
        padding: 6px 15px;
        font-size: 0.85rem;
    }

    .products-container {
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
    }
    
    .tags-row { display: none; }
    .card-desc { display: none; }
    
    /* 修复：手机端显示“查看详情”按钮，与“加入购物车”并排 */
    .card-actions {
        flex-direction: row;
    }
    .btn-detail {
        display: block; /* 确保显示 */
        font-size: 0.8rem;
        padding: 6px;
    }
    .btn-add {
        font-size: 0.8rem;
        padding: 6px;
    }
}