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

body {
    font-family: 'Microsoft YaHei', 'SimHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    overflow-x: auto; /* 允许横向滚动 */
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: visible; /* 改为visible，允许内容溢出 */
    min-width: 750px; /* 设置最小宽度，确保左右布局 */
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 28px;
    font-weight: bold;
}

.header-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.percentage {
    color: #ffd700;
    font-weight: bold;
}

.main-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    min-height: calc(100vh - 120px);
    overflow-x: auto; /* 允许横向滚动 */
}

.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 400px; /* 减小最小宽度，允许更小的窗口 */
    flex-shrink: 0; /* 防止面板被压缩 */
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 350px; /* 减小最小宽度，允许更小的窗口 */
    flex-shrink: 0; /* 防止面板被压缩 */
}

.control-bar {
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
}

.warning-settings {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.warning-settings label {
    font-weight: bold;
    color: #333;
    font-size: 12px;
}

.warning-input {
    width: 70px;
    padding: 3px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.warning-settings .btn {
    padding: 4px 10px;
    font-size: 12px;
}

.sort-option {
    margin-top: 10px;
}

.sort-option label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 14px;
}

.table-container {
    flex: 1;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    max-height: 750px; /* 限制显示约20行，超过时显示滚动条 */
}

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

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 8px 5px;
    text-align: left;
    font-weight: bold;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

th:last-child {
    border-right: none;
}

tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr.selected {
    background-color: #e3f2fd;
}

tbody tr.warning {
    background-color: #fff3cd;
}

tbody tr.warning-red {
    background-color: #ffebee;
}

tbody tr.warning-red td {
    color: #d32f2f;
    font-weight: bold;
}

td {
    padding: 5px 3px;
    border-right: 1px solid #eee;
}

td:last-child {
    border-right: none;
}

td.editable {
    cursor: pointer;
    position: relative;
}

td.editable:hover {
    background-color: #e3f2fd;
}

.action-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
}

.info-text {
    font-weight: bold;
    color: #333;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.input-section, .search-section, .log-section {
    margin-bottom: 15px;
}

.input-section label, .search-section label, .log-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

#inputText {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Microsoft YaHei', 'SimHei', monospace;
    resize: vertical;
    transition: border-color 0.3s;
}

#inputText:focus {
    outline: none;
    border-color: #667eea;
}

.input-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.search-box {
    display: flex;
    gap: 10px;
}

#searchInput {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: #667eea;
}

.operation-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.log-area {
    height: 200px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f8f9fa;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.log-entry {
    margin-bottom: 5px;
    padding: 5px;
    border-left: 3px solid #667eea;
    padding-left: 10px;
    background: white;
    border-radius: 3px;
}

.bottom-buttons {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
}

/* 響應式設計 - 保持左右排版，使用橫向滾動 */
@media (max-width: 1200px) {
    .left-panel {
        min-width: 350px; /* 进一步减小最小宽度 */
    }
    
    .right-panel {
        min-width: 300px; /* 进一步减小最小宽度 */
    }
    
    .main-content {
        gap: 15px; /* 减小间距 */
        padding: 15px;
    }
}

/* 极小窗口时的优化 */
@media (max-width: 800px) {
    .left-panel {
        min-width: 300px;
    }
    
    .right-panel {
        min-width: 250px;
    }
    
    .main-content {
        gap: 10px;
        padding: 10px;
    }
}

/* 滾動條樣式 */
.table-container::-webkit-scrollbar,
.log-area::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track,
.log-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb,
.log-area::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover,
.log-area::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 選中狀態 */
td input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

