/* 主页面样式文件 - 从index.php分离 */

/* CSS变量定义 */
:root {
    --primary: #FF7A00;
    --primary-light: #FF9D33;
    --primary-dark: #FF6100;
    --text-dark: #333333;
    --bg-light: #FFF9F0;
    --border-gray: #F0F0F0;
}

/* 基础样式 */
body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-family: 'Microsoft YaHei', sans-serif;
}

/* 导航栏样式 */
.navbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0;
}

.navbar-brand {
    color: white !important;
    font-weight: bold;
    font-size: 1.5rem;
}

.nav-link {
    color: rgba(255,255,255,0.9) !important;
    margin: 0 5px;
}

.nav-link:hover {
    color: white !important;
    font-weight: bold;
}

/* 轮播图样式 */
.carousel-item {
    height: 200px;
    background-color: #f8f9fa;
}

.carousel-item img {
    height: 100%;
    object-fit: cover;
}

/* 标题样式 */
.section-title {
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 10px;
    margin: 3px 0;
}

/* 物品卡片样式 */
.item-card {
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
    background: white;
}

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

.item-image {
    position: relative;
    padding-top: 133.33%; /* 3:4比例 */
    height: 0;
    overflow: hidden;
    background-color: #f5f5f5;
}

.item-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.item-image img.loaded {
    opacity: 1;
}

/* 骨架屏效果 */
.image-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

/* 状态标签样式 */
.item-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 5px;
}

.status-99 {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status-95 {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.status-90 {
    background-color: #fff8e1;
    color: #ff8f00;
}

.status-80 {
    background-color: #ffebee;
    color: #c62828;
}

.trade-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    background-color: var(--primary-light);
    color: white;
}

/* 公告样式 */
.announcement {
    background-color: white;
    border-left: 4px solid var(--primary);
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 页脚样式 */
.footer {
    background-color: var(--text-dark);
    color: white;
    padding: 20px 0;
    margin-top: 3px;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* 跑马灯样式 */
.marquee-container {
    overflow: hidden;
    position: relative;
    height: 40px;
    line-height: 30px;
    display: flex;
    align-items: center;
}

.marquee-title {
    font-weight: bold;
    min-width: auto;
    padding: 0 0px 0px 5px;
    background-color: var(--primary);
    color: white;
    margin: 0 10px 0 0;
    border-radius: 4px;
    z-index: 1;
}

.marquee-content {
    white-space: nowrap;
    position: absolute;
    animation: marquee 20s linear infinite;
    transform: translateX(0);
    left: 120px;
    will-change: transform;
}

.marquee-scroll {
    display: inline-block;
}

.marquee-item {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.marquee-item:hover {
    color: var(--primary);
    text-decoration: underline;
}

@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* 社区公告卡片样式 */
.community-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.community-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.community-card .card-header {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
}

.community-card .card-body {
    padding: 1rem;
}

.community-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.community-card .card-text {
    font-size: 0.85rem;
    line-height: 1.4;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 推荐物品列表样式 */
.recommended-list {
    max-height: 200px;
    min-height: 80px;
    overflow: hidden;
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.recommended-scroll {
    animation: scrollUp 15s linear infinite;
    position: relative;
}

.recommended-scroll.single-item {
    animation: none;
}

.recommended-item {
    width: 100%;
    background: white;
    border-bottom: 1px solid #f0f0f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 7px;
    min-height: 84px;
}

.recommended-item:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

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

.recommended-item:only-child {
    border-bottom: none;
}

@keyframes scrollUp {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-50%);
    }
}

.recommended-list:hover .recommended-scroll {
    animation-play-state: paused;
}

.recommended-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.recommended-item a:hover {
    text-decoration: none;
}

.recommended-item:hover img {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.recommended-item img {
    transition: transform 0.3s ease;
    border-radius: 8px 8px 0 0;
}

/* 广告位样式 */
.ad-space {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 3px;
    text-align: center;
    border: 1px dashed var(--primary-light);
}

/* 物品标题单行显示样式 */
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}

/* 响应式设计 */
@media (max-width: 767px) {
    .recommended-list {
        max-height: 150px;
    }
    
    .recommended-list {
        gap: 10px;
    }
    
    .recommended-item {
        width: 160px;
    }
    
    .recommended-item img {
        height: 100px !important;
    }
}

/* 移动端优化 */
@media (max-width: 575.98px) {
    .marquee-title {
        min-width: auto;
        padding: 0 8px;
        font-size: 0.8rem;
    }
    
    .marquee-content {
        left: 90px;
    }
    
    .community-card .row.g-0 {
        flex-direction: row;
    }
    
    .community-card .col-sm-6 {
        flex: 0 0 auto;
        width: auto;
    }
    
    .community-card .col-sm-6:first-child {
        flex: 1 1 50%;
        max-width: 50%;
        border-right: 1px solid #dee2e6;
        padding-right: 0.75rem;
    }
    
    .community-card .col-sm-6:last-child {
        flex: 0 0 50%;
        max-width: 50%;
        padding-left: 0.75rem;
        margin-top: 0;
    }
}

/* 超小屏幕优化 */
@media (max-width: 400px) {
    .community-card .row.g-0 {
        flex-direction: row;
    }
    
    .community-card .col-sm-6 {
        flex: 0 0 50%;
        max-width: 50%;
        border: none;
        padding: 0;
    }
    
    .community-card .col-sm-6:last-child {
        margin-top: 0;
    }
}

/* 微信环境下物品卡片间距优化 */
.wechat-environment .items-container {
    margin-right: -1px !important;
    margin-left: -1px !important;
}

.wechat-environment .item-card-container {
    padding-right: 1px !important;
    padding-left: 1px !important;
    margin-bottom: 4px !important;
}