/**
 * WC Bulk Order - 前端样式
 */

/* ===== 容器 ===== */
.wc-bo-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== 头部 ===== */
.wc-bo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
}

.wc-bo-title {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.wc-bo-cart-info {
    display: flex;
    align-items: center;
}

.wc-bo-cart-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: background 0.2s;
}

.wc-bo-cart-link:hover {
    background: #e9ecef;
}

.wc-bo-cart-icon {
    font-size: 1.2rem;
    margin-right: 6px;
}

.wc-bo-cart-count {
    font-weight: 600;
    color: #007bff;
}

/* ===== 搜索区域 ===== */
.wc-bo-search-area {
    margin-bottom: 20px;
}

.wc-bo-search-row {
    display: flex;
    gap: 10px;
}

.wc-bo-search-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wc-bo-search-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.wc-bo-search-hint {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #888;
}

/* ===== 按钮 ===== */
.wc-bo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.wc-bo-btn-primary {
    background: #007bff;
    color: #fff;
}

.wc-bo-btn-primary:hover {
    background: #0056b3;
}

.wc-bo-btn-success {
    background: #28a745;
    color: #fff;
}

.wc-bo-btn-success:hover {
    background: #218838;
}

.wc-bo-btn-danger {
    background: #dc3545;
    color: #fff;
}

.wc-bo-btn-danger:hover {
    background: #c82333;
}

.wc-bo-btn-secondary {
    background: #6c757d;
    color: #fff;
}

.wc-bo-btn-secondary:hover {
    background: #5a6268;
}

.wc-bo-btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.wc-bo-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== 加载指示器 ===== */
.wc-bo-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #666;
    gap: 10px;
}

.wc-bo-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: wc-bo-spin 0.8s linear infinite;
}

@keyframes wc-bo-spin {
    to { transform: rotate(360deg); }
}

/* ===== 搜索结果 ===== */
.wc-bo-results {
    margin-bottom: 20px;
}

.wc-bo-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 10px;
}

.wc-bo-results-title {
    font-weight: 600;
    color: #333;
}

.wc-bo-results-count {
    font-size: 0.85rem;
    color: #888;
}

.wc-bo-results-list {
    max-height: 400px;
    overflow-y: auto;
}

/* ===== 商品卡片 ===== */
.wc-bo-product-card {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wc-bo-product-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 6px rgba(0,123,255,0.1);
}

.wc-bo-product-card.selected {
    border-color: #28a745;
    background: #f0f9f4;
}

.wc-bo-product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
}

.wc-bo-product-info {
    flex: 1;
    min-width: 0;
}

.wc-bo-product-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wc-bo-product-sku {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 4px;
}

.wc-bo-product-sku code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, monospace;
}

.wc-bo-product-price {
    font-weight: 600;
    color: #28a745;
}

.wc-bo-product-stock {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
}

.wc-bo-product-stock.instock {
    color: #28a745;
}

.wc-bo-product-stock.outofstock {
    color: #dc3545;
}

.wc-bo-product-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 12px;
}

.wc-bo-qty-input {
    width: 60px;
    padding: 6px 8px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* ===== 无结果 ===== */
.wc-bo-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.wc-bo-no-results-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

/* ===== 已添加列表 ===== */
.wc-bo-added-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.wc-bo-added-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.wc-bo-added-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.wc-bo-added-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wc-bo-added-count {
    font-size: 0.9rem;
    color: #666;
    margin-right: 10px;
}

.wc-bo-added-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wc-bo-added-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.wc-bo-added-item.added {
    border-left-color: #28a745;
    background: #f0f9f4;
}

.wc-bo-added-item.adding {
    opacity: 0.7;
}

.wc-bo-added-item .wc-bo-product-image {
    width: 40px;
    height: 40px;
}

.wc-bo-added-item .wc-bo-product-name {
    font-size: 0.95rem;
}

.wc-bo-added-item .wc-bo-product-sku {
    font-size: 0.8rem;
}

.wc-bo-added-item .wc-bo-product-actions {
    margin-left: auto;
}

.wc-bo-added-item .wc-bo-qty-input {
    width: 50px;
}

.wc-bo-added-item .wc-bo-btn-remove {
    background: transparent;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.wc-bo-added-item .wc-bo-btn-remove:hover {
    background: #ffe5e5;
}

.wc-bo-added-item .wc-bo-status {
    font-size: 0.85rem;
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 3px;
}

.wc-bo-added-item .wc-bo-status.success {
    color: #28a745;
    background: #d4edda;
}

.wc-bo-added-item .wc-bo-status.error {
    color: #dc3545;
    background: #f8d7da;
}

/* ===== Toast 通知 ===== */
.wc-bo-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 24px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.wc-bo-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.wc-bo-toast.success {
    background: #28a745;
}

.wc-bo-toast.error {
    background: #dc3545;
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
    .wc-bo-container {
        padding: 15px;
    }

    .wc-bo-search-row {
        flex-direction: column;
    }

    .wc-bo-product-card {
        flex-wrap: wrap;
    }

    .wc-bo-product-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
        justify-content: flex-end;
    }

    .wc-bo-added-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .wc-bo-added-actions {
        width: 100%;
        justify-content: space-between;
    }
}
