* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

#username-input {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    width: 150px;
}

#join-btn {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

#join-btn:hover {
    background: white;
    color: #667eea;
}

#online-users {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 6px;
}

.toolbar {
    padding: 15px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar button {
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.toolbar button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.table-container {
    padding: 20px;
    overflow-x: auto;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 600px;
}

thead {
    background: #667eea;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

th, td {
    padding: 12px;
    border: 1px solid #e0e0e0;
    text-align: left;
    min-width: 120px;
}

th {
    font-weight: 600;
    user-select: none;
}

td {
    background: white;
}

td input {
    width: 100%;
    border: none;
    padding: 8px;
    font-size: 14px;
    background: transparent;
    outline: none;
}

td input:focus {
    background: #f0f4ff;
    border-radius: 4px;
}

td.editing {
    background: #fff9c4;
}

/* 拖拽相关样式 */
.draggable-row {
    cursor: move;
    transition: background-color 0.2s;
}

.draggable-row:hover {
    background-color: #f5f5f5;
}

.draggable-row.dragging {
    opacity: 0.5;
    background-color: #e3f2fd;
}

.draggable-row.drag-over {
    border-top: 3px solid #667eea;
    background-color: #f0f4ff;
}

.drag-handle {
    color: #999;
    font-size: 18px;
    vertical-align: middle;
    display: inline-block;
    line-height: 1;
    cursor: grab;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle:hover {
    color: #667eea;
}

/* 第一列布局优化 */
td:first-child {
    white-space: nowrap;
}

td:first-child input {
    vertical-align: middle;
}

/* 图片单元格样式 */
.image-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    padding: 8px;
}

.uploaded-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.upload-image-btn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.upload-image-btn:hover {
    background: #5568d3;
}

.delete-image-btn {
    padding: 4px 10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.delete-image-btn:hover {
    background: #d32f2f;
}

.status-bar {
    padding: 10px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

#status {
    font-weight: 500;
}

#status.connected {
    color: #4caf50;
}

#status.disconnected {
    color: #f44336;
}

/* 滚动条样式 */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 图片预览模态框样式 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 1001;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.uploaded-image {
    transition: transform 0.2s;
}

.uploaded-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

