/* ===== 标准纸箱尺寸工具样式 sbs- ===== */

/* ---- 通用隐藏（禁用 jQuery show/hide，统一用 CSS class） ---- */
.sbs-hidden { display: none !important; }

/* ---- 容器 ---- */
.sbs-container {
    padding: 0 0 12px 0;
    font-size: 14px;
    color: #333;
}

/* ---- 顶部工具栏 ---- */
.sbs-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    background: linear-gradient(to bottom, #ffffff, #f5f7fb);
    border-bottom: 1px solid #e3e6ea;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    flex-wrap: wrap;
}

.sbs-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sbs-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sbs-toolbar-label {
    font-size: 12px;
    color: #8a95a3;
    font-weight: 600;
    white-space: nowrap;
}

.sbs-cat-group {
    display: flex;
    gap: 4px;
}

.sbs-cat-btn {
    padding: 4px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    background: #fff;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.sbs-cat-btn:hover {
    border-color: #4a90e2;
    color: #4a90e2;
    background: #f4f8ff;
}

.sbs-cat-btn.active {
    background: #4a90e2;
    border-color: #4a90e2;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(74,144,226,0.28);
}

.sbs-search-input {
    padding: 5px 10px;
    border: 1px solid #d8dde6;
    border-radius: 6px;
    font-size: 13px;
    color: #2c3e50;
    background: #fff;
    outline: none;
    width: 200px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sbs-search-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74,144,226,0.12);
}

/* ---- 双列布局 ---- */
.sbs-two-col {
    display: flex;
    gap: 0;
    min-height: 480px;
}

.sbs-input-panel {
    flex: 0 0 300px;
    padding: 12px 14px;
    border-right: 1px solid #e3e6ea;
    background: #fafbff;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}
.sbs-input-panel::-webkit-scrollbar { width: 4px; }
.sbs-input-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.sbs-result-panel {
    flex: 1;
    padding: 12px 14px;
    overflow-y: auto;
    background: #fff;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    min-width: 0;
}
.sbs-result-panel::-webkit-scrollbar { width: 4px; }
.sbs-result-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* ---- 小节标题 ---- */
.sbs-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #4a90e2;
    padding: 2px 0 5px 10px;
    border-bottom: 1px solid #e8edf3;
    margin-bottom: 6px;
    position: relative;
}

.sbs-section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 5px;
    width: 3px;
    background: #4a90e2;
    border-radius: 2px;
}

.sbs-hint {
    font-size: 11px;
    color: #a0aab8;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

/* ---- 分隔线 ---- */
.sbs-divider {
    height: 1px;
    background: #e8edf3;
    margin: 12px 0;
}

/* ---- 表单行 ---- */
.sbs-form-row {
    margin-bottom: 7px;
}

.sbs-row-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sbs-label {
    font-size: 11px;
    color: #8a95a3;
    font-weight: 700;
    white-space: nowrap;
    min-width: 28px;
    text-align: right;
}

.sbs-dim-input {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid #d8dde6;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    background: #fff;
    outline: none;
    -moz-appearance: textfield;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
    max-width: 90px;
}

.sbs-dim-input::-webkit-inner-spin-button,
.sbs-dim-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.sbs-dim-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74,144,226,0.15);
}

.sbs-unit {
    font-size: 11px;
    color: #8a95a3;
    white-space: nowrap;
    min-width: 34px;
}

/* ---- 提交按钮 ---- */
.sbs-action-row {
    margin-top: 10px;
    display: flex;
    gap: 6px;
}

.sbs-action-row .sbs-btn-primary {
    flex: 1;
    width: auto;
}

.sbs-btn-primary {
    width: 100%;
    padding: 9px 16px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(74,144,226,0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sbs-btn-primary:hover {
    background: linear-gradient(135deg, #357abd, #2868a0);
    box-shadow: 0 4px 14px rgba(74,144,226,0.38);
    transform: translateY(-1px);
}

.sbs-btn-primary:active {
    transform: translateY(0);
}

/* ---- 清空按钮 ---- */
.sbs-btn-clear {
    padding: 9px 14px;
    background: #fff;
    color: #718096;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.sbs-btn-clear:hover {
    border-color: #e53e3e;
    color: #e53e3e;
    background: #fff5f5;
}

.sbs-shortcut {
    font-size: 11px;
    opacity: 0.75;
    font-weight: 400;
}

.sbs-shortcut kbd {
    background: rgba(255,255,255,0.22);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 3px;
    padding: 1px 4px;
    font-family: inherit;
    font-size: 10px;
}

/* ---- 错误提示 ---- */
.sbs-error-box {
    margin-top: 8px;
    padding: 8px 10px;
    background: #fff5f5;
    border: 1px solid #ffc7c7;
    border-radius: 6px;
    color: #c0392b;
    font-size: 12px;
}

/* ---- 计算器结果 ---- */
.sbs-calc-result {
    margin-top: 8px;
}

.sbs-calc-table {
    background: #f4f8ff;
    border: 1px solid #dce9f8;
    border-radius: 7px;
    overflow: hidden;
    animation: sbsFadeIn 0.25s ease;
}

@keyframes sbsFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sbs-calc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    border-bottom: 1px solid #e4eef9;
    gap: 8px;
}

.sbs-calc-row:last-child {
    border-bottom: none;
}

.sbs-calc-key {
    font-size: 12px;
    color: #8a95a3;
    white-space: nowrap;
}

.sbs-calc-val {
    font-size: 13px;
    font-weight: 700;
    color: #2c6fad;
    font-family: 'Consolas', monospace;
    padding: 1px 4px;
    border-radius: 3px;
    transition: background 0.15s;
}

.sbs-calc-val:hover {
    background: #dceeff;
    color: #1a56db;
}

/* ---- 点击复制通用 ---- */
.df-clickcopy {
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}

.df-clickcopy:hover {
    background: #e8f0fe;
    color: #1a56db;
}

/* ---- 推荐结果区 ---- */
.sbs-rec-section {
    margin-bottom: 14px;
    border: 1px solid #d4e4fa;
    border-radius: 8px;
    overflow: hidden;
    background: #f7fbff;
    box-shadow: 0 1px 6px rgba(74,144,226,0.08);
}

.sbs-rec-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(to right, #e8f2ff, #f0f7ff);
    border-bottom: 1px solid #d4e4fa;
}

.sbs-rec-title {
    font-size: 13px;
    font-weight: 700;
    color: #2c5282;
    white-space: nowrap;
}

.sbs-rec-meta {
    font-size: 11px;
    color: #718096;
    line-height: 1.5;
}

.sbs-rec-meta strong {
    color: #2d3748;
}

.sbs-min-dims {
    color: #2b6cb0;
}

.sbs-no-match {
    padding: 12px 14px;
    color: #b7791f;
    font-size: 13px;
    background: #fffbeb;
}

/* 推荐列表：2 列 grid 布局，最佳条目独占一行 */
.sbs-rec-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: #dde8f6;
}

.sbs-rec-item {
    padding: 8px 10px;
    position: relative;
    background: #fff;
    transition: background 0.15s;
    min-width: 0;
}

.sbs-rec-item:last-child {
    border-bottom: none;
}

.sbs-rec-item:hover {
    background: #f0f7ff;
    transition: background 0.15s;
}

.sbs-rec-best {
    grid-column: 1 / -1;
    background: linear-gradient(to right, #e6f7f0, #f0faf6) !important;
    border-left: 3px solid #38a169;
}

/* 最后一个元素若为奇数列（会留空列），则让它独占一行 */
.sbs-rec-item:not(.sbs-rec-best):last-child:nth-child(even) {
    grid-column: 1 / -1;
}

.sbs-rec-badge {
    display: inline-block;
    padding: 2px 7px;
    background: #38a169;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 3px;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.sbs-rec-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.sbs-rec-name {
    font-size: 14px;
    font-weight: 700;
    color: #2d3748;
}

.sbs-rec-dims {
    font-size: 13px;
    font-weight: 600;
    color: #2b6cb0;
    font-family: 'Consolas', monospace;
    margin-bottom: 3px;
    display: inline-block;
    padding: 1px 4px;
    border-radius: 3px;
}

.sbs-rec-usage {
    font-size: 11px;
    color: #718096;
    margin-bottom: 4px;
}

/* 利用率条 */
.sbs-rec-util {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.sbs-util-bar-wrap {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    max-width: 180px;
}

.sbs-util-bar {
    height: 100%;
    background: linear-gradient(to right, #4a90e2, #38a169);
    border-radius: 3px;
    transition: width 0.4s ease;
    max-width: 100%;
}

.sbs-util-pct {
    font-size: 12px;
    font-weight: 700;
    color: #2b6cb0;
    min-width: 36px;
}

.sbs-util-label {
    font-size: 11px;
    color: #a0aab8;
}

.sbs-rec-stats {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #718096;
    flex-wrap: wrap;
}

.sbs-stat-val {
    font-weight: 600;
    color: #2d3748;
    font-family: 'Consolas', monospace;
}

.sbs-stat-sep {
    color: #cbd5e0;
}

/* ---- 分类标签 ---- */
.sbs-cat-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 9px;
    font-weight: 600;
    white-space: nowrap;
}

.sbs-cat-postal {
    background: #ebf4ff;
    color: #2b6cb0;
    border: 1px solid #bee3f8;
}

.sbs-cat-ecom {
    background: #fefce8;
    color: #b7791f;
    border: 1px solid #fef3c7;
}

/* ---- 标准尺寸表格 ---- */
.sbs-table-section {
    border: 1px solid #e3e6ea;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.sbs-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: linear-gradient(to bottom, #f8fafd, #f0f4fb);
    border-bottom: 1px solid #e3e6ea;
}

.sbs-table-title {
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
}

.sbs-table-count {
    font-size: 12px;
    color: #8a95a3;
}

.sbs-table-count strong {
    color: #4a90e2;
}

.sbs-table-wrap {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}
.sbs-table-wrap::-webkit-scrollbar { height: 4px; }
.sbs-table-wrap::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.sbs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sbs-table thead tr {
    background: #f5f7fa;
}

.sbs-table th {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #6b7a90;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid #e3e6ea;
    background: #f5f7fa;
}

.sbs-th-num {
    text-align: right;
}

.sbs-th-usage {
    min-width: 120px;
}

.sbs-table tbody tr {
    border-bottom: 1px solid #f0f4f8;
    transition: background 0.12s;
}

.sbs-table tbody tr:last-child {
    border-bottom: none;
}

/* 表格斑马纹，提升可读性 */
.sbs-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.sbs-table tbody tr:hover,
.sbs-table tbody tr:nth-child(even):hover {
    background: #eef4ff !important;
    transition: background 0.1s;
}

.sbs-table td {
    padding: 7px 10px;
    vertical-align: middle;
}

.sbs-name-cell {
    white-space: nowrap;
}

.sbs-box-name {
    font-weight: 600;
    color: #2d3748;
    padding: 1px 4px;
    border-radius: 3px;
}

.sbs-td-num {
    text-align: right;
    font-family: 'Consolas', monospace;
    color: #4a5568;
    font-size: 13px;
}

.sbs-usage-cell {
    font-size: 12px;
    color: #718096;
    max-width: 180px;
}

.sbs-table-empty {
    padding: 24px 0;
    text-align: center;
    color: #b0bbc8;
    font-size: 13px;
    background: #fafbff;
    border-top: 1px dashed #e3e6ea;
}

/* ---- 推荐结果计数 ---- */
.sbs-rec-count {
    font-size: 11px;
    color: #38a169;
    font-weight: 600;
    background: #f0fdf4;
    border: 1px solid #c6f6d5;
    border-radius: 10px;
    padding: 1px 8px;
    white-space: nowrap;
}

.sbs-rec-count strong {
    color: #276749;
}

/* ---- 利用率条颜色级别 ---- */
.sbs-util-bar--high {
    background: linear-gradient(to right, #38a169, #22c55e);
}

.sbs-util-bar--mid {
    background: linear-gradient(to right, #d97706, #f59e0b);
}

.sbs-util-bar--low {
    background: linear-gradient(to right, #e53e3e, #f87171);
}

/* ---- 利用率百分比文字颜色 ---- */
.sbs-util-pct--high { color: #16a34a; }
.sbs-util-pct--mid  { color: #d97706; }
.sbs-util-pct--low  { color: #dc2626; }

/* ---- 表格排序 ---- */
.sbs-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sbs-sortable:hover {
    background: #e8f0fe;
    color: #2c72d6;
}

.sbs-th-sorted-asc,
.sbs-th-sorted-desc {
    background: #ddeafe !important;
    color: #2c72d6 !important;
}

.sbs-sort-icon {
    font-size: 10px;
    opacity: 0.4;
    margin-left: 2px;
    display: inline-block;
}

.sbs-th-sorted-asc .sbs-sort-icon,
.sbs-th-sorted-desc .sbs-sort-icon {
    opacity: 1;
    color: #4a90e2;
}

/* ---- 表格行激活高亮（点击填入计算器） ---- */
.sbs-row-active {
    background: #eff6ff !important;
    box-shadow: inset 3px 0 0 #4a90e2;
}

.sbs-row-active:hover {
    background: #eff6ff !important;
}

/* ---- 表格行可点击光标提示 ---- */
#sbsTable tbody tr {
    cursor: pointer;
}
.sbs-sample-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.sbs-sample-btn {
    padding: 3px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fff;
    color: #555;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.sbs-sample-btn:hover {
    border-color: #4a90e2;
    color: #4a90e2;
    background: #f4f8ff;
}

/* ---- 计算器补充 ---- */
.sbs-calc-tip {
    font-size: 10px;
    color: #a0aab8;
    white-space: nowrap;
}

/* ---- Toast ---- */
.sbs-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(44,62,80,0.92);
    color: #fff;
    padding: 9px 20px;
    border-radius: 20px;
    font-size: 13px;
    pointer-events: auto;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    user-select: none;
}

.sbs-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.sbs-toast--success { background: rgba(22,163,74,0.93); }
.sbs-toast--warning { background: rgba(180,120,0,0.93); }
.sbs-toast--error   { background: rgba(220,38,38,0.93); }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .sbs-two-col {
        flex-direction: column;
    }

    .sbs-input-panel {
        flex: none;
        border-right: none;
        border-bottom: 1px solid #e3e6ea;
    }

    .sbs-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .sbs-search-input {
        width: 100%;
    }

    .sbs-rec-list {
        grid-template-columns: 1fr;
    }

    .sbs-rec-best {
        grid-column: 1;
    }

    .sbs-rec-item:not(.sbs-rec-best):last-child:nth-child(even) {
        grid-column: 1;
    }
}
