/* 头部样式 */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    border: 1px solid rgba(76, 175, 80, 0.3);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    height: auto;
}

.header-bar .logo img {
    max-width: 100px;
    margin-right: 20px;
}

.header-bar .site-info h1 {
    font-size: 28px;
}

.header-bar .site-info p {
    color: #fff;
}

.recommend-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.recommend-title i {
    color: #4caf50;
    font-size: 24px;
    margin-right: 10px;
}

.recommend-title h2 {
    color: #fff;
    font-size: 18px;
}

.recommend-title .view-more {
    margin-left: auto;
    color: #fff;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    background-color: #4caf50;
}

/* 立即购买按钮样式 */
.btn-buy-now {
    width: 100%;
    background-color: #4caf50;
    color: #fff;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    padding: 10px 0;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition: all 0.3s;
    cursor: pointer;
}

.btn-buy-now:hover {
    background-color: #388e3c;
}

/* 库存显示样式 */
.stock-display {
    font-size: 12px;
    color: #ccc;
    text-align: center;
    margin-top: 5px;
}

/* 产品详情页样式 */
.product-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 30px;
    border: 2px solid rgba(76, 175, 80, 0.6);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.product-gallery {
    flex: 1;
    min-width: 300px;
}

.main-image {
    width: 100%;
    height: 400px;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid rgba(76, 175, 80, 0.6);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.product-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s;
}

.product-main-image:hover {
    transform: scale(1.05);
}

.product-thumbnails {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.product-thumb {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(76, 175, 80, 0.4);
    transition: all 0.3s;
}

.product-thumb.active, .product-thumb:hover {
    border-color: #4caf50;
    transform: translateY(-3px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.product-info-detail {
    flex: 1;
    min-width: 300px;
}

.product-title {
    font-size: 28px;
    margin-bottom: 15px;
    color: #4caf50;
    font-weight: bold;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(76, 175, 80, 0.3);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.product-category {
    font-size: 16px;
}

.product-category a {
    color: #2196f3;
    text-decoration: none;
    transition: color 0.3s;
}

.product-category a:hover {
    color: #4caf50;
    text-decoration: underline;
}

.product-id {
    color: #bbb;
    font-size: 16px;
}

.product-price-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #4caf50;
}

.product-price-detail .price {
    font-size: 28px;
    font-weight: bold;
    color: #4caf50;
}

.product-price-detail .stock {
    font-size: 16px;
    padding: 6px 12px;
    border-radius: 20px;
    background-color: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.product-price-detail .stock.in-stock {
    color: #4caf50;
}

.product-price-detail .stock.out-of-stock {
    color: #f44336;
    background-color: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.4);
}

.product-description {
    margin-bottom: 25px;
    line-height: 1.8;
    color: #ddd;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    min-height: 120px;
}

.product-actions {
    margin-bottom: 25px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.quantity-selector label {
    margin-right: 15px;
    font-weight: bold;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 2px solid rgba(76, 175, 80, 0.4);
    border-radius: 5px;
    overflow: hidden;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
}

.quantity-btn:hover {
    background-color: rgba(76, 175, 80, 0.3);
}

.quantity-control input {
    width: 60px;
    height: 40px;
    text-align: center;
    border: none;
    background-color: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 16px;
}

.buy-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.buy-actions .btn {
    flex: 1;
    min-width: 150px;
    padding: 12px 15px;
    font-size: 16px;
}

.btn-add-cart {
    background-color: #2196f3;
}

.btn-add-cart:hover {
    background-color: #1976d2;
}

.out-of-stock-message {
    padding: 15px;
    background-color: rgba(244, 67, 54, 0.1);
    border-left: 4px solid #f44336;
    color: #f44336;
    border-radius: 5px;
    font-weight: bold;
}

.product-guarantee {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin: 30px 0;
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #4caf50;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.guarantee-item {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: center;
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.guarantee-item:hover {
    background-color: #e8f5e9;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.guarantee-item i {
    font-size: 24px;
    margin-right: 15px;
    color: #4caf50;
}

.guarantee-text {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

@media (max-width: 768px) {
    .product-detail {
        padding: 20px;
    }
    
    .main-image {
        height: 300px;
    }
    
    .product-title {
        font-size: 24px;
    }
    
    .product-price-detail .price {
        font-size: 24px;
    }
    
    .buy-actions {
        flex-direction: column;
    }
    
    .product-guarantee {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .main-image {
        height: 250px;
    }
    
    .product-thumb {
        width: 60px;
        height: 60px;
    }
}

/* 社区页面样式 */
.community-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.community-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #4caf50;
    border-bottom: 2px solid #4caf50;
    padding-bottom: 15px;
}

/* 发帖表单 */
.post-form-container {
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #333;
}

.post-form-container h2 {
    margin-top: 0;
    color: #4caf50;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.post-form .form-group {
    margin-bottom: 15px;
}

.post-textarea {
    width: 100%;
    min-height: 100px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
    color: #fff;
    resize: vertical;
}

.btn-post {
    background-color: #4caf50;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    float: right;
}

.btn-post:hover {
    background-color: #388e3c;
}

/* 帖子列表 */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.post-card {
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.post-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #4caf50;
}

.post-info {
    margin-left: 15px;
}

.post-info h3 {
    margin: 0;
    color: #4caf50;
    font-size: 1rem;
}

.post-time {
    color: #999;
    font-size: 0.8rem;
    display: block;
    margin-top: 3px;
}

.post-content {
    margin-bottom: 15px;
    line-height: 1.5;
}

.post-content p {
    margin: 0;
    color: #ddd;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    transition: transform 0.3s ease;
}

.post-image img:hover {
    transform: scale(1.02);
}

.post-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    width: 100%;
}

/* 确保所有图片占据相同的宽度，强制三列布局 */
.post-images-container .post-image {
    width: calc(33.333% - 7px);
    flex: 0 0 calc(33.333% - 7px);
    max-width: calc(33.333% - 7px);
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 横向图片样式 - 不再影响宽度，只影响高度比例 */
.post-image.wide {
    aspect-ratio: 16/9;
}

/* 竖向图片样式 - 不再影响宽度，只影响高度比例 */
.post-image.tall {
    aspect-ratio: 9/16;
}

/* 默认图片比例 */
.post-image:not(.wide):not(.tall) {
    aspect-ratio: 1/1;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    transition: transform 0.3s ease;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .post-images-container {
        gap: 6px;
    }
    
    .post-images-container .post-image {
        width: calc(33.333% - 4px);
        flex: 0 0 calc(33.333% - 4px);
        max-width: calc(33.333% - 4px);
    }
}

@media (max-width: 480px) {
    .post-images-container {
        gap: 4px;
    }
    
    .post-images-container .post-image {
        width: calc(33.333% - 3px);
        flex: 0 0 calc(33.333% - 3px);
        max-width: calc(33.333% - 3px);
    }
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.btn-like, .btn-comment {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-like:hover, .btn-comment:hover {
    color: #4caf50;
}

.btn-like.liked {
    color: #ff5252;
}

.btn-like.liked i {
    animation: pulse 0.4s;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* 评论区 */
.comments-section {
    margin-top: 20px;
    border-top: 1px solid #333;
    padding-top: 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.comments-section.active {
    max-height: 1000px;
}

.comments-section h4 {
    margin-top: 0;
    color: #4caf50;
    font-size: 1rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.comment-item {
    display: flex;
    padding: 10px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.05);
}

.comment-avatar img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #4caf50;
}

.comment-content {
    margin-left: 10px;
    flex: 1;
}

.comment-user {
    color: #4caf50;
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.comment-text {
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1.4;
}

.comment-time {
    color: #777;
    font-size: 0.75rem;
    margin-top: 5px;
}

.comment-form {
    margin-top: 15px;
}

.comment-textarea {
    width: 100%;
    min-height: 60px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
    color: #fff;
    resize: vertical;
    font-size: 0.9rem;
}

.btn-submit-comment {
    background-color: #4caf50;
    color: #fff;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 5px;
    float: right;
}

.btn-submit-comment:hover {
    background-color: #388e3c;
}

.no-posts {
    text-align: center;
    padding: 50px 0;
    color: #999;
    font-style: italic;
}

.alert {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-danger {
    background-color: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* 社区热门内容部分 */
.hot-community {
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.hot-community h3 {
    color: #4caf50;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.hot-post-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hot-post-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.hot-post-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.hot-post-avatar img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #4caf50;
}

.hot-post-info {
    margin-left: 10px;
    flex: 1;
}

.hot-post-user {
    font-size: 0.85rem;
    color: #4caf50;
}

.hot-post-excerpt {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hot-post-stats {
    font-size: 0.75rem;
    color: #777;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hot-post-likes, .hot-post-comments {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* 用户下拉菜单 */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #fff;
    background-color: rgba(76, 175, 80, 0.4);
    padding: 8px 15px;
    border-radius: 50px;
    transition: all 0.3s;
}

.dropdown-trigger:hover {
    background-color: rgba(76, 175, 80, 0.6);
}

.dropdown-trigger .welcome-text {
    margin-right: 8px;
    font-weight: bold;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background-color: rgba(0, 0, 0, 0.9);
    border: 1px solid #4caf50;
    border-radius: 10px;
    padding: 10px 0;
    display: none;
    z-index: 100;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    margin-top: 5px;
}

.user-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: #fff;
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-menu a:hover {
    background-color: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.dropdown-menu a i {
    margin-right: 8px;
    color: #4caf50;
    width: 20px;
    text-align: center;
}

.post-images-container.masonry-layout {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* 多图布局优化 */
.post-images-container.masonry-layout .post-image.wide {
    grid-column: span 2;
}

.post-images-container.masonry-layout .post-image.tall {
    grid-row: span 2;
}

/* 图片加载状态样式 */
.post-image img.loading {
    opacity: 0.6;
    filter: blur(3px);
}

.post-image img.error {
    object-fit: contain;
    padding: 10px;
    background-color: rgba(255, 0, 0, 0.05);
}

/* 图片点击放大效果 */
.post-image {
    cursor: pointer;
    overflow: hidden;
}

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

@media (max-width: 768px) {
    .post-images-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .post-image {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .post-images-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .post-image {
        height: 120px;
    }
}