/* 基础样式重置 */
* {
    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;
    color: #333;
}

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

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* 上传区域 */
.upload-section {
    margin-bottom: 50px;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 15px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f8f9fa;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-content .upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.7;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.upload-content p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1rem;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* 上传进度 */
.upload-progress {
    margin-top: 20px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    color: #667eea;
    font-weight: 500;
}

/* 文件列表区域 */
.files-section h2 {
    margin-bottom: 30px;
    color: #333;
    font-size: 1.8rem;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* 文件项 */
.file-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    cursor: pointer;
    position: relative;
}

/* 文件项可点击反馈 */
.file-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    transition: background 0.2s ease;
    z-index: 1;
}

.file-item:hover::before {
    background: rgba(102, 126, 234, 0.05);
}

.file-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.file-item:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* 长按状态下的视觉反馈 */
.file-item.long-press {
    transform: scale(0.98);
    box-shadow: 0 0 0 2px #667eea;
}

.file-preview {
    position: relative;
    background: #f8f9fa;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.notes-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 5;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.notes-badge:hover {
    opacity: 1;
    transform: scale(1.1);
}

.notes-badge .notes-count {
    display: inline-block;
}

.preview-canvas {
    max-width: 100%;
    max-height: 100%;
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.preview-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.file-info {
    padding: 20px;
}

.file-title-container {
    margin-bottom: 8px;
}

.file-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    word-break: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta-container {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.file-upload-date,
.file-size {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-upload-date {
    flex: 1;
    margin-right: 5px;
}

.file-size {
    flex: 1;
    text-align: right;
    margin-left: 5px;
}

/* 长按显示删除按钮 */
.file-item.long-press .file-actions {
    opacity: 1;
    pointer-events: auto; /* 长按时响应鼠标事件 */
    transform: scale(1);
}

.file-actions {
    display: flex;
    gap: 10px;
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    pointer-events: none; /* 默认不响应鼠标事件 */
    transform: scale(0.8);
}

.action-btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: auto;
}

.delete-btn {
    background: #f8f9fa;
    color: #dc3545;
    border: 1px solid #dc3545;
}

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 10px;
    font-size: 1rem;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.3rem;
}

.modal-content p {
    margin-bottom: 10px;
    color: #666;
    line-height: 1.5;
}

.modal-content strong {
    color: #dc3545;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    justify-content: center;
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 80px;
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 25px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .files-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 25px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .files-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (min-width: 1400px) {
    .files-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 1200px) and (min-width: 769px) {
    .files-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) and (min-width: 769px) {
    .files-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}