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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 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 */
.header {
    text-align: center;
    padding: 40px 0;
    color: white;
}

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

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

/* Main Content */
.main-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #764ba2;
    background: linear-gradient(135deg, #e4e8ec 0%, #d4d9df 100%);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: linear-gradient(135deg, #e8eaff 0%, #d4d9ff 100%);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

.upload-link {
    color: #667eea;
    text-decoration: underline;
    font-weight: 600;
}

.upload-hint {
    margin-top: 15px;
    color: #666;
    font-size: 0.9rem;
}

/* Progress Section */
.progress-section {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

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

.progress-text {
    text-align: center;
    margin-top: 10px;
    color: #667eea;
    font-weight: 500;
}

/* Preview Section */
.preview-section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.5rem;
    color: #333;
}

.btn-clear {
    padding: 8px 16px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

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

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* File Item (通用) */
.file-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    background: #f5f5f5;
}

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

/* Image Item */
.file-item.image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* Word Item */
.file-item.word-item {
    background: linear-gradient(135deg, #2b579a 0%, #1e3f6f 100%);
    color: white;
}

.word-preview {
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.word-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.word-name {
    font-size: 0.9rem;
    text-align: center;
    word-break: break-all;
    max-width: 100%;
}

/* TXT Item */
.file-item.txt-item {
    background: linear-gradient(135deg, #4a4a4a 0%, #2c2c2c 100%);
    color: white;
}

.txt-preview {
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.txt-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.txt-name {
    font-size: 0.9rem;
    text-align: center;
    word-break: break-all;
    max-width: 100%;
}

.file-info {
    padding: 12px;
    background: white;
}

.file-name {
    font-size: 0.85rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
}

.file-type {
    font-size: 0.7rem;
    color: #999;
    margin-top: 2px;
}

.file-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-item:hover .file-actions {
    opacity: 1;
}

.btn-view, .btn-delete {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s ease;
}

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

.btn-view:hover {
    background: #5a6fd6;
    transform: scale(1.1);
}

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

.btn-delete:hover {
    background: #ff5252;
    transform: scale(1.1);
}

/* Actions Section */
.actions-section {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.4);
}

.btn-word {
    background: linear-gradient(135deg, #2b579a 0%, #1e3f6f 100%);
    color: white;
}

.btn-word:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(43, 87, 154, 0.4);
}

.btn-txt {
    background: linear-gradient(135deg, #4a4a4a 0%, #2c2c2c 100%);
    color: white;
}

.btn-txt:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(74, 74, 74, 0.4);
}

.btn-camera {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-camera:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(17, 153, 142, 0.4);
}

.btn-code {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-code:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.4);
}

.btn-open-new {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-open-new:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(17, 153, 142, 0.4);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    z-index: 10;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

.modal-close:hover {
    transform: rotate(90deg);
}

.modal-content img {
    max-width: 100%;
    max-height: 70vh;
    display: block;
}

.modal-info {
    padding: 20px;
    background: white;
}

.modal-info p {
    margin-bottom: 8px;
    color: #333;
}

/* Word Modal Specific */
.word-modal-content {
    max-width: 500px;
    width: 90%;
}

.word-preview-header {
    background: linear-gradient(135deg, #2b579a 0%, #1e3f6f 100%);
    padding: 40px;
    text-align: center;
    color: white;
}

.word-icon-large {
    font-size: 5rem;
    margin-bottom: 15px;
}

.word-preview-header h3 {
    font-size: 1.5rem;
    font-weight: 500;
}

.word-preview-body {
    padding: 30px;
}

.word-file-info {
    background: #f5f7fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.word-file-info p {
    margin-bottom: 10px;
    color: #333;
}

.word-file-info p:last-child {
    margin-bottom: 0;
}

.word-actions {
    display: flex;
    justify-content: center;
}

/* TXT Modal Specific */
.txt-modal-content {
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
}

.txt-preview-header {
    background: linear-gradient(135deg, #4a4a4a 0%, #2c2c2c 100%);
    padding: 30px;
    text-align: center;
    color: white;
}

.txt-icon-large {
    font-size: 4rem;
    margin-bottom: 10px;
}

.txt-preview-header h3 {
    font-size: 1.5rem;
    font-weight: 500;
}

.txt-preview-body {
    padding: 25px;
    max-height: calc(85vh - 150px);
    overflow-y: auto;
}

.txt-file-info {
    background: #f5f7fa;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.txt-file-info p {
    margin-bottom: 5px;
    color: #333;
    font-size: 0.9rem;
}

.txt-file-info p:last-child {
    margin-bottom: 0;
}

.txt-content-wrapper {
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.txt-content {
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.txt-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Code Preview Modal Specific */
.code-preview-modal-content {
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
}

.code-preview-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px 30px;
    text-align: center;
    color: white;
}

.code-preview-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.code-preview-header h3 {
    font-size: 1.4rem;
    font-weight: 500;
}

.code-preview-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
}

.code-preview-body {
    padding: 0;
    max-height: calc(90vh - 140px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.code-preview-tabs {
    display: flex;
    background: #f5f7fa;
    border-bottom: 1px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #333;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: block;
}

#codePreviewFrame {
    width: 100%;
    height: 500px;
    border: none;
    background: white;
}

.source-code-wrapper {
    height: 500px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 0;
}

#sourceCode {
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

.code-preview-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: #f5f7fa;
    border-top: 1px solid #e9ecef;
    flex-wrap: wrap;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: white;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .actions-section {
        gap: 8px;
    }

    .txt-modal-content,
    .code-preview-modal-content {
        max-width: 95%;
    }

    .txt-content,
    #sourceCode {
        padding: 15px;
        font-size: 0.85rem;
    }

    #codePreviewFrame,
    .source-code-wrapper {
        height: 400px;
    }

    .code-preview-tabs {
        flex-direction: column;
    }

    .tab-btn {
        padding: 12px;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

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

.empty-state-text {
    font-size: 1.1rem;
}
