/* 补货规则页面样式 - 参考移补记录页面优化 */

/* 补货规则页面容器 */
.goods-rules-page {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 24px;
}

/* 页面标题区域 */
.rules-header {
    margin-bottom: 24px;
}

.rules-title {
    font-size: 20px;
    font-weight: 600;
    color: #1d2129;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rules-title::before {
    content: "⚙️";
    font-size: 24px;
}

/* 主要内容区域 */
.rules-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* 搜索区域 - 参考耗材档案页面样式 */
.rules-search-area {
    background: #ffffff;
    border: 1px solid #e5e6eb;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.rules-search-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rules-search-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.rules-search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.rules-search-label {
    font-size: 13px;
    font-weight: 500;
    color: #1d2129;
    white-space: nowrap;
    min-width: 80px;
}

/* 组合搜索框 - 参考耗材档案页面样式 */
.rules-combined-search {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 200px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e5e6eb;
}

.rules-combined-search .rules-search-type {
    width: 100px;
    height: 36px;
    border: none;
    border-right: 1px solid #e5e6eb;
    border-radius: 0;
    padding: 0 12px;
    cursor: pointer;
    margin: 0;
    background-color: #ffffff;
    font-size: 13px;
    outline: none;
}

.rules-combined-search .rules-combined-input {
    flex: 1;
    border: none;
    border-radius: 0;
    height: 36px;
    background: #ffffff;
    padding: 0 12px;
    margin: 0;
    font-size: 13px;
    outline: none;
}

.rules-combined-search .rules-combined-input:focus,
.rules-combined-search .rules-search-type:focus {
    outline: none;
}

/* 普通选择框 - 参考耗材档案页面样式 */
.rules-search-select {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    outline: none;
    vertical-align: middle;
    box-sizing: border-box;
}

.rules-search-select:focus {
    outline: none;
    border-color: #0052d9;
    box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
}

.rules-search-select:hover {
    border-color: #c9cdd4;
}

/* 列表区域 - 参考移补记录页面样式 */
.rules-list-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.rules-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.rules-list-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.rules-list-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 按钮样式 - 参考耗材档案页面 */
.rules-btn {
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #f5f5f5;
    color: #4e5969;
    border: 1px solid #d9d9d9;
}

.rules-btn:hover {
    background-color: #e6e6e6;
}

.rules-btn-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.rules-btn-primary {
    background-color: #0052d9;
    color: white;
    border-color: #0052d9;
}

.rules-btn-primary:hover {
    background-color: #003bb3;
    border-color: #003bb3;
}

.rules-btn-secondary {
    background-color: #f5f5f5;
    color: #4e5969;
    border-color: #d9d9d9;
}

.rules-btn-secondary:hover {
    background-color: #e6e6e6;
}

/* 刷新按钮 - 兼容旧样式 */
.rules-refresh-btn {
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #d9d9d9;
    background-color: #f5f5f5;
    color: #4e5969;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rules-refresh-btn:hover {
    background-color: #e6e6e6;
}

.rules-refresh-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: currentColor;
}

/* 新增按钮 - 兼容旧样式 */
.rules-add-btn {
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #0052d9;
    background-color: #0052d9;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rules-add-btn:hover {
    background-color: #003bb3;
    border-color: #003bb3;
}

.rules-add-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: currentColor;
}

/* 表格容器 */
.rules-table-container {
    flex: 1;
    overflow-y: auto;
}

/* 表格样式 - 参考移补记录页面样式 */
.rules-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rules-data-table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

/* 设置各列的宽度限制 */
/* 规则编号 */
.rules-data-table th:nth-child(1),
.rules-data-table td:nth-child(1) {
    width: 130px;
    min-width: 130px;
    max-width: 160px;
}

/* 规则名称 */
.rules-data-table th:nth-child(2),
.rules-data-table td:nth-child(2) {
    width: 200px;
    min-width: 180px;
    max-width: 220px;
}

/* 规则状态 */
.rules-data-table th:nth-child(3),
.rules-data-table td:nth-child(3) {
    width: 80px;
    min-width: 80px;
    max-width: 100px;
    text-align: center;
}

/* 策略类型 */
.rules-data-table th:nth-child(4),
.rules-data-table td:nth-child(4) {
    width: 90px;
    min-width: 90px;
    max-width: 110px;
    text-align: center;
}

/* 触发规则 */
.rules-data-table th:nth-child(5),
.rules-data-table td:nth-child(5) {
    width: 180px;
    min-width: 160px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}



/* 补货数量 */
.rules-data-table th:nth-child(6),
.rules-data-table td:nth-child(6) {
    width: 120px;
    min-width: 100px;
    max-width: 140px;
}

/* 安全库存 */
.rules-data-table th:nth-child(7),
.rules-data-table td:nth-child(7) {
    width: 90px;
    min-width: 80px;
    max-width: 100px;
    text-align: center;
}

/* 最大库存 */
.rules-data-table th:nth-child(8),
.rules-data-table td:nth-child(8) {
    width: 90px;
    min-width: 80px;
    max-width: 100px;
    text-align: center;
}

/* 规则描述 */
.rules-data-table th:nth-child(9),
.rules-data-table td:nth-child(9) {
    width: 200px;
    min-width: 180px;
    max-width: 220px;
}
/* 规则描述单元格文本不换行，超出部分显示省略号 */
.rules-data-table td:nth-child(9) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}
/* 更新时间 */
.rules-data-table th:nth-child(10),
.rules-data-table td:nth-child(10) {
    width: 150px;
    min-width: 140px;
    max-width: 160px;
}

/* 操作列宽度控制 */
.rules-data-table th:nth-child(11),
.rules-data-table td:nth-child(11) {
    width: 200px;
    min-width: 200px;
    max-width: 240px;
    padding: 12px 8px;
    text-align: center;
}

/* 操作列表头保持居中对齐 */
.rules-data-table th:nth-child(11) {
    text-align: center;
}

/* 操作单元格靠右对齐 */
.rules-data-table td:nth-child(11) {

    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

/* 确保操作按钮在操作列中合理分布 */
.rules-data-table td:nth-child(11) .rules-action-btn {
    flex: 0 0 auto;
}

.rules-data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
}

.rules-data-table tr:hover {
    background-color: #f8fafc;
}

.rules-data-table tr:last-child td {
    border-bottom: none;
}

/* 展开按钮 - 参考移补记录页面样式 */
.rules-expandable {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rules-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.rules-expand-btn:hover:not(.disabled) {
    background-color: #f0f0f0;
}

.rules-expand-btn.expanded {
    background-color: #e6f7ff;
}

.rules-expand-btn.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.rules-expand-icon {
    width: 16px;
    height: 16px;
    fill: #666;
    transition: transform 0.3s ease;
}

.rules-expand-btn:hover .rules-expand-icon {
    fill: #1890ff;
}

.rules-expand-btn.expanded .rules-expand-icon {
    fill: #1890ff;
    transform: rotate(90deg);
}

/* 规则状态标签 */
.rules-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.rules-status.active {
    background: #e8f8f2;
    color: #00a870;
}

.rules-status.inactive {
    background: #f3f3f3;
    color: #86909c;
}



/* 策略类型标签 */
.rules-strategy {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.rules-strategy.safety-stock {
    background: #e8f3ff;
    color: #0052d9;
}

.rules-strategy.dynamic-forecast {
    background: #fff3e8;
    color: #ed7b2f;
}

.rules-strategy.wave-strategy {
    background: #f3e8ff;
    color: #7356bf;
}

/* 展开行 - 参考移补记录页面样式 */
.rules-expand-row {
    background-color: #fafafa;
    border-left: 3px solid #1890ff;
}

.rules-expand-row.expanding {
    animation: expandAnimation 0.3s ease-out;
}

.rules-expand-row.collapsing {
    animation: collapseAnimation 0.3s ease-out;
}

@keyframes expandAnimation {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

@keyframes collapseAnimation {
    from {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
}

/* 展开详情内容 */
.rules-detail-container {
    padding: 16px;
    background: white;
    margin: 8px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rules-detail-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.rules-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rules-detail-table th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
}

.rules-detail-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
}

.rules-detail-table tr:last-child td {
    border-bottom: none;
}

/* 全部货品显示样式 */
.rules-detail-all-products {
    display: flex;
    align-items: center;
    padding: 24px;
    background: rgba(0, 82, 217, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(0, 82, 217, 0.1);
    text-align: center;
    justify-content: center;
}

.rules-all-products-icon {
    font-size: 48px;
    margin-right: 20px;
    opacity: 0.8;
}

.rules-all-products-content {
    text-align: left;
}

.rules-all-products-title {
    font-size: 18px;
    font-weight: 600;
    color: #0052d9;
    margin-bottom: 8px;
}

.rules-all-products-desc {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.5;
}

/* 操作按钮 - 参考移补记录页面样式 */
.rules-action-btn {
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 26px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.rules-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rules-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 编辑按钮 - 主色系 */
.rules-action-btn.edit {
    background: #e8f3ff;
    color: #0052d9;
    border-color: #91caff;
}

.rules-action-btn.edit:hover {
    background: #91caff;
    border-color: #69b1ff;
    color: #003a8c;
}

/* 切换状态按钮 - 警告色系 */
.rules-action-btn.toggle {
    background: #fff7e6;
    color: #d46b08;
    border-color: #ffd591;
}

.rules-action-btn.toggle:hover {
    background: #ffe58f;
    border-color: #ffa940;
    color: #ad4e00;
}

/* 删除按钮 - 危险色系 */
.rules-action-btn.delete {
    background: #fff2f0;
    color: #cf1322;
    border-color: #ffccc7;
}

.rules-action-btn.delete:hover {
    background: #ffccc7;
    border-color: #ffa39e;
    color: #820014;
}

/* 分页 - 参考耗材档案页面样式 */
.rules-pagination {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
}

.rules-pagination-info {
    font-size: 14px;
    color: #4b5563;
}

.rules-pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.rules-pagination-btn,
.rules-btn-pagination {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rules-pagination-btn:hover:not(:disabled),
.rules-btn-pagination:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.rules-pagination-btn:disabled,
.rules-btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rules-page-size {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #4b5563;
}

.rules-page-size-select {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    font-size: 13px;
    cursor: pointer;
}

/* 空状态 */
.rules-empty-state {
    padding: 60px 20px;
    text-align: center;
    color: #86909c;
}

/* 开发中提示卡片 */
.rules-prototype-card {
    background: #f0f5ff;
    border: 1px dashed #0052d9;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    margin-top: 40px;
}

.rules-prototype-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.rules-prototype-title {
    font-size: 24px;
    font-weight: 600;
    color: #0052d9;
    margin-bottom: 12px;
}

.rules-prototype-desc {
    font-size: 16px;
    color: #4e5969;
    margin-bottom: 24px;
    max-width: 600px;
    line-height: 1.6;
}

.rules-prototype-features {
    background: #ffffff;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    text-align: left;
    max-width: 700px;
}

.rules-prototype-features h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1d2129;
    margin-bottom: 12px;
    text-align: center;
}

.rules-prototype-features ul {
    list-style-type: none;
    padding: 0;
}

.rules-prototype-features li {
    padding: 6px 0;
    color: #4e5969;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rules-prototype-features li::before {
    content: "✓";
    color: #00a870;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    /* 中等屏幕下，减少一些列的宽度 */
    .rules-data-table th:nth-child(2),
    .rules-data-table td:nth-child(2) {
        width: 180px;
        min-width: 160px;
    }
    
    .rules-data-table th:nth-child(5),
    .rules-data-table td:nth-child(5) {
        width: 160px;
        min-width: 140px;
    }
}

@media (max-width: 768px) {
    .rules-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .rules-search-area {
        padding: 16px;
    }
    
    .rules-search-form {
        gap: 16px;
    }
    
    .rules-search-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .rules-search-field {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .rules-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    /* 在小屏幕上调整按钮的样式 */
    .rules-btn,
    .rules-add-btn,
    .rules-refresh-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .rules-pagination {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .rules-data-table {
        font-size: 12px;
    }
    
    .rules-data-table th,
    .rules-data-table td {
        padding: 8px 8px;
    }
    
    /* 在小屏幕上进一步缩小操作按钮 */
    .rules-action-btn {
        padding: 4px 8px;
        min-width: 50px;
        height: 24px;
        font-size: 11px;
    }
    
    /* 在小屏幕上调整操作列宽度 */
    .rules-data-table th:nth-child(11),
    .rules-data-table td:nth-child(11) {
        width: 200px;
        min-width: 180px;
        padding: 8px 4px;
    }
    
    .rules-prototype-card {
        padding: 24px 16px;
        margin-top: 20px;
    }
    
    .rules-prototype-icon {
        font-size: 48px;
    }
    
    .rules-prototype-title {
        font-size: 20px;
    }
    
    .rules-prototype-features {
        max-width: 100%;
    }
}
