* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    max-width: 600px;
    margin: 0 auto;
}

.options-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.options-panel h3 {
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.options-panel h3::before {
    content: "⚙️";
}

.size-selector,
.quality-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.size-selector label,
.quality-selector label {
    font-weight: 500;
    color: #2c3e50;
}

.size-selector select,
.quality-selector select {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.size-selector select:focus,
.quality-selector select:focus {
    outline: none;
    border-color: #3498db;
}

.custom-size {
    display: flex;
    align-items: center;
    gap: 10px;
    display: none;
}

.custom-size input {
    width: 100px;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
}

.custom-size span {
    white-space: nowrap;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.upload-area {
    background: white;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    transition: all 0.3s ease;
    border: 2px dashed #3498db;
}

.upload-area.active {
    background: #f0f8ff;
    border-color: #2980b9;
    transform: scale(1.01);
}

.upload-area.error {
    border-color: #e74c3c;
    background: #fdf0ed;
}

.upload-icon {
    font-size: 60px;
    color: #3498db;
    margin-bottom: 20px;
}

.upload-text {
    margin-bottom: 25px;
}

.upload-text h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.upload-text p {
    color: #7f8c8d;
    font-size: 1rem;
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #d5dbdb;
}

.btn-download {
    background: #2ecc71;
    color: white;
    display: none;
    margin: 20px auto;
}

.btn-download:hover {
    background: #27ae60;
}

.btn-cancel {
    background: #e74c3c;
    color: white;
    margin-top: 15px;
}

.btn-cancel:hover {
    background: #c0392b;
}

.progress-area {
    display: none;
    margin-top: 30px;
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

#currentFile {
    color: #7f8c8d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

#progressPercent {
    font-weight: 600;
    color: #3498db;
}

.progress-bar {
    height: 10px;
    background: #ecf0f1;
    border-radius: 5px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 5px;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.results {
    display: none;
    margin-top: 30px;
}

.results h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-options label {
    font-weight: 500;
    color: #2c3e50;
}

.sort-options select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.folder-structure {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

.folder-path {
    font-family: monospace;
    color: #495057;
    font-size: 0.9rem;
    line-height: 1.5;
}

.folder-item {
    margin: 5px 0;
    padding-left: 15px;
    position: relative;
}

.folder-item::before {
    content: "📁";
    margin-right: 5px;
}

.file-item {
    margin: 3px 0;
    padding-left: 25px;
    position: relative;
}

.file-item::before {
    content: "🖼️";
    margin-right: 5px;
}

.folder-stats {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 5px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.image-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.image-preview {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid #f0f0f0;
}

.image-info {
    padding: 15px;
}

.image-name {
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-path {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.compression-rate {
    color: #2ecc71;
    font-weight: 600;
}

.no-compression {
    color: #3498db;
    font-weight: 600;
}

.file-input {
    display: none;
}

.instructions {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-top: 40px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.instructions h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.instructions ul {
    padding-left: 20px;
    color: #7f8c8d;
}

.instructions li {
    margin-bottom: 10px;
}

.summary {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    display: none;
}

.summary h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-value {
    font-weight: 600;
    color: #3498db;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.empty-state .icon {
    font-size: 50px;
    margin-bottom: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .buttons {
        flex-direction: column;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }

    .upload-area {
        padding: 25px;
    }

    .options-panel {
        flex-direction: column;
        align-items: flex-start;
    }

    .size-selector,
    .quality-selector {
        width: 100%;
        justify-content: space-between;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .progress-info {
        flex-direction: column;
        gap: 5px;
    }

    #currentFile {
        max-width: 100%;
    }

    .folder-structure {
        padding: 10px;
    }

    .file-item {
        padding-left: 15px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.image-card {
    animation: fadeIn 0.5s ease;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}



/* 在现有样式的基础上添加以下内容 */

.folder-stats {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.folder-stats-details {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.folder-stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.folder-stat-label {
    font-weight: 500;
}

.folder-stat-value {
    font-weight: 600;
}

.folder-original-size {
    color: #6c757d;
}

.folder-compressed-size {
    color: #3498db;
}

.folder-savings {
    color: #2ecc71;
}

.folder-compression-rate {
    color: #e67e22;
}

/* 嵌套文件夹样式 */
.folder-nested {
    margin-left: 20px;
    border-left: 2px solid #e9ecef;
    padding-left: 15px;
    margin-top: 10px;
}

.folder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap;
    gap: 10px;
}

.folder-name {
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 5px;
}

.folder-name::before {
    content: "📁";
}

.file-count {
    font-size: 0.8rem;
    color: #7f8c8d;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
}



/* 在现有样式的基础上添加以下内容 */

.file-list {
    margin-top: 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    background: white;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    margin: 3px 0;
    border-radius: 4px;
    font-size: 0.85rem;
}

.file-item:hover {
    background: #f8f9fa;
}

.file-item.compressed {
    border-left: 3px solid #2ecc71;
}

.file-item.not-compressed {
    border-left: 3px solid #3498db;
}

.file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.file-stats {
    color: #2ecc71;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.8rem;
}

.file-status {
    color: #3498db;
    font-weight: 500;
    white-space: nowrap;
    font-size: 0.8rem;
    background: #e3f2fd;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: auto;
}

/* 响应式设计调整 */
@media (max-width: 768px) {
    .file-item {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .file-stats,
    .file-status {
        align-self: auto;
        margin-left: auto;
    }
}