/* ========== 短代码价格显示样式 ========== */
#dynamic-price-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    font-weight: bold;
    margin: 10px 0;
}

.sbb-current-price {
    font-size: 24px;
    color: #1B3C57;
    font-weight: 700;
}

.sbb-original-price {
    font-size: 16px;
    color: #888;
    text-decoration: line-through;
}

.sbb-discount-badge {
    background: #1B3C57;
    color: #fff;
    padding: 2px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

/* ========== 底部栏基础样式 ========== */
#custom-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    z-index: 99999;
    box-shadow: 0 -4px 20px rgba(0,0,0,.12);
    padding: 14px 16px;
    transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .2s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#custom-bottom-bar.hide {
    transform: translateY(110%);
    opacity: 0;
    pointer-events: none;
}

/* 产品信息区域 */
.bb-product {
    display: none;
}

.bb-product-info {
    flex: 1;
}

.bb-title {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 4px;
}

/* 价格显示 */
.bb-price {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bottom-bar-price {
    font-size: 22px;
    font-weight: 800;
    color: #1B3C57;
}

.bottom-bar-original {
    font-size: 15px;
    color: #999;
    text-decoration: line-through;
}

.bottom-bar-discount {
    background: #1B3C57;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
}

/* 操作区域 */
.bb-row-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

#bottom-bar-btn {
    background: #1B3C57;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    padding: 14px 22px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

#bottom-bar-btn:hover {
    background: #0f2a3d;
}

/* 下拉选择器 */
.select-wrapper {
    position: relative;
}

#bottom-bar-bundle-select {
    width: 100%;
    padding: 12px 36px 12px 14px;
    font-size: 15px;
    border-radius: 12px;
    border: 1.5px solid #cfe0f1;
    background: #f4f9ff;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.3s;
}

#bottom-bar-bundle-select:focus {
    border-color: #1B3C57;
    outline: none;
}

.select-wrapper::after {
    content: "";
    width: 10px;
    height: 10px;
    border-right: 2.5px solid #1B3C57;
    border-bottom: 2.5px solid #1B3C57;
    transform: rotate(45deg) translateY(-70%);
    position: absolute;
    right: 18px;
    top: 50%;
    pointer-events: none;
    transition: transform 0.2s ease;
}

/* 桌面端样式 */
@media (min-width: 1024px) {
    #custom-bottom-bar {
        display: grid;
        grid-template-columns: 1.6fr 1fr .8fr;
        align-items: center;
        gap: 24px;
        padding: 16px 32px;
    }
    
    .bb-product {
        display: flex;
        align-items: center;
        gap: 14px;
    }
    
    .bb-product img {
        width: 56px;
        height: 56px;
        border-radius: 10px;
        object-fit: cover;
    }
    
    .bb-price-mobile {
        display: none;
    }
    
    .bb-row-action {
        justify-content: flex-end;
    }
    
    .select-wrapper::after {
        right: 32px;
    }
}

/* 平板端样式 */
@media (min-width: 768px) and (max-width: 1023px) {
    #custom-bottom-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    .bb-product {
        grid-column: span 2;
        display: flex;
    }
    
    .bb-row-select {
        grid-column: 1;
    }
    
    .bb-row-action {
        grid-column: 2;
        justify-content: flex-end;
    }
}

/* 移动端样式 - 重点修复价格和按钮布局 */
@media (max-width: 767px) {
    .bb-row-action {
        flex-direction: row; /* 确保在同一行 */
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        width: 100%;
    }
    
    .bb-price-mobile {
        display: flex !important; /* 强制显示 */
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
        flex: 1; /* 占据可用空间 */
        min-width: 0; /* 允许压缩 */
    }
    
    .bb-price-mobile .bottom-bar-price {
        font-size: 20px; /* 移动端稍小 */
    }
    
    .bb-price-mobile .bottom-bar-original {
        font-size: 14px; /* 移动端稍小 */
    }
    
    .bb-price-mobile .bottom-bar-discount {
        font-size: 12px;
        padding: 2px 4px;
    }
    
    #bottom-bar-btn {
        font-size: 16px;
        padding: 12px 18px;
        min-width: 120px; /* 确保按钮有足够宽度 */
        flex-shrink: 0; /* 防止按钮被压缩 */
    }
    
    /* 确保移动端价格区域内的元素正确排列 */
    .bb-price-mobile .bottom-bar-price,
    .bb-price-mobile .bottom-bar-original,
    .bb-price-mobile .bottom-bar-discount {
        white-space: nowrap; /* 防止价格换行 */
    }
    
    /* 如果价格太长，允许适当压缩 */
    .bb-price-mobile {
        overflow: hidden;
    }
    
    .bb-price-mobile .bottom-bar-price {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px; /* 限制价格显示宽度 */
    }
}

/* 超小屏幕手机优化 */
@media (max-width: 480px) {
    .bb-row-action {
        gap: 8px;
    }
    
    .bb-price-mobile {
        gap: 4px;
    }
    
    .bb-price-mobile .bottom-bar-price {
        font-size: 18px;
        max-width: 80px;
    }
    
    #bottom-bar-btn {
        font-size: 15px;
        padding: 10px 15px;
        min-width: 100px;
    }
    
    .bb-price-mobile .bottom-bar-discount {
        font-size: 11px;
        padding: 1px 3px;
    }
}

/* 确保移动端隐藏桌面端的价格显示 */
@media (max-width: 1023px) {
    .bb-price:not(.bb-price-mobile) {
        display: none;
    }
}

/* 确保桌面端隐藏移动端的价格显示 */
@media (min-width: 1024px) {
    .bb-price-mobile {
        display: none !important;
    }
}