/**
 * 插入商品插件样式
 */

/* ========== 小工具样式 ========== */
.pi-widget-content {
    padding: 0;
}

/* 搜索框 */
.pi-search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.pi-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.pi-search-input:focus {
    border-color: #ff6b6b;
}

.pi-search-btn {
    padding: 8px 12px;
    background: #ff6b6b;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.pi-search-btn:hover {
    background: #ff5252;
}

/* 搜索结果 */
.pi-search-result {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.pi-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f8f8;
    border-bottom: 1px solid #e5e5e5;
    font-size: 13px;
    font-weight: 500;
}

.pi-close-result {
    cursor: pointer;
    color: #999;
    font-size: 14px;
}

.pi-close-result:hover {
    color: #ff6b6b;
}

.pi-result-list {
    max-height: 300px;
    overflow-y: auto;
}

.pi-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.pi-result-item:hover {
    background: #f8f8f8;
}

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

.pi-result-img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: #f5f5f5;
}

.pi-result-info {
    flex: 1;
}

.pi-result-title {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.pi-result-price {
    font-size: 12px;
    color: #ff5722;
    font-weight: 500;
}

.pi-result-add {
    padding: 4px 10px;
    background: #ff6b6b;
    color: #fff;
    border-radius: 20px;
    font-size: 11px;
}

/* 已选商品 */
.pi-selected-products {
    margin-bottom: 15px;
}

.pi-selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 8px 0;
    border-bottom: 1px solid #e5e5e5;
    font-size: 13px;
    font-weight: 500;
}

.pi-clear-all {
    color: #ff6b6b;
    cursor: pointer;
    font-size: 12px;
    font-weight: normal;
}

.pi-clear-all:hover {
    text-decoration: underline;
}

.pi-selected-list {
    max-height: 250px;
    overflow-y: auto;
}

.pi-selected-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.pi-selected-img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    background: #f5f5f5;
}

.pi-selected-info {
    flex: 1;
}

.pi-selected-title {
    font-size: 12px;
    color: #333;
    margin-bottom: 2px;
}

.pi-selected-price {
    font-size: 11px;
    color: #ff5722;
}

.pi-selected-remove {
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.pi-selected-remove:hover {
    color: #ff6b6b;
}

.pi-empty-tip {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

/* 插入按钮 */
.pi-insert-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #12C2E9, #00E88F);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.pi-insert-btn:hover {
    opacity: 0.9;
}

/* ========== 帖子中的商品卡片样式 ========== */
/* 参考图片样式：左侧商品信息，右侧图片，背景半透明毛玻璃 */
.pi-products-container {
    margin: 20px 0;
}

.pi-product-card {
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.pi-card-link {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-decoration: none !important;
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

.pi-card-link:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
    text-decoration: none !important;
}

/* 暗色模式适配 */
.dark .pi-card-link {
    background: rgba(30, 30, 40, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark .pi-card-link:hover {
    background: rgba(40, 40, 50, 0.9) !important;
}

/* 左侧信息区域 */
.pi-card-info {
    flex: 1 !important;
    padding-right: 15px !important;
}

.pi-card-title {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #222 !important;
    margin-bottom: 8px !important;
    line-height: 1.4 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.dark .pi-card-title {
    color: #eee !important;
}

/* 价格样式 - 去掉默认的¥符号，因为后面会加 */
.pi-card-price {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #ff4d4d !important;
    line-height: 1.2 !important;
}

/* 添加¥符号 */
.pi-card-price::before {
    content: '¥' !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    margin-right: 2px !important;
}

/* 右侧图片区域 */
.pi-card-image {
    width: 70px !important;
    height: 70px !important;
    flex-shrink: 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background: #f0f0f0 !important;
}

.pi-card-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}

.pi-card-link:hover .pi-card-image img {
    transform: scale(1.05) !important;
}

/* 手机端响应式 */
@media (max-width: 768px) {
    .pi-card-info {
        padding-right: 12px !important;
    }
    
    .pi-card-title {
        font-size: 14px !important;
        margin-bottom: 6px !important;
    }
    
    .pi-card-price {
        font-size: 18px !important;
    }
    
    .pi-card-image {
        width: 60px !important;
        height: 60px !important;
    }
    
    .pi-card-link {
        padding: 10px 14px !important;
    }
}

/* 加载动画 */
.pi-loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.pi-loading i {
    animation: pi-spin 1s linear infinite;
}

@keyframes pi-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 无结果 */
.pi-no-result {
    text-align: center;
    padding: 20px;
    color: #999;
}