/* ============================================
   马菲板负载计算系统 - 全局样式
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.5;
    overflow: hidden;
}

/* ============================================
   布局容器
   ============================================ */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
/* ============================================
   顶部面板
   ============================================ */
.top-panel {
    background: white;
    padding: 16px 24px;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.top-panel h2 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #1a1a2e;
}

.top-panel .row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.top-panel label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.top-panel select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 200px;
}

.top-panel select:hover {
    border-color: #007bff;
}

.top-panel button {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.top-panel button:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* ============================================
   中间分栏
   ============================================ */

.center-panel {
    display: flex;
    gap: 20px;
    flex: 1;
    /*padding: 20px 24px;*/
    min-height: 0;
    overflow: hidden;
}

/* 左侧面板 - 货物管理 */
.left-panel {
    flex: 0 0 300px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.left-panel h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a1a2e;
    padding-bottom: 8px;
    border-bottom: 2px solid #007bff;
    display: inline-block;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.button-group button {
    flex: 1;
    min-width: 80px;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.button-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.button-group button:active {
    transform: translateY(0);
}

.btn-add {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.btn-edit {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

.btn-edit:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.btn-remove {
    background: linear-gradient(135deg, #dc3545, #b02a37);
    color: white;
}

.btn-clear {
    background: linear-gradient(135deg, #6c757d, #545b62);
    color: white;
}

.btn-overlength {
    background: linear-gradient(135deg, #fd7e14, #e36209);
    color: white;
}

.btn-overlength-active {
    background: linear-gradient(135deg, #28a745, #1e7e34) !important;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.5);
}

/* 右侧面板 - 图表区 */
.right-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right-panel h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a1a2e;
    flex-shrink: 0;
}

/* ============================================
   图表容器
   ============================================ */

.chart-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 15px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.chart-controls span {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.chart-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.chart-controls label:hover {
    color: #007bff;
}

.chart-controls input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.chart-controls button {
    padding: 5px 14px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.chart-controls button:hover {
    background: #0056b3;
}

/* 图表容器包装 - 支持水平滚动 */
.chart-container-wrapper {
    display: flex;
    width: 100%;
    flex: 1;
    min-height: 0;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    background: #fafbfc;
    position: relative;
}

/* 图例区域 - 修改：增加宽度，支持换行 */
.legend-area {
    width: 200px;                /* 从 140px 增加到 200px */
    background: #f8f9fc;
    border-right: 1px solid #e8e8e8;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.legend-title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin-bottom: 16px;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
    gap: 8px;
}

.legend-color {
    width: 16px;                 /* 从 20px 减小到 16px */
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-label {
    font-size: 11px;             /* 从 12px 减小到 11px */
    color: #444;
    line-height: 1.4;
    word-break: break-word;      /* 允许换行 */
    flex: 1;                     /* 允许文字占满剩余空间 */
}

/* 图表区域 */
.chart-area {
    flex: 1;
    position: relative;
    min-width: 1200px;
    overflow-x: auto;
}

/* 自定义滚动条样式 */
.chart-container-wrapper::-webkit-scrollbar {
    height: 10px;
}

.chart-container-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.chart-container-wrapper::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 5px;
}

.chart-container-wrapper::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* ============================================
   状态栏
   ============================================ */

.status-bar {
    background: #e9ecef;
    padding: 8px 20px;
    border-top: 1px solid #dee2e6;
    font-size: 13px;
    color: #495057;
    flex-shrink: 0;
}

/* ============================================
   弹窗样式
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 90%;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #1a1a2e;
}

.modal-content label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #555;
}

.modal-content input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
    transition: border-color 0.2s;
}

.modal-content input:focus {
    outline: none;
    border-color: #007bff;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.modal-buttons button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.modal-buttons button:first-child {
    background: #6c757d;
    color: white;
}

.modal-buttons button:last-child {
    background: #007bff;
    color: white;
}

.modal-buttons button:hover {
    transform: translateY(-1px);
}

/* ============================================
   工具类
   ============================================ */

.text-center {
    text-align: center;
}

.text-danger {
    color: #dc3545;
}

.text-warning {
    color: #fd7e14;
}

.text-success {
    color: #28a745;
}

.mt-2 {
    margin-top: 8px;
}

.mb-2 {
    margin-bottom: 8px;
}

/* ============================================
   响应式调整
   ============================================ */

@media (max-width: 1200px) {
    .center-panel {
        flex-direction: column;
    }

    .left-panel {
        flex: 0 0 auto;
    }

    .button-group button {
        min-width: 70px;
        font-size: 12px;
    }
    
    .legend-area {
        width: 160px;  /* 响应式时适当减小 */
    }
}

@media (max-width: 768px) {
    .top-panel {
        padding: 12px 16px;
    }

    .center-panel {
        padding: 12px 16px;
        gap: 12px;
    }

    .left-panel, .right-panel {
        padding: 15px;
    }

    .chart-controls {
        gap: 10px;
    }

    .chart-controls label {
        font-size: 11px;
    }
    
    .legend-area {
        width: 140px;
    }
    
    .legend-label {
        font-size: 10px;
    }
}