* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 15px;
    color: #2c3e50;
}

.system-info {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.system-info h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #2980b9;
}

.system-info ul {
    list-style-type: none;
}

.system-info li {
    margin-bottom: 5px;
}

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.layout-controls, .array-controls, .view-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
}

.control-group label {
    font-weight: bold;
    color: #2c3e50;
}

select, input[type="number"] {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 80px;
}

button {
    padding: 8px 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

#apply-layout {
    background-color: #27ae60;
}

#apply-layout:hover {
    background-color: #219951;
}

.view-options {
    margin-left: auto;
    display: flex;
    gap: 15px;
}

.pv-array-container {
    position: relative;
    overflow: auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    height: 600px;
    padding: 10px;
}

.dimensions-info {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pv-array {
    position: relative;
    transform-origin: 0 0;
    min-width: 100%;
    min-height: 100%;
    cursor: grab;
    margin-bottom: 10px;
}

/* 跟踪器行样式 */
.tracker-row {
    position: absolute;
    cursor: pointer;
    background-color: rgba(231, 76, 60, 0.7);
    border: 1px solid rgba(192, 57, 43, 0.8);
    transition: transform 0.1s;
    z-index: 5;
}

.tracker-row:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* 串样式 */
.string {
    position: absolute;
    cursor: pointer;
    background-color: rgba(241, 196, 15, 0.7);
    border: 1px solid rgba(243, 156, 18, 0.8);
    transition: transform 0.1s;
    z-index: 6;
}

.string:hover {
    transform: scale(1.05);
    z-index: 20;
}

/* 汇流箱样式 */
.combiner-box {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    background-color: #FF5500;
    border: 3px solid #CC4400;
    transform: translate(-50%, -50%);
    z-index: 100;
    box-shadow: 0 0 15px rgba(255, 85, 0, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
}

.combiner-box.optimized {
    background-color: #FF5500;
    border: 3px solid #CC4400;
}

.combiner-box:hover {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 20px rgba(255, 85, 0, 1);
}

/* 布局颜色样式 */
.layout1 .tracker-row {
    background-color: rgba(231, 76, 60, 0.7);
    border-color: rgba(192, 57, 43, 0.8);
}

.layout1 .string {
    background-color: rgba(241, 196, 15, 0.7);
    border-color: rgba(243, 156, 18, 0.8);
}

.layout1 .combiner-box {
    background-color: #8e44ad;
}

.layout2 .tracker-row {
    background-color: rgba(46, 204, 113, 0.7);
    border-color: rgba(39, 174, 96, 0.8);
}

.layout2 .string {
    background-color: rgba(241, 196, 15, 0.7);
    border-color: rgba(243, 156, 18, 0.8);
}

.layout2 .combiner-box {
    background-color: #2980b9;
}

.layout3 .tracker-row {
    background-color: rgba(52, 152, 219, 0.7);
    border-color: rgba(41, 128, 185, 0.8);
}

.layout3 .string {
    background-color: rgba(231, 76, 60, 0.7);
    border-color: rgba(192, 57, 43, 0.8);
}

.layout3 .combiner-box {
    background-color: #8e44ad;
}

/* 显示选项样式 */
.display-options {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.display-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.details-panel {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.details-panel h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #2980b9;
}

#selection-details {
    min-height: 100px;
}

footer {
    margin-top: 20px;
    text-align: center;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (min-width: 768px) {
    main {
        grid-template-columns: 300px 1fr;
    }
    
    .controls {
        grid-column: 1 / -1;
    }
    
    .details-panel {
        grid-row: 2;
        grid-column: 1;
    }
    
    .pv-array-container {
        grid-row: 2;
        grid-column: 2;
    }
}

/* 汇流箱配置样式 */
.combiner-box-controls {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.combiner-box-groups {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.combiner-group {
    padding: 12px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.group-header h4 {
    margin: 0;
    color: #2c3e50;
}

.remove-group {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 0.8rem;
}

.remove-group:hover {
    background-color: #c0392b;
}

.group-summary {
    margin-top: 10px;
    font-weight: bold;
    color: #2c3e50;
    text-align: right;
}

.combiner-summary {
    background-color: white;
    border-radius: 5px;
    padding: 10px 15px;
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.summary-item {
    font-weight: bold;
}

.status {
    grid-column: 1 / -1;
    padding-top: 5px;
    border-top: 1px solid #eee;
}

#strings-match-status {
    font-weight: bold;
}

.status-matched {
    color: #27ae60;
}

.status-unmatched {
    color: #e74c3c;
}

#add-combiner-group {
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: bold;
}

#add-combiner-group:hover {
    background-color: #27ae60;
}

.slider-value {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    margin-left: 10px;
    font-weight: bold;
}

/* 列虚线样式 */
.column-line {
    position: absolute;
    width: 2px;
    background-color: #f44336;
    background-image: linear-gradient(to bottom, #f44336 50%, transparent 50%);
    background-size: 2px 10px;
    z-index: 4;
    pointer-events: none;
    left: 0;
    top: 0;
}

/* 匹配状态样式 */
.match-status {
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 500;
}

.match-status.matched {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.match-status.unmatched {
    background-color: #ffebee;
    color: #c62828;
}

/* 分组运算按钮样式 */
#group-calculation-btn {
    background-color: #8e44ad;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#group-calculation-btn:hover {
    background-color: #9b59b6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#group-calculation-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#group-calculation-btn.active {
    background-color: #27ae60;
}

#group-calculation-btn.active:hover {
    background-color: #2ecc71;
}

/* 汇流箱配置横排布局样式 */
.horizontal-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
}

.control-group.inline {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    flex-wrap: nowrap;
}

.control-group.inline label {
    margin-right: 8px;
    white-space: nowrap;
}

.group-summary.inline {
    margin-left: auto;
    font-weight: bold;
    white-space: nowrap;
}

/* 响应式布局调整 */
@media (max-width: 768px) {
    .horizontal-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .control-group.inline {
        margin-bottom: 10px;
        width: 100%;
    }
    
    .group-summary.inline {
        margin-left: 0;
    }
}

.horizontal-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.summary-item {
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
    font-weight: 500;
}

.status {
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 500;
    background-color: #e1f5fe;
}

/* 汇流箱优化器样式 */
.combiner-optimizer-settings {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.combiner-optimizer-settings h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.optimizer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.combiner-optimizer-settings .form-group {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    flex-basis: calc(33.33% - 10px);
    min-width: 180px;
}

.combiner-optimizer-settings label {
    min-width: 80px;
    margin-right: 8px;
    font-size: 0.9em;
    white-space: nowrap;
}

.combiner-optimizer-settings input[type="number"],
.combiner-optimizer-settings select {
    padding: 5px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 80px;
    flex-grow: 1;
}

.combiner-optimizer-settings button {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    margin-top: 5px;
    font-weight: 500;
    width: 100%;
}

.combiner-optimizer-settings button:hover {
    background-color: #2980b9;
}

/* 优化后的汇流箱样式 */
.combiner-box.optimized {
    border: 2px dashed;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
    z-index: 20;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .optimizer-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .combiner-optimizer-settings .form-group {
        flex-basis: 100%;
    }
}

/* 优化结果显示区域 */
.optimization-results {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    max-width: 1200px;
    margin: 20px auto;
    clear: both;
    display: block;
}

.optimization-results h3 {
    color: #2c3e50;
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.results-container {
    max-height: 400px;
    overflow-y: auto;
}

.results-content {
    font-family: monospace;
    white-space: pre-wrap;
}

.result-item {
    padding: 8px;
    margin-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item .box-id {
    font-weight: bold;
    color: #FF5500;
}

.result-item .distance {
    color: #2980b9;
    font-weight: bold;
}

.result-item .strings-count {
    color: #27ae60;
}

.timestamp {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
    color: #777;
    font-size: 0.9em;
    text-align: right;
}

/* 优化结果摘要 */
.summary-section {
    background-color: #f5f5f5;
    border-radius: 5px;
    padding: 10px 15px;
    margin-bottom: 20px;
}

.summary-section h4 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 10px;
}

.summary-section ul {
    margin: 0;
    padding-left: 20px;
}

.summary-section li {
    margin-bottom: 5px;
}

.details-section {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.details-section h4 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 15px;
}

/* 结果表格样式 */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}

.results-table th, 
.results-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.results-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    color: #333;
}

.results-table tr:hover {
    background-color: #f9f9f9;
}

.results-table .box-id {
    font-weight: bold;
    color: #FF5500;
}

.results-table .distance {
    font-weight: bold;
    color: #2980b9;
} 