/* 头部区域样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* 修复：覆盖全局 header-actions 的 absolute 定位 */
.header .header-actions {
    position: static;
    transform: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 返回按钮样式 */
.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 18px;
    background-color: #f5f5f5;
    color: #666;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    height: 36px;
    box-sizing: border-box;
}

.back-btn:hover {
    background-color: #e8e8e8;
    color: #333;
    transform: translateY(-1px);
}

/* 收藏按钮样式 */
.favorite-button {
    display: inline-flex;
    align-items: center;
    padding: 6px 18px;
    background-color: #f5f5f5;
    color: #666;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 36px;
    box-sizing: border-box;
    font-family: inherit;
}

.favorite-button:hover {
    background-color: #e8e8e8;
    color: #333;
    transform: translateY(-1px);
}

.favorite-button.favorited {
    background-color: #fff8e1;
    color: #f9a825;
}

.favorite-button.favorited:hover {
    background-color: #ffecb3;
    color: #f57f17;
}

/* 工具主内容区域 */

.tool-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
    color: #1d1d1f;
}

.tool-content {
    background-color: white;
    border-radius: 10px;
    padding: 0 30px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 图片上传区域 */
.image-upload-section {
    margin-bottom: 30px;
}

.upload-box {
    margin-bottom: 20px;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.upload-area:hover {
    border-color: #4CAF50;
    background-color: #f0f9f0;
}

.upload-area i {
    font-size: 4rem;
    color: #999;
    margin-bottom: 10px;
    display: block;
}

.upload-area p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 5px;
}

.upload-area small {
    color: #999;
    font-size: 0.9rem;
}

/* 图片预览区域 */
.preview-container {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 10px;
    background-color: #fafafa;
}

.preview-container h3 {
    margin-bottom: 15px;
    color: #333;
}

.preview-box {
    width: 100%;
    height: 300px;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

/* 格式转换区域 */
.conversion-section {
    margin-bottom: 30px;
}

.conversion-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.format-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.format-option input[type="radio"] {
    display: none;
}

.format-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 60px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #666;
    transition: all 0.3s ease;
    background-color: white;
}

.format-option input[type="radio"]:checked + .format-icon {
    border-color: #4CAF50;
    background-color: #f0f9f0;
    color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.format-option:hover .format-icon {
    border-color: #4CAF50;
    background-color: #f9fff9;
}

/* 转换控制按钮 */
.conversion-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px !important;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-primary:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-success {
    background-color: #2196F3;
    color: white;
}

.btn-success:hover {
    background-color: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* 转换结果区域 */
.result-container {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 10px;
    background-color: #fafafa;
}

.result-container h3 {
    margin-bottom: 15px;
    color: #333;
}

.result-box {
    width: 100%;
    height: 300px;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.result-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.download-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.result-info {
    font-size: 0.9rem;
    color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    .back-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .favorite-button {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .tool-header h1 {
        font-size: 2rem;
    }
    
    .tool-content {
        padding: 20px;
    }
    
    .format-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .conversion-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .image-info {
        flex-direction: column;
        gap: 5px;
    }
    
    .download-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .tool-header h1 {
        font-size: 1.5rem;
    }
    
    .tool-header p {
        font-size: 1rem;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .upload-area i {
        font-size: 3rem;
    }
    
    .preview-box,
    .result-box {
        height: 200px;
    }
}