/* 商品卡片布局修复 - 确保标题过长时布局美观 */

/* 商品卡片容器 */
.product_block {
    position: relative;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 5px;
    border: 1px solid var(--thm-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
    /* 确保最小高度一致 */
}

/* 商品信息容器 - 使用flex布局 */
.product_block .product_info_container {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
    height: 100%;
}

/* 商品内容区域 - 从顶部开始排列 */
.product_block .product_content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

/* 商品图片区域 */
.product_block .product_image {
    width: 90%;
    margin: 0 auto 20px;
    flex-shrink: 0;
    /* 防止图片被压缩 */
}

/* 商品分类标签 */
.product_block .product_categories {
    margin-bottom: 10px;
    flex-shrink: 0;
}

/* 商品标题 - 限制行数，确保布局一致 */
.product_block .title {
    font-size: 20px;
    line-height: 1.3;
    margin-bottom: 15px;
    font-weight: 600;
    color: var(--thm-color-two);

    /* 限制标题为2行，超出部分显示省略号 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;

    /* 确保最小高度一致 */
    min-height: 2.6em;
    max-height: 2.6em;

    /* 文字换行处理 */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* 商品价格 */
.product_block .price {
    margin-bottom: 15px;
    flex-shrink: 0;
    font-weight: 600;
    color: var(--thm-color-one);
}

/* 商品底部操作区域 - 固定在底部 */
.product_block .product_bottom_actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    flex-shrink: 0;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

/* 商品操作按钮 */
.product_block .product_action {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.product_block .product_btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .product_block {
        min-height: 350px;
        padding: 15px;
    }

    .product_block .title {
        font-size: 18px;
        min-height: 2.4em;
        max-height: 2.4em;
    }

    .product_block .product_image {
        height: 140px;
        margin-bottom: 15px;
    }
}

@media (max-width: 576px) {
    .product_block {
        min-height: 320px;
        padding: 12px;
    }

    .product_block .title {
        font-size: 16px;
        min-height: 2.2em;
        max-height: 2.2em;
    }

    .product_block .product_image {
        height: 120px;
        margin-bottom: 12px;
    }
}

/* 商品网格布局优化 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.products-grid .product_block {
    margin-bottom: 0;
    /* 移除底部边距，使用grid gap */
}

/* 确保所有商品卡片高度一致 */
.products-grid .product_block {
    height: auto;
    min-height: 400px;
}

/* 商品卡片悬停效果 */
.product_block:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* 商品标签样式优化 */
.product_tag {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    background-color: var(--thm-color-one);
    color: white;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: inline-block;
    flex-shrink: 0;
}

/* 商品分类链接样式 */
.product_block .product_categories {
    margin-bottom: 8px;
}

.product_block .product_categories a {
    font-size: 12px;
    color: #666;
    text-decoration: none;
    margin-right: 5px;
    transition: color 0.3s ease;
}

.product_block .product_categories a:hover {
    color: var(--thm-color-one);
}

/* 商品数量显示 */
.product_block .product_qty {
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
    flex-shrink: 0;
}

/* 商品库存状态 */
.product_block .stock-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: inline-block;
    flex-shrink: 0;
}

.product_block .stock-status.in-stock {
    background-color: #d4edda;
    color: #155724;
}

.product_block .stock-status.low-stock {
    background-color: #fff3cd;
    color: #856404;
}

.product_block .stock-status.out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
}

/* 心愿单按钮样式 */
.wishlist-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wishlist-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wishlist-btn:active {
    transform: scale(0.95);
}

.wishlist-btn i {
    font-size: 18px;
    transition: all 0.3s ease;
}

.wishlist-btn:not(.active) i {
    color: #999;
}

.wishlist-btn.active i {
    color: #ff6b6b;
    animation: heartBeat 0.6s ease-in-out;
}

.wishlist-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 心愿单按钮动画 */
@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.2);
    }

    50% {
        transform: scale(1);
    }

    75% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* 商品顶部区域样式 */
.product_top {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.product_tag {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.discount-tag {
    background: #ff6b6b;
    color: white;
}

.sale-tag {
    background: #4ecdc4;
    color: white;
}

/* 网页内部弹窗样式 */
.website-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.website-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.website-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

.website-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.website-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.website-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.website-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.website-modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.website-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.website-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.website-modal-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.website-modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.website-modal-btn.secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.website-modal-btn.secondary:hover {
    background: #e9ecef;
    color: #495057;
}

/* 弹窗动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .website-modal-content {
        max-width: 95%;
        margin: 20px;
    }

    .website-modal-header,
    .website-modal-body,
    .website-modal-footer {
        padding: 15px 20px;
    }

    .website-modal-header h3 {
        font-size: 16px;
    }
}