/**
 * php.css - PHP 版新增界面样式
 * 购方管理 / 使用说明 / 修改密码 / 编码匹配选项
 */

/* ===== 购方管理模态框 ===== */
.bm-grid {
    display: flex;
    align-items: stretch;
    gap: 16px;
    min-height: 380px;
    flex: 1 1 auto;
}
.bm-left {
    flex: 0 0 340px;
    border-right: 1px solid #eee;
    padding-right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.bm-right {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 右侧分组：小节标题 */
.bm-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
}

/* 右侧分组：双列表单 */
.bm-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
/* 标签与输入框单行放置：标签紧贴输入框（间距 6px） */
.bm-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.bm-field label {
    flex: 0 0 auto;
    font-size: 13px;
    color: #888;
    text-align: left;
    white-space: nowrap;
}
.bm-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    min-width: 0;
}
.bm-row .bm-field select {
    margin-right: 20px;
}
.bm-field input,
.bm-field select {
    flex: 1 1 auto;
    width: auto;
    box-sizing: border-box;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    min-width: 0;
}
.bm-field input:focus,
.bm-field select:focus {
    outline: none;
    border-color: var(--primary-color, #4a90e2);
}
/* 右侧复选框行水平排列 */
.bm-checkbox-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 2px 0;
}
/* 分组之间间距与组内行距统一（10px） */
.bm-section + .bm-section {
    margin-top: 10px;
}
.bm-checkbox-row .checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    white-space: nowrap;
}
.bm-checkbox-row .checkbox-label input {
    width: 15px;
    height: 15px;
    margin: 0;
}



/* 购方条目选中态 */
.buyer-entry.selected {
    background: #e8f0fe;
    border-left: 3px solid var(--primary-color, #4a90e2);
}

/* ===== 使用说明 ===== */
.help-body h4 {
    margin: 12px 0 6px;
    color: var(--primary-color, #4a90e2);
}
.help-body p {
    margin: 4px 0;
    line-height: 1.7;
    font-size: 15px;
}
.help-image-wrap {
    text-align: center;
    margin-top: 16px;
}
.help-image {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* ===== 编码匹配选项 ===== */
.setting-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 15px;
    cursor: pointer;
}
.setting-check input {
    width: auto;
    flex: 0 0 auto;
}

/* 设置区按钮与提示 */
#btnChangePwd {
    margin-top: 6px;
}
#pwdMessage {
    margin-top: 6px;
}

/* ===== 保存状态指示 ===== */
.save-status {
    margin-left: 10px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    white-space: nowrap;
}
.save-status.saving { background: rgba(255, 255, 255, 0.35); color: #ffeaa7; }
.save-status.error  { background: rgba(231, 76, 60, 0.9); }
.save-status.saved  { color: #d5f5e3; }

/* ===== 商品行自动匹配按钮 ===== */
.code-cell .code-btn { margin-top: 2px; }




/* 购方列表置顶"新增"项 */
.bm-add-entry {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid #3a80d2;
    border-radius: 4px;
    background: #4a90e2;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.bm-add-entry:hover { background: #3a80d2; }

/* 购方管理弹窗：顶部标题栏、底部按钮区固定，仅中间左右两栏独立滚动 */
#buyerManageModal .modal-header {
    flex: 0 0 auto;
}
#buyerManageModal .modal-footer {
    flex: 0 0 auto;
    justify-content: center;
    gap: 30px;
}
#btnBmApply,
#btnBmSave {
    flex: 0 0 auto;
    min-width: 88px;
    margin-left: 0;
}

/* 购方管理弹窗：加宽，左右独立滚动 */
#buyerManageModal .modal-content {
    width: 880px;
    max-height: calc(100vh - 40px);
}
#buyerManageModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
/* 左右两栏各自独立垂直滚动：高度随中间区域自适应 */
.bm-left {
    min-height: 0;
}
.bm-right {
    overflow: hidden;
    min-height: 0;
}
/* 中间区独立滚动：购方信息（顶）与保存（底）固定始终可见 */
.bm-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

/* 购方列表占满左栏剩余高度并独立滚动 */
#buyerManageModal .buyer-list {
    flex: 1;
    min-height: 160px;
    max-height: none;
    margin-top: 0;
}

/* 购方管理弹窗：左栏搜索框 */
#buyerManageModal #buyerManageSearch {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}
#buyerManageModal #buyerManageSearch:focus {
    outline: none;
    border-color: var(--primary-color, #4a90e2);
}

/* 移动端适配：购方信息管理两栏堆叠（置于文件末尾，确保覆盖基础规则） */
@media (max-width: 900px) {
    #buyerManageModal .modal-content {
        width: 94vw;
        max-width: 94vw;
    }
    #buyerManageModal .modal-body {
        overflow-y: auto;
    }
    .bm-grid {
        flex-direction: column;
        min-height: 0;
        flex: none;
    }
    .bm-left {
        flex: none;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-right: 0;
        padding-bottom: 12px;
        max-height: none;
        min-height: 0;
        overflow: visible;
    }
    #buyerManageModal .buyer-list {
        max-height: 220px;
        min-height: 0;
    }
    .bm-fields {
        grid-template-columns: 1fr;
    }
    .bm-row {
        grid-template-columns: 1fr;
    }
    .bm-right {
        max-height: none;
        min-height: 0;
        overflow: visible;
    }
    .bm-scroll {
        max-height: none;
        min-height: 0;
        overflow: visible;
    }
}
/* 右侧购方信息表单：固定宽度（横向布局不随窗口缩放）；小窗口纵向模式恢复可伸缩 */
.bm-right { flex: 0 0 440px; }
@media (max-width: 900px) {
    .bm-right { flex: 1 1 auto; width: 100%; }
}
