/* 全局样式 */
* {
    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%);
    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;
}

/* 功能导航 */
.function-nav {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-btn:hover {
    border-color: #007bff;
    color: #007bff;
}

.nav-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.tools-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .tools-container {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1024px) {
    .tools-container#image-tools {
        grid-template-columns: 1fr;
    }
}

/* 工具区域样式 */
.tool-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tool-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.section-header {
    text-align: center;
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 1.8rem;
    color: #4a5568;
    margin-bottom: 8px;
}

.section-header p {
    color: #718096;
    font-size: 0.95rem;
}

/* 上传区域样式 */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background-color: #f7fafc;
}

.upload-area.dragover {
    border-color: #667eea;
    background-color: #ebf8ff;
    transform: scale(1.02);
}

.upload-area.has-files {
    border-color: #48bb78;
    background-color: #f0fff4;
    border-style: solid;
}

.upload-area.has-files .upload-icon {
    color: #48bb78;
}

.upload-area.has-files .upload-content p {
    color: #2d3748;
    font-weight: 500;
}

.upload-icon {
    font-size: 3rem;
    color: #a0aec0;
    margin-bottom: 15px;
}

.upload-content p {
    margin-bottom: 8px;
    color: #4a5568;
}

.upload-hint {
    font-size: 0.85rem;
    color: #718096;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* 文件列表样式 */
.file-list {
    margin-bottom: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: #edf2f7;
}

.file-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.file-icon {
    color: #e53e3e;
    margin-right: 10px;
    font-size: 1.2rem;
}

.file-name {
    font-weight: 500;
    color: #2d3748;
    margin-right: 10px;
}

.file-size {
    color: #718096;
    font-size: 0.85rem;
}

.remove-file {
    background: none;
    border: none;
    color: #e53e3e;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.remove-file:hover {
    background: #fed7d7;
}

/* 文件预览样式 */
.file-preview {
    margin-bottom: 20px;
}

.preview-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* 按钮样式 */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #edf2f7;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover:not(:disabled) {
    background: #e2e8f0;
    transform: translateY(-1px);
}

/* 进度提示样式 */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.progress-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#progress-text {
    color: #4a5568;
    font-size: 1.1rem;
    font-weight: 500;
}

/* 消息提示样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

.message.success {
    background: #48bb78;
}

.message.error {
    background: #e53e3e;
}

.message.info {
    background: #4299e1;
}

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

/* 格式选择按钮 */
.conversion-options {
    margin: 1rem 0;
    text-align: center;
}

.conversion-options label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.format-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.format-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.format-btn:hover {
    border-color: #007bff;
    color: #007bff;
}

.format-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* 响应式设计 */
@media (max-width: 767px) {
    .container {
        padding: 15px;
    }
    
    .function-nav {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .tool-section {
        padding: 20px;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .file-info {
        width: 100%;
    }
    
    .format-buttons {
        justify-content: center;
    }
    
    .format-btn {
        flex: 1;
        min-width: 80px;
    }
}

/* 拖拽排序样式 */
.file-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.file-item.drag-over {
    border-top: 2px solid #667eea;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 消息提示样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    max-width: 400px;
    animation: slideInRight 0.3s ease;
}

.message-success {
    border-left: 4px solid #28a745;
    color: #155724;
}

.message-error {
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.message-info {
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

.message i {
    font-size: 1.2rem;
}

.message-success i {
    color: #28a745;
}

.message-error i {
    color: #dc3545;
}

.message-info i {
    color: #17a2b8;
}

.message-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    font-size: 1.1rem;
}

.message-close:hover {
    color: #666;
}

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

/* 进度提示样式 */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.progress-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.progress-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.progress-message {
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}