/* ================================================
   B2B Promo Order Engine — Common / Base Styles
   通用样式：步骤编号、禁用状态、迷你购物车、响应式
   ================================================ */

/* ----- 三大配置板块统一样式 ----- */
.b2b-config-section {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 0 0 20px;
    clear: both;
}

/* ----- 板块标题 + 右侧装饰线 ----- */
.b2b-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 14px;
    line-height: 1.4;
    white-space: nowrap;
}

.b2b-section-title::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e0e0e0;
    align-self: center;
}

#b2b-print-options-wrap {
    padding: 0;
}

/* ---------- 步骤编号（默认灰色） ---------- */
.b2b-step-num {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    border-radius: 50%;
    background: #9e9e9e;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    margin-right: 6px;
    vertical-align: middle;
    transition: background 0.2s;
}

/* 完成状态 → 绿色 */
.b2b-step-num.b2b-step-num-done {
    background: #4caf50;
}

/* ---------- 禁用按钮灰色 ---------- */
.single_add_to_cart_button.b2b-disabled,
.single_add_to_cart_button:disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    background-color: #bbb !important;
    border-color: #bbb !important;
    color: #fff !important;
}

/* ---------- 迷你购物车印刷信息 ---------- */
.b2b-mini-cart-imprint { margin-top: 4px; font-size: 0.8rem; color: #555; line-height: 1.4; }
.b2b-mini-cart-meta { display: block; }

/* ---------- 购物车轻提示 ---------- */
.b2b-cart-notice {
    position: fixed; top: 20px; right: 20px; z-index: 999999;
    min-width: 280px; max-width: 420px; padding: 14px 20px;
    background: #fff; border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    font-size: 0.95rem; display: flex; align-items: center; gap: 12px;
    animation: b2bSlideIn 0.3s ease;
}
@keyframes b2bSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.b2b-cart-notice--success { border-left: 4px solid #2e7d32; color: #1a3a5c; }
.b2b-cart-notice--error   { border-left: 4px solid #d32f2f; color: #a00; }
.b2b-cart-notice-msg { flex: 1; }
.b2b-cart-notice-link { white-space: nowrap; color: #1a73e8; font-weight: 600; text-decoration: underline; margin-left: 8px; }
.b2b-cart-notice-close { background: none; border: none; font-size: 1.3rem; line-height: 1; cursor: pointer; color: #999; padding: 0 4px; }

/* 加宽购物车数量输入框（抽屉 + 普通购物车） */
.woocommerce-cart-form .quantity input.qty,
.woocommerce-cart-form .quantity .qty,
.widget_shopping_cart .quantity input.qty,
.moderncart-slide-out-cart-items .quantity input.qty {
    min-width: 60px; width: auto; padding: 2px 8px; text-align: center;
}

/* 修复 Modern Cart 抽屉中 Product details 与属性同行问题 */
.moderncart-cart-item-product-data {
    display: flex !important; flex-direction: column !important; padding: 8px 0;
}
.moderncart-cart-item-product-data > p { margin: 0 0 6px; }
.moderncart-cart-item-product-data p .b2b-logo-filename {
    color: #1a1a2e !important; font-weight: 600 !important;
}

/* ---------- 印刷属性优化（购物车 / 抽屉） ---------- */
.woocommerce-cart .variation,
.moderncart-slide-out-cart-items .variation {
    background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px;
    padding: 12px 16px; margin: 8px 0 16px; line-height: 1.6;
}
.woocommerce-cart .variation dt,
.moderncart-slide-out-cart-items .variation dt {
    font-size: 0.8rem; font-weight: 500; color: #6c757d;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 2px !important; display: block !important;
}
.woocommerce-cart .variation dd,
.moderncart-slide-out-cart-items .variation dd {
    font-size: 1rem; font-weight: 600; color: #1a1a2e;
    margin-left: 0 !important; margin-bottom: 10px; display: block !important;
}
.b2b-logo-thumbnail {
    display: block; max-width: 80px; max-height: 80px; width: auto; height: auto;
    border-radius: 6px; border: 1px solid #ddd; margin: 6px 0; object-fit: contain;
}
.b2b-logo-filename {
    display: block; font-size: 1rem; color: #1a1a2e !important; font-weight: 600 !important;
    word-break: break-all; margin-top: 4px;
}
#b2b_special_instructions,
#b2b_print_text { font-size: 0.9rem; line-height: 1.4; }
#b2b_special_instructions:focus,
#b2b_print_text:focus { border-color: #1a73e8; box-shadow: 0 0 0 3px rgba(26,115,232,0.15); }
.moderncart-slide-out-cart-items .variation dd p { margin: 0; }
@media (max-width: 600px) {
    .woocommerce-cart .variation,
    .moderncart-slide-out-cart-items .variation { padding: 10px 12px; }
}

/* ---------- 步骤进度条 ---------- */
.b2b-step-progress {
    display: flex; align-items: center; justify-content: space-between;
    margin: 0 0 20px; padding: 10px 0;
    border-bottom: 2px solid #e0e0e0; flex-wrap: wrap;
}
.b2b-step-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: #999; white-space: nowrap; transition: color 0.2s;
}
/* 进度条圆点（默认灰色） */
.b2b-step-dot {
    width: 20px; height: 20px; border-radius: 50%;
    background: #9e9e9e; display: inline-block; flex-shrink: 0;
    transition: background 0.2s, box-shadow 0.2s;
}
/* 完成状态 → 绿色 */
.b2b-step-item.b2b-step-done .b2b-step-dot {
    background: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}
.b2b-step-item.b2b-step-done .b2b-step-label {
    color: #2e7d32; font-weight: 600;
}
.b2b-step-item:hover .b2b-step-label { text-decoration: underline; }

/* ========== 主题隔离层 ========== */
#b2b-section-variations,
#b2b-section-quantity,
#b2b-section-imprint {
    box-shadow: none !important; margin-bottom: 20px !important;
}
#b2b-section-variations table,
#b2b-section-variations tr,
#b2b-section-variations td,
#b2b-section-variations th {
    border: none !important; border-bottom: none !important; background: transparent !important;
}
#b2b-section-variations td.value {
    border-bottom: none !important;
}
#b2b-section-imprint input,
#b2b-section-imprint select,
#b2b-section-imprint textarea,
#b2b-section-imprint button,
#b2b-section-quantity input,
#b2b-section-quantity select,
#b2b-section-quantity button {
    box-sizing: border-box !important; font-family: inherit !important;
}
#b2b-section-variations .reset_variations {
    border-bottom: none !important; text-decoration: none !important;
}

/* ---------- B2B_Error 统一通知（替代 alert） ---------- */
.b2b-notice {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999999;
    min-width: 300px;
    max-width: 500px;
    padding: 14px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: b2bSlideIn 0.3s ease;
}

.b2b-notice--error   { border-left: 4px solid #d32f2f; }
.b2b-notice--success { border-left: 4px solid #2e7d32; }
.b2b-notice--info    { border-left: 4px solid #1976d2; }

.b2b-notice-icon    { font-size: 1.2rem; flex-shrink: 0; }
.b2b-notice-message { flex: 1; color: #333; font-size: 0.95rem; line-height: 1.4; }
.b2b-notice-close {
    background: none; border: none; font-size: 1.3rem; line-height: 1;
    cursor: pointer; color: #999; padding: 0 4px; flex-shrink: 0;
}
.b2b-notice-close:hover { color: #333; }

/* 独立数量输入框（询盘模式下） */
.b2b-inquiry-qty {
    width: 100%;
    max-width: 260px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    display: block;
    margin: 8px 0 12px;
}

/* 主询盘按钮 */
.b2b-inquiry-btn--primary {
    width: 100%;
    margin-left: 0 !important;
    padding: 0.8em 1.5em;
    font-size: 1.1rem;
    background: #0d47a1;
    border-color: #0d47a1;
}
.b2b-inquiry-btn--primary:hover {
    background: #0a3a7e;
    border-color: #0a3a7e;
}

/* 隐藏直购按钮 */
.b2b-hidden {
    display: none !important;
}

.b2b-pricing-note {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f4f8ff;
    border-left: 3px solid #1a73e8;
    color: #1a3a5c;
    font-size: 0.95rem;
    line-height: 1.5;
}


/* ===== astra 主题特有-开始 ===== */
/* ===== 强制产品标题始终可见 ===== */
.product_title.entry-title {
    display: block !important;
    visibility: visible !important;
}
/* ===== 
强制产品页产品名 Javelin Pen 下方的
$1.00 + Free Shipping 不显示, 因为不需要
===== */
.single_add_to_cart_button,
.ppc-button-wrapper,
.paypal-button-container,
.ppcp-button-container,
.wc-paypal-express-button,
form.cart .quantity,
.summary .price,
.ast-shipping-text {
    display: none !important;
}
/* ===== 
强制产品页 Home / All Catalogs / Pens / Javelin Pen 下方的
All Catalogs, Pens 不显示, 因为功能重复了
===== */
.single-product-category {
    display: none !important;
}

/* ============================================================
   At a Glance — 图片正下方，摘要右侧（Grid 布局）
   适配 Astra 主题
   ============================================================ */

/*
  目标结构（渲染后的 DOM 顺序）：
  .woocommerce div.product
    ├── .woocommerce-product-gallery   → 左列第1行
    ├── .b2b-at-a-glance-inline        → 左列第2行  ← 钩子priority=25插入
    └── .summary.entry-summary         → 右列第1~2行（跨行）
    底部 Tabs 全宽
*/

/* 1. 覆盖 Astra flex，改为 Grid */
.woocommerce div.product {
    display: grid !important;
    grid-template-columns: 48% 48% !important;
    column-gap: 4% !important;
    grid-template-rows: auto auto auto !important;
    flex-wrap: unset !important;
    align-items: unset !important;
}

/* 2. 图片区：左列第1行 */
.woocommerce div.product .woocommerce-product-gallery {
    grid-column: 1 !important;
    grid-row: 1 !important;
    float: none !important;
    width: auto !important;
    max-width: none !important;
    margin-bottom: 0 !important;
}

/* 3. At a Glance：左列第2行 */
.woocommerce div.product .b2b-at-a-glance-inline {
    grid-column: 1 !important;
    grid-row: 2 !important;
    margin-top: 16px;
    float: none !important;
    width: auto !important;
}

/* 4. 摘要区：右列，跨越第1~2行 */
.woocommerce div.product .summary.entry-summary {
    grid-column: 2 !important;
    grid-row: 1 / 3 !important;
    float: none !important;
    width: auto !important;
    max-width: none !important;
}

/* 5. Tabs（Description / Additional information / Reviews）：
      跨越全部列，恢复占满整行 */
.woocommerce div.product .woocommerce-tabs {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    width: 100% !important;
    float: none !important;
    margin-top: 40px;
    clear: both;
}

/* 6. At a Glance 内部样式 */
.b2b-at-a-glance-inline {
    align-self: start;          /* ★ 不再拉伸，高度由内容决定 */
    margin-bottom: 0 ;
    padding: 24px 28px; 
    overflow: hidden;           /* 保险：防止任何子元素外边距溢出 */
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.b2b-glance-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
}

.b2b-glance-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0; /* 新增加的 */
}

.b2b-glance-table th {
    background: #0f172a;
    color: #fff;
    padding: 10px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.b2b-glance-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.93rem;
    vertical-align: top;
}

.b2b-glance-table tr:nth-child(even) td {
    background-color: #f8fafc;
}

.b2b-glance-table tr:last-child td {
    border-bottom: none;
}

/* 7. 移动端：全部恢复单列堆叠 */
@media (max-width: 768px) {
    .woocommerce div.product {
        grid-template-columns: 1fr !important;
        column-gap: 0 !important;
    }

    .woocommerce div.product .woocommerce-product-gallery {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }

    .woocommerce div.product .b2b-at-a-glance-inline {
        grid-column: 1 !important;
        grid-row: 2 !important;
    }

    .woocommerce div.product .summary.entry-summary {
        grid-column: 1 !important;
        grid-row: 3 !important;
    }

    /* 移动端 Tabs 无需特殊处理，grid-column:1/-1 在单列时就是占满 */
    .woocommerce div.product .woocommerce-tabs {
        margin-top: 24px;
    }
}


/* ===== astra 主题特有-结束 ===== */

@media (max-width: 600px) {
    .b2b-notice {
        top: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
    }
}


/* ---------- 响应式适配（通用） ---------- */
@media (max-width: 600px) {
    .b2b-summary-section { gap: 10px; }
    .b2b-summary-qty,
    .b2b-summary-item-price,
    .b2b-summary-subtotal { min-width: 90px; }
    .b2b-summary-value { font-size: 1rem; padding: 6px 10px; min-width: 80px; }
}
