/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 主内容区域 */
main {
    margin-bottom: 30px;
}

/* 卡片样式 */
.card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #f8f9fa;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
}

.card-header h2 {
    color: #495057;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    border-bottom: none;
    padding: 0;
}

.card-body {
    padding: 20px;
}

/* 文本区域样式 */
textarea {
    width: 100%;
    height: 150px;
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    resize: vertical;
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 16px;
    background-color: #fafafa;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

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

/* 按钮组样式 */
.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 120px;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

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

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-copy {
    background-color: #fd7e14;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    min-width: auto;
    border-radius: 6px;
}

.btn-copy:hover {
    background-color: #e06c00;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(253, 126, 20, 0.3);
}

/* 历史记录样式 */
.history-container {
    max-height: 300px;
    overflow-y: auto;
    background-color: #fafafa;
    border-radius: 8px;
    padding: 12px;
}

#historyList {
    list-style: none;
}

#historyList li {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    flex-wrap: wrap;
    gap: 8px;
}

.history-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

#historyList li:hover {
    background-color: #f8f9fa;
}

#historyList li:last-child {
    border-bottom: none;
}

.history-item {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 12px;
    font-size: 14px;
    color: #495057;
}

.history-time {
    font-size: 12px;
    color: #6c757d;
    margin-right: 12px;
    flex-shrink: 0;
}

/* 状态卡片 */
.status-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-weight: 600;
    color: #6c757d;
}

.status-value {
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.status-value.connected {
    background-color: #d4edda;
    color: #155724;
}

.status-value.disconnected {
    background-color: #f8d7da;
    color: #721c24;
}

/* 底部样式 */
footer {
    text-align: center;
    color: white;
    font-size: 14px;
    opacity: 0.9;
}

footer p {
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    #historyList li {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .history-time {
        margin-bottom: 0;
    }
    
    .status-card {
        flex-direction: column;
        align-items: stretch;
    }
    
    .status-item {
        justify-content: space-between;
    }
}

/* 滚动条样式 */
.history-container::-webkit-scrollbar {
    width: 6px;
}

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

.history-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.history-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease;
}

/* 图片预览样式 */
.image-preview {
    margin: 16px 0;
    padding: 16px;
    border: 2px dashed #e9ecef;
    border-radius: 8px;
    background-color: #fafafa;
    text-align: center;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 图片预览占位符样式 */
.image-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.image-preview-text {
    color: #999;
    font-size: 16px;
    font-style: italic;
    margin: 0;
    pointer-events: none;
}

/* 拖拽样式 */
.image-preview.dragover {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
    color: #667eea;
    cursor: pointer;
}

.image-preview.dragover .image-preview-text {
    color: #667eea;
}

.image-preview {
    cursor: pointer;
    transition: all 0.2s ease;
}

/* 隐藏占位符当有内容时 */
.image-preview.has-content .image-preview-placeholder {
    display: none;
}

/* 文件上传区域样式 */
.file-upload-section {
    margin: 16px 0;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

#fileInput {
    flex: 1;
    padding: 8px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #fafafa;
    min-width: 200px;
}

/* 文件下载样式 */
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.file-item:hover {
    background-color: #f8f9fa;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-name {
    font-weight: 600;
    color: #495057;
}

.file-size {
    font-size: 14px;
    color: #6c757d;
}

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

.download-btn {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.delete-btn {
    padding: 8px 16px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    background-color: #28a745;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* 消息提示样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    transform: translateX(0);
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.message-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 手动复制区域样式 */
.manual-copy-area {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-top: 16px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.manual-copy-header {
    background-color: #e9ecef;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
}

.manual-copy-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}

.manual-copy-content {
    padding: 16px;
}

.manual-copy-content textarea {
    width: 100%;
    min-height: 100px;
    margin-bottom: 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

/* 图片复制区域样式 */
.image-copy-area {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-top: 16px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 图片预览容器样式 */
.image-preview-container {
    position: relative;
    display: inline-block;
    margin: 10px;
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

/* 图片复制按钮样式 */
.copy-image-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 8px 16px;
    background-color: rgba(102, 126, 234, 0.9);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    z-index: 10;
}

.copy-image-btn:hover {
    background-color: rgba(90, 108, 216, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* 图片复制按钮样式 */
.image-copy-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}

/* 小按钮样式 */
.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
    min-width: auto;
    border-radius: 6px;
}

/* 文件列表样式 */
.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .image-copy-buttons {
        flex-direction: column;
    }
    
    .copy-image-btn {
        position: static;
        margin-top: 8px;
        width: 100%;
    }
    
    .manual-copy-header {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .manual-copy-header button {
        align-self: flex-end;
    }
}