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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #B0E0E6 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: #4a5568;
    font-size: 2.5em;
    font-weight: bold;
}

.controls {
    display: flex;
    gap: 10px;
}

.controls button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.controls button:hover {
    background: #5a67d8;
}

.main-content {
    display: flex;
    gap: 20px;
    min-height: 600px;
}

.qr-section {
    flex: 0 0 350px;
}

.qr-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 20px;
}

#qrCode {
    margin-bottom: 20px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
}

#qrCode img {
    max-width: 100%;
    height: auto;
}

.loading {
    color: #718096;
    font-size: 16px;
}

.qr-instruction {
    font-size: 18px;
    color: #4a5568;
    margin-bottom: 15px;
    font-weight: 500;
}

.qr-url {
    font-size: 12px;
    color: #718096;
    word-break: break-all;
    background: #f7fafc;
    padding: 10px;
    border-radius: 5px;
}

.content-area {
    flex: 1;
    display: flex;
    gap: 20px;
}

.sidebar {
    flex: 0 0 300px;
}

.device-panel {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* 发送文件面板样式 */
.send-file-panel {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.send-file-panel h3 {
    color: #4a5568;
    font-size: 16px;
    margin-bottom: 15px;
}

.send-file-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.device-select {
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.device-select:hover {
    border-color: #667eea;
}

.device-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.file-input {
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
}

.file-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    padding: 10px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s;
}

.send-btn:hover {
    background: #38a169;
}

.send-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.send-status {
    padding: 10px;
    border-radius: 5px;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
}

.send-status.success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.send-status.error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.send-status.loading {
    background: #bee3f8;
    color: #2c5282;
    border: 1px solid #90cdf4;
}

/* 消息面板样式 */
.message-panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 400px;
}

.message-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7fafc;
    border-radius: 10px 10px 0 0;
}

.message-header h3 {
    color: #4a5568;
    font-size: 16px;
    margin: 0;
}

.clear-messages-btn {
    background: #f56565;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.clear-messages-btn:hover {
    background: #e53e3e;
}

.message-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    min-height: 0;
}

.message-item {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
}

.message-item:hover .copy-btn {
    opacity: 1;
}

.copy-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 11px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.copy-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.message-item.sent .copy-btn {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.message-item.sent .copy-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.message-item.sent {
    background: #667eea;
    color: white;
    margin-left: auto;
    text-align: right;
}

.message-item.received {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.message-sender {
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 4px;
    opacity: 0.8;
}

.message-content {
    font-size: 13px;
    line-height: 1.4;
}

.message-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
}

.message-input-container {
    padding: 15px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    background: #f7fafc;
    border-radius: 0 0 10px 10px;
}

.message-input-container input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 14px;
}

.message-input-container input:focus {
    outline: none;
    border-color: #667eea;
}

.message-input-container button {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.message-input-container button:hover {
    background: #5a67d8;
}

.message-input-container button:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.no-messages {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 20px;
    font-size: 14px;
}

.device-panel h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 18px;
}

.device-list {
    max-height: 400px;
    overflow-y: auto;
}

.device-item {
    background: #f7fafc;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.device-name {
    font-weight: bold;
    color: #4a5568;
}

.device-time {
    font-size: 12px;
    color: #718096;
    margin-top: 5px;
}

.no-devices {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 20px;
}

.file-display {
    flex: 1;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.file-header {
    background: #f7fafc;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-header h3 {
    color: #4a5568;
    font-size: 20px;
}

.file-stats {
    color: #718096;
    font-size: 14px;
}

.file-list {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: all 0.3s;
    cursor: pointer;
}

.file-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}

.file-preview {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    object-fit: cover;
    margin-right: 15px;
    border: 1px solid #e2e8f0;
}

.file-icon {
    width: 60px;
    height: 60px;
    background: #f7fafc;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
    border: 1px solid #e2e8f0;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 5px;
}

.file-details {
    font-size: 12px;
    color: #718096;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.file-actions button {
    padding: 5px 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.file-actions button:hover {
    background: #5a67d8;
}

.no-files {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 50px;
    font-size: 16px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 95%;
    max-width: 1200px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border-radius: 10px;
    max-height: 95vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    color: #718096;
}

.close:hover {
    color: #4a5568;
}

.image-viewer, .video-viewer {
    text-align: center;
}

.image-viewer img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 5px;
    object-fit: contain;
}

.video-viewer video {
    max-width: 100%;
    max-height: 70vh;
}

.image-tools, .video-tools {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.image-tools button, .video-tools button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.editor-container {
    text-align: center;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

#imageEditor {
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    cursor: crosshair;
    display: block;
    position: relative;
    z-index: 1;
}

.editor-tools {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    z-index: 10;
    /* 确保工具栏始终在上层 */
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.tool-group label {
    font-weight: bold;
    color: #4a5568;
    font-size: 12px;
    min-width: 60px;
}

.tool-group input[type="range"] {
    width: 100px;
}

#zoomSlider {
    width: 120px;
}

.tool-group input[type="color"] {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tool-button {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    min-width: 70px;
}

.tool-button:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.tool-button.active {
    background: #48bb78;
}

.tool-button.danger {
    background: #f56565;
}

.tool-button.danger:hover {
    background: #e53e3e;
}

.history-controls {
    display: flex;
    gap: 5px;
}

.shape-tools {
    display: flex;
    gap: 5px;
}

.drawing-tools {
    display: flex;
    gap: 10px;
}

@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .qr-section {
        flex: none;
    }
    
    .content-area {
        flex-direction: column;
    }
    
    .sidebar {
        flex: none;
    }
}

/* 全屏模式样式 */
.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: #000 !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

/* 当编辑器进入全屏模式时，调整模态框 */
#editModal .modal-content {
    position: relative;
}

#editModal .modal-content .fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
}

/* 在全屏模式下隐藏模态框的关闭按钮 */
.fullscreen-mode ~ .close {
    display: none !important;
}

.fullscreen-mode .canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #000;
    position: relative;
    width: 100%;
    height: calc(100vh - 100px);
}

.fullscreen-mode #imageEditor {
    position: absolute !important;
    border: none !important;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.fullscreen-mode .editor-tools {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    padding: 10px;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    z-index: 10000;
    max-height: 100px;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* 全屏模式下工具栏所有文字颜色 */
.fullscreen-mode .editor-tools,
.fullscreen-mode .editor-tools * {
    color: #333 !important;
}

.fullscreen-mode .tool-group {
    margin: 0;
    display: flex;
    gap: 5px;
    align-items: center;
}

.fullscreen-mode .tool-group label {
    color: #333 !important;
    font-size: 12px;
    margin-right: 5px;
}

.fullscreen-mode .tool-button {
    padding: 6px 12px;
    font-size: 11px;
    min-width: auto;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    color: #333 !important;
}

.fullscreen-mode .tool-button:hover {
    background: rgba(255, 255, 255, 1) !important;
    color: #333 !important;
}

.fullscreen-mode .tool-button.active {
    background: rgba(255, 255, 255, 1) !important;
    color: #333 !important;
    font-weight: bold;
}

.fullscreen-mode .tool-button.danger {
    background: rgba(220, 53, 69, 0.8) !important;
    border-color: rgba(220, 53, 69, 1) !important;
    color: white !important;
}

.fullscreen-mode .tool-button.danger:hover {
    background: rgba(220, 53, 69, 1) !important;
    color: white !important;
}

.fullscreen-mode label {
    color: #333 !important;
    font-size: 12px;
    margin-right: 5px;
}

.fullscreen-mode input[type="range"] {
    width: 80px;
    background: rgba(255, 255, 255, 0.2);
}

.fullscreen-mode input[type="color"] {
    width: 30px;
    height: 25px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.fullscreen-mode span {
    color: #333 !important;
    font-size: 11px;
}

.fullscreen-mode #zoomValue,
.fullscreen-mode #brushSizeValue,
.fullscreen-mode #brushOpacityValue {
    color: #333 !important;
    font-size: 11px;
}

.fullscreen-mode .history-controls {
    display: flex;
    gap: 5px;
}

.fullscreen-mode .history-controls .tool-button {
    color: #333 !important;
    background: rgba(255, 255, 255, 0.9) !important;
}

.fullscreen-mode .history-controls .tool-button:disabled {
    color: #999 !important;
    background: rgba(255, 255, 255, 0.5) !important;
}

.fullscreen-mode #undoBtn,
.fullscreen-mode #redoBtn {
    color: #333 !important;
}

.fullscreen-mode #fullscreenBtn {
    color: #333 !important;
}

/* 全屏关闭按钮 */
.fullscreen-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.fullscreen-close:hover {
    background: rgba(255, 0, 0, 0.7);
    transform: scale(1.1);
}

.fullscreen-mode .fullscreen-close {
    display: flex;
}

/* 设备列表样式 */
.device-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.device-item:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
}

.device-item.drag-over {
    background: #e8f5e8;
    border-color: #4caf50;
    border-style: dashed;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.device-name {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 4px;
}

.device-time {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
}

.drag-hint {
    font-size: 11px;
    color: #28a745;
    font-style: italic;
    text-align: center;
    padding: 4px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.device-item:hover .drag-hint {
    opacity: 1;
}

.device-item.selected {
    background: #e6f3ff;
    border-color: #2196f3;
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
}

.device-item.selected .device-name {
    color: #1976d2;
    font-weight: 700;
}

.device-item.selected .drag-hint {
    background: rgba(33, 150, 243, 0.2);
    color: #1976d2;
    font-weight: 600;
}

/* 传输进度样式 */
.transfer-progress {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(33, 150, 243, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 通知消息样式 */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    max-width: 400px;
    word-wrap: break-word;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification.success {
    background: rgba(76, 175, 80, 0.95);
    color: white;
    border-left: 4px solid #4caf50;
}

.notification.error {
    background: rgba(244, 67, 54, 0.95);
    color: white;
    border-left: 4px solid #f44336;
}

.notification.info {
    background: rgba(33, 150, 243, 0.95);
    color: white;
    border-left: 4px solid #2196f3;
}

/* 设备列表容器优化 */
.device-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.device-list::-webkit-scrollbar {
    width: 6px;
}

.device-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.device-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.device-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.no-devices {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}
/* --- Responsive fixes: avoid horizontal scroll on desktop --- */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
.main-content {
  flex-wrap: wrap;
}
.content-area {
  min-width: 0;
  flex-wrap: wrap;
}
.file-display {
  min-width: 0;
  overflow: hidden;
}
.file-info {
  min-width: 0;
}
.file-name {
  word-break: break-all;
  overflow-wrap: anywhere;
}
