:root {
    /* 统一设计系统颜色变量 */
    --primary-color: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #667eea 100%);
    --secondary-color: #667eea;
    --success-color: #4CAF50;
    --warning-color: #FFCA28;
    --info-color: #64B5F6;
    --error-color: #e53935;
    
    /* 灰度色系 - 与设计系统保持一致 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* 文本颜色 */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-700);
    --text-muted: var(--gray-600);
    --text-light: var(--gray-500);
    
    /* 背景色 */
    --background-light: #ffffff;
    --background-medium: var(--gray-50);
    --background-dark: var(--gray-100);
    
    /* 边框颜色 */
    --border-color-light: var(--gray-200);
    --border-color-medium: var(--gray-300);
    
    /* 阴影 */
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --card-hover-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    --input-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    
    /* 圆角 */
    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 16px;
    
    /* 动画 */
    --transition-speed: 0.3s;
}

/* 页面容器 - 统一背景系统，覆盖整个视窗 */
.backbar-content {
    line-height: 1.4;
    width: 100%;
    margin: 0;
    position: relative;
    padding: 40px 20px;
    background-color: var(--gray-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 移除了container-bar包装，现在tool-container-bar直接作为主容器 */

/* 主容器卡片 */
.tool-container-bar {
    background-color: var(--background-light);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 3rem;
    width: 100%;
    max-width: 1200px;
    border: 1px solid var(--border-color-light);
    transition: box-shadow var(--transition-speed) ease, transform var(--transition-speed) ease;
    box-sizing: border-box;
}

.tool-container-bar:hover {
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-2px);
}

/* 工具头部 - 统一设计系统风格 */
.tool-header-bar {
    margin-bottom: 2.5rem;
    text-align: center;
    position: relative;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.tool-header-bar h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    letter-spacing: -0.025em;
}

.tool-header-bar p {
    color: var(--gray-700);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* 标题样式 - 统一设计系统风格 */
h2.heading-bar {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    position: relative;
    background: linear-gradient(135deg, var(--primary-color) 0%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.left-column-bar > h2.heading-bar:first-of-type,
.right-column-bar > h2.heading-bar:first-of-type {
    margin-top: 0;
}

h2.heading-bar::after {
    display: none;
}

/* 两列布局 */
.two-column-layout-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.left-column-bar, .right-column-bar {
    flex: 1;
    min-width: 300px;
    background-color: var(--background-light);
    border-radius: var(--border-radius-md);
    padding: 25px;
    box-sizing: border-box;
}

/* 输入区域统一样式 */
.input-section-bar {
    padding: 22px;
    border-radius: var(--border-radius-md);
    margin-bottom: 25px;
    border: 1px solid var(--border-color-light);
    box-shadow: var(--input-shadow);
    transition: all var(--transition-speed) ease;
    background: linear-gradient(to right, #f8f9fa, #f0f2f5);
    border-left: 1px solid var(--border-color-light);
    position: relative;
    overflow: hidden;
}

/* 确保input-section-bar在指定的display值时保持可见 */
.input-section-bar[style*="display: block"] {
    display: block !important; /* 强制可见 */
}

.input-section-bar:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--border-color-medium);
}

.input-section-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.03) 0%, rgba(91, 141, 239, 0.03) 100%);
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
    z-index: 0;
    pointer-events: none;
}

.input-section-bar:hover::before {
    opacity: 1;
}

.input-section-bar > .form-grid-bar {
    position: relative;
    z-index: 1;
}

/* 输入框和标签 */
.bar-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color-medium);
    font-size: 0.95rem;
}

.bar-input, .bar-select {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid var(--border-color-medium);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-speed) ease;
    box-sizing: border-box;
    background-color: var(--background-light);
    box-shadow: var(--input-shadow);
}

.bar-input:hover, .bar-select:hover {
    border-color: var(--secondary-color);
}

.bar-input:focus, .bar-select:focus {
    border-color: var(--border-color-medium);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    outline: none;
}

.bar-input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
    cursor: pointer;
}

.field-tip-bar {
    display: block;
    margin-top: 6px;
    color: var(--text-color-light);
    font-size: 0.85rem;
}

/* 特殊容器样式 */
.error-tolerance-bar {
    display: none !important;
}

/* 表单网格 */
.form-grid-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

/* 结果区域 */
.backbar-result {
    background-color: var(--background-light);
    padding: 5px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color-light);
    position: relative;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
    animation: fadeIn var(--transition-speed) ease-out;
}

.backbar-result::before {
    display: none;
}

.backbar-result h3 {
    color: var(--text-color-dark);
    font-size: 1.15rem;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color-light);
    text-align: center;
    font-weight: 600;
}

#backbar_type {
    flex-grow: 1;
    margin-bottom: 15px;
}

#backbar_type div {
    color: var(--text-color-light);
    text-align: center;
    padding: 30px 10px;
    font-size: 1.05rem;
    background-color: transparent;
}

/* 空状态和单行数据样式 */
#backbar_type:empty {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    background-color: var(--background-medium);
    border-radius: var(--border-radius-sm);
    margin: 15px 0;
    padding: 15px;
    color: var(--text-color-light);
    font-size: 1rem;
}

.single-row-table .grid-row > div {
    padding: 3px 5px;
}

/* 结果表格样式 */
.result-grid-bar {
    width: 100%;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    border: 1px solid #e0e0e0;
}

/* 表格样式 */
.grid-header-bar, 
.grid-row-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1.3fr 1.5fr;
    padding: 0.2rem 0.4rem;
    gap: 0.2rem;
    align-items: center;
}

.grid-header-bar {
    background-color: var(--gray-100);
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    color: var(--gray-700);
    text-align: center;
    font-size: 0.95rem;
    padding: 0.25rem 0.4rem;
}

.grid-row-bar {
    border-bottom: 1px solid var(--gray-200);
    min-height: 1.7rem;
}

.grid-row-bar:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.grid-row-bar > div {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0.1rem 0;
    font-size: 0.95rem;
    line-height: 1.2;
}

/* 类型列样式 */
.grid-row-bar > div:first-child {
    font-weight: 500;
    justify-content: center;
}

/* 数量列样式 */
.grid-row-bar > div:nth-child(2) {
    font-weight: 600;
    justify-content: center;
}

/* 价格列样式 */
.grid-row-bar > div:nth-child(3) {
    color: var(--primary-color);
    justify-content: center;
}

/* 编码列样式 */
.grid-row-bar > div:nth-child(4) {
    font-family: monospace;
    font-size: 0.82rem;
    letter-spacing: -0.5px;
    justify-content: center;
}

/* 空行/单行调整 */
.result-grid-bar.single-row-bar .grid-row-bar > div {
    padding-top: 0px;
    padding-bottom: 0px;
}

/* 多行时紧凑显示 */
.result-grid-bar.multi-row-bar .grid-row-bar > div {
    padding-top: 1px;
    padding-bottom: 1px;
}

/* 总计区域 */
.totals-container-bar {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) minmax(100px, 1.2fr) minmax(90px, 0.9fr) minmax(100px, 1fr);
    margin-top: 0;
    padding: 0;
    border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
    overflow: hidden;
    border-top: 1px solid #e0e0e0;
    background-color: #f7f7f7;
}

#backbar_quantity {
    grid-column: 1 / 3;
    font-weight: 600;
    color: #333333;
    padding: 10px 15px;
    font-size: 1rem;
    border: none;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#backbar_total_price {
    grid-column: 3 / 5;
    font-size: 1rem;
    font-weight: 700;
    color: #06a0ddbf;
    padding: 10px 15px;
    text-align: center;
    border: none;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 空状态样式 */
.empty-state-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-color-light);
    text-align: center;
    background-color: var(--background-medium);
    border-radius: var(--border-radius-sm);
    margin: 20px 0;
}

.empty-state-icon-bar {
    font-size: 2.5rem;
    color: var(--border-color-medium);
    margin-bottom: 15px;
}

.empty-state-text-bar {
    font-size: 1.05rem;
    max-width: 400px;
}

/* 响应式表格优化 */
@media (max-width: 767px) {
    .grid-header-bar, .grid-row-bar, .totals-container-bar {
        grid-template-columns: 1fr 1.2fr 1fr;
    }
    
    .grid-header-bar > div:nth-child(n+4),
    .grid-row-bar > div:nth-child(n+4) {
        display: none;
    }
    
    .grid-row-bar > div:first-child {
        padding-left: 10px;
    }
    
    #backbar_quantity {
        grid-column: 1 / 2;
        justify-content: flex-start;
        padding-left: 10px;
    }
    
    #backbar_total_price {
        grid-column: 2 / 4;
        justify-content: flex-end;
        padding-right: 10px;
    }
}

/* 按钮样式 */
.btn-primary-bar {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 500;
    margin-top: 15px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(66, 133, 244, 0.25);
}

.btn-primary-bar:hover {
    box-shadow: 0 6px 10px rgba(66, 133, 244, 0.35);
    transform: translateY(-2px);
}

/* 下拉选择框增强样式 */
.bar-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color-medium);
    border-radius: var(--border-radius-sm);
    background-color: white;
    color: var(--text-color-dark);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    height: auto;
    cursor: pointer;
}

.bar-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.bar-select option {
    padding: 0.75rem;
    font-size: 0.95rem;
    background-color: white;
    color: var(--text-color-dark);
}

.bar-select option:disabled {
    color: var(--text-color-light);
    background-color: #f5f5f5;
    font-style: italic;
}

/* 产品和因子选择容器样式 */
.product-select-container,
.factor-select-container {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* 产品下拉框特殊样式 */
.product-select {
    font-weight: 500;
}

/* 因子下拉框特殊样式 */
.factor-select {
    font-weight: 500;
}

/* 下拉框禁用状态 */
.bar-select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* 下拉框占位符样式 */
.bar-select option[disabled] {
    color: var(--text-color-light);
}

/* 下拉框打开时的样式 */
.bar-select:focus {
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

@media (max-width: 768px) {
    .bar-select {
        padding: 0.65rem 0.9rem;
        font-size: 0.95rem;
    }
    
    .bar-select option {
        padding: 0.65rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .bar-select {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        background-size: 0.8rem;
    }
    
    .bar-select option {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .two-column-layout-bar {
        flex-direction: column;
        gap: 30px;
    }
    .left-column-bar, .right-column-bar {
        width: 100%;
        min-width: unset;
        margin-right: 0;
    }
    .right-column-bar h2 {
        margin-top: 1.5rem;
    }
    .tool-header-bar h1 {
        font-size: 2rem;
    }
}

@media (max-width: 767px) {
    .backbar-content {
        padding: 20px 10px;
    }
    .tool-container-bar {
        padding: 1.5rem;
    }
    .form-grid-bar > div {
        min-width: 150px;
    }
    .left-column-bar, .right-column-bar {
        padding: 20px;
    }
    h2.heading-bar {
        font-size: 1.3rem;
    }
    .tool-header-bar h1 {
        font-size: 1.7rem;
    }
}

/* 特殊提示样式 */
.field-tip-bar.calculation-note {
    margin-top: 12px;
    font-style: italic;
    text-align: center;
    display: block;
    padding: 8px 15px;
    background-color: rgba(66, 133, 244, 0.08);
    border-radius: var(--border-radius-sm);
    color: var(--primary-color);
    font-size: 0.9rem;
    border-left: none;
}

/* 恢复问题反馈区域的居中对齐 */
.feedback-section .section-header,
.feedback-section .section-title,
.feedback-section .section-subtitle,
section.feedback-section h2,
section.feedback-section p,
div[class*="section-header"] h2[class*="section-title"],
div[class*="section-header"] p[class*="section-subtitle"],
section[class*="feedback"] h2,
section[class*="feedback"] p,
h2.section-title,
p.section-subtitle {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 800px !important;
}

/* 确保问题反馈按钮居中显示 */
.feedback-section button,
.feedback-section .feedback-button,
button[id*="feedback"],
button[class*="feedback"] {
    display: block !important;
    margin: 20px auto !important;
    text-align: center !important;
}

/* 确保整个问题反馈区域的内容居中 */
section[class*="feedback"] div[class*="container"],
div[class*="feedback"] {
    text-align: center !important;
}

/* 结果区域样式 */
.result-grid {
    margin-bottom: 0.8rem;
}

.result-summary {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 0.5rem;
}

.result-total,
.result-price {
    font-weight: 500;
    margin: 0;
    padding: 0.15rem;
    text-align: center;
    flex: 1;
}

.result-price {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.05rem;
}

/* 触摸反馈效果 */
.bar-input.touch-active {
    background-color: rgba(59, 130, 246, 0.05);
    border-color: var(--primary-color);
}

/* 移动端布局优化 */
@media (max-width: 768px) {
    .backbar-result {
        transition: all 0.3s ease;
        padding: 1rem;
    }
    
    /* 结果区有内容时添加突出效果 */
    .backbar-result:not(:empty) {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
    
    .result-summary {
        background-color: var(--gray-50);
        padding: 0.5rem 0.4rem;
        border-radius: 8px;
        margin-top: 0.5rem;
        flex-direction: row;
    }
    
    .grid-header-bar, 
    .grid-row-bar {
        grid-template-columns: 0.8fr 0.8fr 0.8fr;
        padding: 0.2rem 0.3rem;
        font-size: 0.85rem;
        gap: 0.15rem;
    }
    
    .grid-row-bar > div:nth-child(4) {
        font-size: 0.75rem;
    }
    
    .backbar-result h3 {
        font-size: 1.2rem;
        margin-bottom: 0.8rem;
        padding-bottom: 0.8rem;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .tool-container-bar {
        padding: 1rem 0.8rem;
        margin-bottom: 1.5rem;
    }
    
    .tool-header-bar {
        padding: 1rem 0.5rem;
    }
    

    
    .backbar-result {
        padding: 0.7rem;
    }
    
    .backbar-result h3 {
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
        padding-bottom: 0.6rem;
    }
    
    .result-summary {
        flex-direction: row;
        text-align: center;
        gap: 0.25rem;
        padding: 0.35rem;
        margin-top: 0.4rem;
    }
    
    .result-total, 
    .result-price {
        padding: 0.1rem 0;
        font-size: 0.85rem;
    }
    
    .result-price {
        font-size: 0.9rem;
    }
    
    .grid-header-bar, 
    .grid-row-bar {
        grid-template-columns: 0.8fr 0.7fr 1fr;
        padding: 0.1rem 0.15rem;
        gap: 0.05rem;
        font-size: 0.75rem;
    }
    
    .grid-row-bar {
        min-height: 1.3rem;
    }
    
    .grid-row-bar > div:nth-child(4) {
        font-size: 0.65rem;
    }
    
    .left-column-bar, 
    .right-column-bar {
        padding: 1rem 0.8rem;
    }
    
    .input-section-bar {
        padding: 1rem 0.8rem;
    }
}

.tolerance-message-bar {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
}

/* 表格容器样式 */
.result-table-container {
    border: 1px solid var(--gray-200);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

/* 根据行数调整紧凑程度 */
.result-table-container.compact-row .grid-row-bar {
    min-height: 1.5rem;
    padding-top: 0;
    padding-bottom: 0;
}

.result-table-container.single-row .grid-row-bar {
    min-height: 2rem;
}

/* 使用指南按钮样式增强 */
.guide-toggle-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 50px; /* 增加按钮尺寸 */
    height: 50px; /* 增加按钮尺寸 */
    border-radius: 50%;
    background: var(--primary-color, #4285f4);
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

.guide-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.guide-toggle-btn:active {
    transform: scale(0.95);
    background: var(--primary-dark-color, #3367d6);
}

/* 添加触摸反馈状态 */
.guide-toggle-btn.touch-active {
    transform: scale(0.95);
    background: var(--primary-dark-color, #3367d6);
}

/* 增加图标尺寸 */
.guide-toggle-btn .guide-icon {
    width: 28px;
    height: 28px;
}

/* 为移动设备增加额外的触摸友好区域 */
@media (max-width: 768px) {
    .guide-toggle-btn {
        width: 60px; /* 移动端更大的按钮 */
        height: 60px;
        right: 15px;
        bottom: 15px;
    }
    
    .guide-toggle-btn .guide-icon {
        width: 32px;
        height: 32px;
    }
}



