/* 全局样式 */
body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    color: #333;
    background-color: #f8f9fa;
    padding-top: 0 !important; /* 完全移除顶部padding */
    margin-top: 50px !important; /* 使用margin来调整顶部空间 */
}

/* 强制调整导航栏下方内容区域的位置 */
main.container {
    padding-top: 10px !important;
}

.container.mt-4.pt-3 {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 懒加载相关样式 - 优化版本 */
.lazyload,
.lazyloading {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s ease-in-out;
    will-change: opacity, transform;
}

.lazyloaded {
    opacity: 1;
    transform: scale(1);
    transition: all 0.4s ease-in-out;
    will-change: opacity, transform;
}

/* 图片加载中状态 */
img.loading {
    opacity: 0.7;
    background-color: #f9f9f9;
    transition: opacity 0.3s ease;
}

/* 图片加载完成状态 */
img.loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* 图片加载错误状态 */
img.error {
    opacity: 0.8;
    background-color: #f8f8f8;
    background-image: none !important;
    position: relative;
}

img.error::before {
    content: '图片加载失败';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #999;
}

/* 图片占位符 - 优化版本 */
.card-img-top {
    background-color: #f3f3f3;
    background-image: url('../images/loading.gif');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 40px;
    min-height: 200px;
    object-fit: cover;
    width: 100%;
    overflow: hidden; /* 确保内容不溢出 */
    position: relative; /* 为子元素定位做准备 */
}

/* 优化图片加载动画效果 */
@keyframes pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.9;
    }
    100% {
        opacity: 0.6;
    }
}

.card-img-top:not(.loaded):not(.error):not([src$=".jpg"]):not([src$=".png"]):not([src$=".gif"]) {
    animation: pulse 1.5s infinite;
    background-color: #eee;
}

/* 为轮播图添加特殊的加载样式 */
.carousel-item img {
    height: 400px;
    object-fit: cover;
    background-size: 50px;
    background-color: #f5f5f5;
    transition: opacity 0.4s ease-out;
}

.section-title {
    font-size: 1.5rem;
    border-left: 4px solid #007bff;
    padding-left: 10px;
    margin-bottom: 20px;
}

/* 头部导航 */
.navbar-brand img {
    max-height: 40px;
    width: auto;
}

.cart-count {
    position: relative;
    top: -8px;
}

/* 轮播图 */
.carousel {
    margin-top: 10px;
}

/* 优化后的商品卡片 */
.product-card {
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    height: 100%;
    border: 1px solid #eee;
    overflow: hidden;
    will-change: transform, box-shadow;
}

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

.product-card .card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    will-change: transform;
}

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

.product-card .card-title {
    font-size: 16px;
    height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.price-box {
    margin: 10px 0;
}

.current-price {
    color: #f44336;
    font-size: 18px;
    font-weight: bold;
}

.original-price {
    color: #999;
    font-size: 14px;
    text-decoration: line-through;
    margin-left: 5px;
}

/* 分销商品样式 */
.distribute-card {
    position: relative;
}

.distribute-badge {
    position: absolute;
    top: 10px;
    right: 0;
    background: #ff5722;
    color: white;
    padding: 3px 10px;
    font-size: 12px;
    z-index: 1;
    border-radius: 4px 0 0 4px;
}

/* 按钮样式 */
.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* 底部样式 */
footer {
    background-color: #343a40;
    color: white;
    padding: 40px 0 0 0;
    margin-top: 50px;
}

footer h5 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 18px;
}

footer ul {
    list-style: none;
    padding: 0;
}

footer ul li {
    margin-bottom: 10px;
}

footer ul li a {
    color: #aaa;
    text-decoration: none;
}

footer ul li a:hover {
    color: #fff;
}

.social-links {
    margin-top: 15px;
}

.social-links a {
    display: inline-block;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 36px;
    margin-right: 10px;
}

.social-links a:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.copyright {
    background-color: #212529;
    padding: 15px 0;
    color: #aaa;
    text-align: center;
    margin-top: 20px;
}

/* 响应式调整 - 移动端优化 */
@media (max-width: 767px) {
    .carousel {
        margin-bottom: 20px;
    }
    
    .carousel-item img {
        height: 200px;
    }
    
    .product-card .card-img-top {
        height: 150px;
    }
    
    footer {
        padding-top: 20px;
        padding-bottom: 60px; /* 为底部导航栏留出空间 */
    }
    
    footer .col-md-3 {
        margin-bottom: 20px;
    }
    
    .card-img-top {
        min-height: 150px;
        background-size: 30px;
    }
    
    /* 移动端按钮优化 */
    .btn {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* 移动端卡片优化 */
    .product-card {
        margin-bottom: 15px;
    }
    
    .product-card .card-body {
        padding: 12px;
    }
    
    .product-card .card-title {
        font-size: 14px;
        height: 36px;
    }
    
    /* 移动端价格优化 */
    .current-price {
        font-size: 16px;
    }
    
    .original-price {
        font-size: 12px;
    }
    
    /* 移动端容器优化 */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
}

.login-container, .register-container {
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
}

.form-title {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.cart-table th {
    background-color: #f5f5f5;
}

.cart-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.product-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 20px;
}

.product-image {
    width: 100%;
    height: auto;
    transition: all 0.3s;
}

.product-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 15px;
}

@media (max-width: 767px) {
    .product-image {
        height: 250px;
        object-fit: cover;
    }
} 